diff --git a/src/tracks/arena_node_3d.hpp b/src/tracks/arena_node_3d.hpp index e4b19edeb..2ea8cfec3 100644 --- a/src/tracks/arena_node_3d.hpp +++ b/src/tracks/arena_node_3d.hpp @@ -31,10 +31,8 @@ class ArenaNode3D : public ArenaNode, public: ArenaNode3D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3, const Vec3 &normal, unsigned int node_index) - : ArenaNode(p0, p1, p2, p3, normal, node_index) - { - BoundingBox3D::init(p0, p1, p2, p3, normal); - } + : ArenaNode(p0, p1, p2, p3, normal, node_index), + BoundingBox3D(p0, p1, p2, p3, normal) {} // ------------------------------------------------------------------------ virtual bool pointInside(const Vec3& p, bool ignore_vertical = false) const OVERRIDE diff --git a/src/tracks/bounding_box_3d.hpp b/src/tracks/bounding_box_3d.hpp index 4f4c5ebd6..a2b596007 100644 --- a/src/tracks/bounding_box_3d.hpp +++ b/src/tracks/bounding_box_3d.hpp @@ -33,21 +33,8 @@ private: public: // ------------------------------------------------------------------------ - bool pointInside(const Vec3& p) const - { - float side = p.sideofPlane(m_box_faces[0][0], m_box_faces[0][1], - m_box_faces[0][2]); - for (int i = 1; i < 6; i++) - { - if (side * p.sideofPlane(m_box_faces[i][0], m_box_faces[i][1], - m_box_faces[i][2]) < 0) - return false; - } - return true; - } - // ------------------------------------------------------------------------ - void init(const Vec3& p0, const Vec3& p1, const Vec3& p2, const Vec3& p3, - const Vec3& normal) + BoundingBox3D(const Vec3& p0, const Vec3& p1, const Vec3& p2, + const Vec3& p3, const Vec3& normal) { // Compute the node bounding box used by pointInside Vec3 box_corners[8]; @@ -78,6 +65,20 @@ public: m_box_faces[i][j] = box_faces[i][j]; } } + // ------------------------------------------------------------------------ + bool pointInside(const Vec3& p, bool ignore_vertical = false) const + { + float side = p.sideofPlane(m_box_faces[0][0], m_box_faces[0][1], + m_box_faces[0][2]); + for (int i = 1; i < 6; i++) + { + if (side * p.sideofPlane(m_box_faces[i][0], m_box_faces[i][1], + m_box_faces[i][2]) < 0) + return false; + } + return true; + } + }; #endif \ No newline at end of file diff --git a/src/tracks/drive_node_3d.cpp b/src/tracks/drive_node_3d.cpp index be8f83752..133d2c159 100644 --- a/src/tracks/drive_node_3d.cpp +++ b/src/tracks/drive_node_3d.cpp @@ -24,9 +24,8 @@ DriveNode3D::DriveNode3D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, unsigned int node_index, bool invisible, bool ai_ignore) : DriveNode(p0, p1, p2, p3, normal, node_index, invisible, - ai_ignore) + ai_ignore), BoundingBox3D(p0, p1, p2, p3, normal) { - BoundingBox3D::init(p0, p1, p2, p3, normal); m_line = core::line3df(m_lower_center.toIrrVector(), m_upper_center.toIrrVector()); } // DriveNode3D