]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/commitdiff
Add method to set dimensions of more cars
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 14 Mar 2023 16:54:36 +0000 (17:54 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 14 Mar 2023 16:54:36 +0000 (17:54 +0100)
bcar/incl/bcar.hh
bcar/src/bcar.cc

index 658db31042b6bbc3ae116cd92ce36421f3315ea2..72655a23d769b52b9906571cc269fcad7e52ad70 100644 (file)
@@ -330,6 +330,9 @@ public:
         * \see https://www.ma.rhul.ac.uk/SRBparking
         */
        double perfect_parking_slot_len() const;
+
+       /*! Set parameters to what car. */
+       void become(std::string const what);
 };
 
 /*! Store car motion. */
index 350d1afc144ac2954e5ca381c81018c35fecab16..6c103d6f1a9c516b8d93439bc0fae3b1dc5926ab 100644 (file)
@@ -611,6 +611,36 @@ CarSize::perfect_parking_slot_len() const
        return this->len() + sqrt(s) - l - k;
 }
 
+void
+CarSize::become(std::string const what)
+{
+       if (what == "porsche cayenne") {
+               this->ctc(11.2531);
+               this->wwm(2.194);
+               this->w(1.983);
+               this->wb(2.895);
+               this->df(this->wb() + 0.936);
+               this->len(4.918);
+               this->ft(1.680);
+       } else if (what == "chrysler pacifica") {
+               this->ctc(9.557619159602458);
+               this->wwm(2.297);
+               this->w(2.022);
+               this->wb(3.089);
+               this->df(4.236);
+               this->len(5.171);
+               this->ft(1.748);
+       } else { // renault zoe
+               this->ctc(10.802166641822163);
+               this->wwm(1.945);
+               this->w(1.771);
+               this->wb(2.588);
+               this->df(3.427);
+               this->len(4.084);
+               this->ft(1.511);
+       }
+}
+
 double
 CarMove::sp() const
 {