Commits

Daniel K. O.  committed 429ba30

cosmetic cleanup

  • Participants
  • Parent commits a413fc1

Comments (0)

Files changed (14)

File include/kode/Vector3.hpp

 #include <kode/Details.hpp>
 #include <kode/Vector2.hpp>
 
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 10000 \
-                     + __GNUC_MINOR__ * 100             \
-                     + __GNUC_PATCHLEVEL__)
-#endif
 
 namespace kode {
 
 
 
     /// A 3D vector class.
-    struct
-
-#if GCC_VERSION >= 40800
-    //alignas(16)
-#endif
-    Vector3 {
-
-        Real x
-#if GCC_VERSION < 40800
-                  //__attribute__ ((aligned (16))) // for gcc 4.7
-#endif
-             ,
-             y,
-             z;
+    struct Vector3 {
+        Real x, y, z;
 
         /// Default constructor (zero-initialized).
         constexpr
                                          !detail::has_w_obj<T>::value,
                                          int>::type = 0>
         constexpr
-            Vector3(const T& t) noexcept :
+        Vector3(const T& t) noexcept :
             x{t.x},
             y{t.y},
             z{t.z}
         {}
 
 
-#if 0
-        /// Converts implicitly to **anything** that takes `(x, y, z)` in the constructor.
-        template<typename T,
-                 typename std::enable_if<std::is_constructible<T, Real,Real,Real>::value,
-                                         int>::type = 0>
-        constexpr inline
-        operator T() noexcept ( noexcept(T(x,y,z)) )
-        {
-            return T(x, y, z);
-        }
-#endif
-
 
         inline
         Real& operator[](unsigned i) noexcept;
             return {0,0,0};
         }
 
-#if 0
-        // don't use this
-        constexpr explicit
-        Vector3(Real a, Real b, Real c, Real d) :
-            x{a}, y{b}, z{c}
-        {}
-#endif
-
 
     };
 

File include/kode/collision/Box.hpp

 
     public:
 
+        Box(Real sX, Real sY, Real sZ) noexcept;
+
         Box(const Vector3& sz) noexcept;
 
         Type getType() const noexcept override;

File include/kode/collision/Capsule.hpp

 
         Capsule(Real radius, Real length);
 
+        void setRadius(Real r);
+
         Type getType() const noexcept override;
 
         inline
         Real getRadius() const noexcept;
 
-        void setRadius(Real r);
+        void setLength(Real len);
 
         inline
         Real getLength() const noexcept;
         inline
         Real getHalfLength() const noexcept;
 
-        void setLength(Real len);
-
         void setRadiusLength(Real radius, Real length);
     };
 

File include/kode/collision/Cylinder.hpp

 
         Cylinder(Real radius, Real length);
 
+        void setRadius(Real r);
+
         Type getType() const noexcept override;
 
         inline
         Real getRadius() const noexcept;
 
-        void setRadius(Real r);
-        
+        void setLength(Real len);
 
         inline
         Real getLength() const noexcept;
 
-        void setLength(Real len);
-
         void setRadiusLength(Real rad, Real len);
     };
 

File include/kode/collision/Sphere.hpp

         Real getRadius() const noexcept;
 
         void setRadius(Real radius);
-
-
-        //Vector3 supportPoint(const Vector3& dir) const noexcept override;
     };
 
 

File include/kode/joints/DoubleBall.hpp

         Vector3 localAnchor2 = {0, 0, 0};
         Real targetDistance = 0;
 
+        void updateConstraints(World& world) noexcept override;
+
     public:
         DoubleBall() = default;
 
 
         void setTargetDistance(Real td);
         Real getTargetDistance() const noexcept;
-
-        void updateConstraints(World& world) noexcept override;
     };
 
 }

File include/kode/joints/DoubleHinge.hpp

 
         Real targetDistance = 0;
 
+        void updateConstraints(World& world) noexcept override;
+
     public:
         DoubleHinge() = default;
 
 
         Vector3 getAxis1() const noexcept;
         Vector3 getAxis2() const noexcept;
-
-        void updateConstraints(World& world) noexcept override;
     };
 
 }

File include/kode/joints/Fixed.hpp

 
         void attach(Body* b1, Body* b2) override;
 
+        void updateConstraints(World& world) noexcept override;
+
     public:
         Fixed() = default;
 
         Fixed(Body& b1, Body& b2);
 
         void reset();
-
-        void updateConstraints(World& world) noexcept override;
-
     };
 
 }

File include/kode/joints/Hinge.hpp

 
         AngularMotor motor{*this};
 
+        void updateConstraints(World& world) noexcept override;
+
     public:
         Hinge() = default;
 
         void setAngle(Radian ra) noexcept;
         Radian getAngle() const noexcept;
 
-
-        void updateConstraints(World& world) noexcept override;
-
         inline
         const AngularMotor& getMotor() const noexcept;
 

File include/kode/joints/Hinge2.hpp

         Radian getAbsAngle1() const noexcept;
         Radian getAbsAngle2() const noexcept;
 
+        void updateConstraints(World& world) noexcept override;
 
     public:
         Hinge2() = default;
                const Vector3& axis1,
                const Vector3& axis2);
 
+        Real getSuspERP() const noexcept;
         void setSuspERP(Real e);
         void unsetSuspERP() noexcept;
-        Real getSuspERP() const noexcept;
 
+        Real getSuspCFM() const noexcept;
         void setSuspCFM(Real c);
         void unsetSuspCFM() noexcept;
-        Real getSuspCFM() const noexcept;
 
         void setAnchor(const Vector3& anchor) noexcept;
         void setAnchor1(const Vector3& anchor) noexcept;
         Radian getAngle1() const noexcept;
         Radian getAngle2() const noexcept;
 
-        void updateConstraints(World& world) noexcept override;
-
         inline
         AngularMotor& getMotor1() noexcept;
 

File include/kode/joints/Piston.hpp

         AngularMotor amotor{*this};
         LinearMotor lmotor{*this};
 
+        void updateConstraints(World& world) noexcept override;
+
     public:
         Piston() = default;
 
         Radian getAngle() const noexcept;
         void setAngle(Radian angle) noexcept;
 
-        void updateConstraints(World& world) noexcept override;
-
         inline
         const AngularMotor& getAngularMotor() const noexcept;
 

File include/kode/joints/Slider.hpp

         void resetOffset();
 
         void attach(Body* b1, Body* b2) override;
+
+        void updateConstraints(World& world) noexcept override;
+
     public:
         Slider() = default;
 
 
         void setPosition(Real pos) noexcept;
         Real getPosition() const noexcept;
-
-        void updateConstraints(World& world) noexcept override;
     };
 
 }

File src/collision/Box.cpp

 
 namespace kode {
 
+
+    Box::Box(Real sX, Real sY, Real sZ) noexcept :
+        Box{{sX, sY, sZ}}
+    {}
+
+
     Box::Box(const Vector3& sz) noexcept
     {
         setSize(sz);

File src/joints/Piston.cpp

     Real
     Piston::getPosition() const noexcept
     {
-        return dot(getAxis1(), getAnchor1()) - dot(getAxis2(), getAnchor2());
+        return dot(getAxis2(), getAnchor1() - getAnchor2());
     }