Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Menge::Math::OBBShape Class Reference

Oriented bounding box. More...

#include <Geometry2D.h>

Inheritance diagram for Menge::Math::OBBShape:
Menge::Math::Geometry2D Menge::BFSM::OBBCondition

Public Member Functions

 OBBShape ()
 Default constructor.
 
 OBBShape (const Vector2 &pivot, const Vector2 &size, float angle)
 Constructor. More...
 
 OBBShape (const OBBShape &shape)
 Copy constructor. More...
 
 OBBShape (const OBBShape &shape, const Vector2 &offset)
 Initializes this shape as an translated version of the input shape. More...
 
OBBShape operator+ (const Vector2 &pt)
 Construct an offset version of this shape. More...
 
virtual bool containsPoint (const Vector2 &pt) const
 Determine if the point is inside the shape based on the instance properties. More...
 
virtual bool containsPoint (const Vector2 &pt, const Vector2 &pos) const
 Determine if the point is inside a OBB, centered on the given position. More...
 
void set (const Vector2 &pivot, float width, float height, float angle)
 Sets the extent of the OBB. More...
 
void setSize (const Vector2 &size)
 Sets the size of the OBB. More...
 
void setAngle (float angle)
 Sets the angle of the OBB. More...
 
- Public Member Functions inherited from Menge::Math::Geometry2D
 Geometry2D ()
 Constructor.
 
virtual ~Geometry2D ()
 Simple destructor.
 

Protected Attributes

Vector2 _pivot
 The minimum corners of the bounding box (the box is rotated around this point).
 
Vector2 _size
 The width and height of the box (along its local coordinate system).
 
Vector2 _halfSize
 The half width and height of the box.
 
float _cosTheta
 The cosine of the box's angle of rotation (used for accelerating queries).
 
float _sinTheta
 The sine of the box's angle of rotation (used for accelerating queries).
 

Detailed Description

Oriented bounding box.

Constructor & Destructor Documentation

Menge::Math::OBBShape::OBBShape ( const Vector2 pivot,
const Vector2 size,
float  angle 
)

Constructor.

Parameters
pivotThe minimum values of the unrotated bounding box along the x- and y-axes, respectively. The bounding box gets rotated around this point.
sizeThe size of the bounding box along the LOCAL x- and y-axes, respectively.
angleThe angle of rotation (in radians).
Menge::Math::OBBShape::OBBShape ( const OBBShape shape)

Copy constructor.

Parameters
shapeThe shape to copy from.
Menge::Math::OBBShape::OBBShape ( const OBBShape shape,
const Vector2 offset 
)

Initializes this shape as an translated version of the input shape.

Parameters
shapeThe shape to copy from.
offsetoffset vector from the copied shape

Member Function Documentation

bool Menge::Math::OBBShape::containsPoint ( const Vector2 pt) const
virtual

Determine if the point is inside the shape based on the instance properties.

Parameters
ptThe point to test.
Returns
True if the point is inside the shape, false otherwise.

Implements Menge::Math::Geometry2D.

Reimplemented in Menge::BFSM::OBBCondition.

bool Menge::Math::OBBShape::containsPoint ( const Vector2 pt,
const Vector2 pos 
) const
virtual

Determine if the point is inside a OBB, centered on the given position.

Parameters
ptThe point to test.
posThe position of the circle.
Returns
True if the point is inside the shape, false otherwise.

Implements Menge::Math::Geometry2D.

OBBShape Menge::Math::OBBShape::operator+ ( const Vector2 pt)

Construct an offset version of this shape.

Parameters
ptThe offset value.
Returns
A new OBBShape offset from this one by the vector pt.
void Menge::Math::OBBShape::set ( const Vector2 pivot,
float  width,
float  height,
float  angle 
)

Sets the extent of the OBB.

Parameters
pivotThe pivot point of the OBB
widthThe width of the unrotated box (length along the x-axis).
heightThe width of the unrotated box (length along the x-axis).
angleThe angle of rotation (in radians) around the pivot point.
void Menge::Math::OBBShape::setAngle ( float  angle)

Sets the angle of the OBB.

The pivot point and size remain unchanged.

Parameters
angleThe angle (in radians) the OBB is rotated around its pivot.
void Menge::Math::OBBShape::setSize ( const Vector2 size)
inline

Sets the size of the OBB.

The pivot point and angle remain unchanged.

Parameters
sizeThe width and height of the box.

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