diff --git a/sources/reactphysics3d/body/BoundingVolume.h b/sources/reactphysics3d/body/BoundingVolume.h index 317a8403..cace6296 100644 --- a/sources/reactphysics3d/body/BoundingVolume.h +++ b/sources/reactphysics3d/body/BoundingVolume.h @@ -48,7 +48,7 @@ class BoundingVolume { virtual void updateOrientation(const Vector3D& newCenter, const Quaternion& rotationQuaternion)=0; // Update the orientation of the bounding volume according to the new orientation of the body virtual int getExtremeVertices(const Vector3D projectionAxis, std::vector& extremeVertices) const=0; // Return all the vertices that are projected at the extreme of the projection of the bouding volume on the axis - virtual void draw() const=0; // Display the bounding volume (only for testing purpose) + virtual void draw() const=0; // Display the bounding volume (only for testing purpose) }; // Return the body pointer diff --git a/sources/reactphysics3d/body/OBB.cpp b/sources/reactphysics3d/body/OBB.cpp index f3e48cd9..9126f4da 100644 --- a/sources/reactphysics3d/body/OBB.cpp +++ b/sources/reactphysics3d/body/OBB.cpp @@ -133,6 +133,7 @@ void OBB::draw() const { } // Return all the vertices that are projected at the extreme of the projection of the bouding volume on the axis. +// Be careful when this method returns vertices of a polygonal face because vertices are not necessarly ordered. std::vector OBB::getExtremeVertices(const Vector3D axis) const { assert(axis.length() != 0); @@ -163,3 +164,13 @@ std::vector OBB::getExtremeVertices(const Vector3D axis) const { // Return the extreme vertices return extremeVertices; } + +// Return the 4 vertices the OBB's face in the direction of a given axis. +// This method returns the set of vertices of the face (vertices are ordered). +std::vector OBB::getFace(Vector3D& axis) const { + std::vector face; + + assert(face.size() == 4); + return face; +} + diff --git a/sources/reactphysics3d/body/OBB.h b/sources/reactphysics3d/body/OBB.h index ff3c4453..089cbfde 100644 --- a/sources/reactphysics3d/body/OBB.h +++ b/sources/reactphysics3d/body/OBB.h @@ -55,6 +55,7 @@ class OBB : public BoundingVolume { Vector3D getAxis(unsigned int index) const throw(std::invalid_argument) const; // Return an axis of the OBB void setAxis(unsigned int index, const Vector3D& axis) throw(std::invalid_argument); // Set an axis Vector3D getVertex(unsigned int index) const throw (std::invalid_argument) const; // Return a vertex of the OBB + std::vector getFace(Vector3D& axis) const; // Return the 4 vertices the OBB's face in the direction of a given axis double getExtent(unsigned int index) const throw(std::invalid_argument) const; // Return an extent value void setExtent(unsigned int index, double extent) throw(std::invalid_argument); // Set an extent value virtual std::vector getExtremeVertices(const Vector3D axis) const; // Return all the vertices that are projected at the extreme of the projection of the bouding volume on the axis