The small3d framework
Public Member Functions | Public Attributes | List of all members
small3d::BoundingBoxSet Class Reference

Set of bounding boxes for a SceneObject, loaded from a Wavefront file, allowing for collision detection (see README.md). More...

#include <BoundingBoxSet.hpp>

Public Member Functions

int getNumBoxes () const
 Get the number of boxes contained in the set.
 
 BoundingBoxSet (const std::string fileLocation="")
 Constructor. More...
 
 ~BoundingBoxSet ()=default
 Destructor.
 
bool collidesWith (const glm::vec3 point, const glm::vec3 thisOffset, const glm::vec3 thisRotation) const
 Check if a point collides (or is inside) any of the boxes of the box set, assuming that they are in a given offset and have a certain rotation. More...
 
bool collidesWith (const BoundingBoxSet otherBoxSet, const glm::vec3 thisOffset, const glm::vec3 thisRotation, const glm::vec3 otherOffset, const glm::vec3 otherRotation) const
 Check if another set of bounding boxes is located with this set (even partially), thus colliding with it. More...
 

Public Attributes

std::vector< std::vector< float > > vertices
 Vertex coordinates read from Wavefront .obj file.
 
std::vector< std::vector< unsigned int > > facesVertexIndexes
 Faces vertex indexes read from Wavefront .obj file.
 

Detailed Description

Set of bounding boxes for a SceneObject, loaded from a Wavefront file, allowing for collision detection (see README.md).

Constructor & Destructor Documentation

◆ BoundingBoxSet()

small3d::BoundingBoxSet::BoundingBoxSet ( const std::string  fileLocation = "")

Constructor.

Parameters
fileLocationLocation of the Wavefront file containing the bounding boxes

Constructor

Member Function Documentation

◆ collidesWith() [1/2]

bool small3d::BoundingBoxSet::collidesWith ( const glm::vec3  point,
const glm::vec3  thisOffset,
const glm::vec3  thisRotation 
) const

Check if a point collides (or is inside) any of the boxes of the box set, assuming that they are in a given offset and have a certain rotation.

Parameters
pointThe point (as a vector)
thisOffsetThe offset (location) of the box set
thisRotationThe rotation of the box set
Returns
True if there is a collision, False if not.

◆ collidesWith() [2/2]

bool small3d::BoundingBoxSet::collidesWith ( const BoundingBoxSet  otherBoxSet,
const glm::vec3  thisOffset,
const glm::vec3  thisRotation,
const glm::vec3  otherOffset,
const glm::vec3  otherRotation 
) const

Check if another set of bounding boxes is located with this set (even partially), thus colliding with it.

Parameters
otherBoxSetThe other box set
thisOffsetThe offset (location) of this box set
thisRotationThe rotation of this box set
otherOffsetThe offset (location) of the other box set
otherRotationThe rotation of the other box set
Returns
True if there is a collision, False if not.

The documentation for this class was generated from the following files: