]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Add inner/outer mirror radius computation
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 18:09:40 +0000 (19:09 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 19 Jan 2022 18:11:14 +0000 (19:11 +0100)
incl/bcar.hh
src/bcar.cc
ut/bcar.t.cc

index 71e4f505c9a698352d330dc5e113740a4563b185..d6b764cb64e9814d43e8183e13874f44f0f0e6cb 100644 (file)
@@ -293,6 +293,20 @@ public:
         */
        double orradi() const;
 
+       /*! \brief Return inner mirror radius.
+        *
+        * The inner mirror radius is the distance from minimum turning radius
+        * circle center to the farther mirror (from the rear axle view).
+        */
+       double imradi() const;
+
+       /*! \brief Return outer mirror radius.
+        *
+        * The outer mirror radius is the distance from minimum turning radius
+        * circle center to the farther mirror (from the rear axle view).
+        */
+       double omradi() const;
+
        /*! \brief Return length of perfect parking slot.
         *
         * The width of the slot is the same as the width of the car.
index 0b9062a0b793c6b0f9ac0874bfc069d3133efd1e..59fbb613f917c650e8544234abb4bfab6d5f704c 100644 (file)
@@ -555,6 +555,22 @@ CarSize::orradi() const
        return sqrt(mtrw2 + dr2);
 }
 
+double
+CarSize::imradi() const
+{
+       auto mtrw2 = pow(this->mtr() - this->wwm() / 2.0, 2.0);
+       auto df2 = pow(this->wb(), 2.0);
+       return sqrt(mtrw2 + df2);
+}
+
+double
+CarSize::omradi() const
+{
+       auto mtrw2 = pow(this->mtr() + this->wwm() / 2.0, 2.0);
+       auto df2 = pow(this->wb(), 2.0);
+       return sqrt(mtrw2 + df2);
+}
+
 double
 CarSize::perfect_parking_slot_len() const
 {
index 1f3bc854078aa6640a9fa5ebd22ead8af160b801..8770234edc8360f9b300e26667e3e6062112de6b 100644 (file)
@@ -50,6 +50,8 @@ WVTEST_MAIN("bcar basic geometry")
        WVPASSEQ_DOUBLE(3.327076, bc.iradi(), 0.00001);
        WVPASSEQ_DOUBLE(4.997358, bc.ofradi(), 0.00001);
        WVPASSEQ_DOUBLE(4.355868, bc.orradi(), 0.00001);
+       WVPASSEQ_DOUBLE(3.485485, bc.imradi(), 0.00001);
+       WVPASSEQ_DOUBLE(5.199608, bc.omradi(), 0.00001);
        bc.h(M_PI / 2.0);
 
        // moving