Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Oriented bounding box. More...
#include <Geometry2D.h>
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). | |
Oriented bounding box.
Constructor.
pivot | The minimum values of the unrotated bounding box along the x- and y-axes, respectively. The bounding box gets rotated around this point. |
size | The size of the bounding box along the LOCAL x- and y-axes, respectively. |
angle | The angle of rotation (in radians). |
Menge::Math::OBBShape::OBBShape | ( | const OBBShape & | shape | ) |
Copy constructor.
shape | The shape to copy from. |
Initializes this shape as an translated version of the input shape.
shape | The shape to copy from. |
offset | offset vector from the copied shape |
|
virtual |
Determine if the point is inside the shape based on the instance properties.
pt | The point to test. |
Implements Menge::Math::Geometry2D.
Reimplemented in Menge::BFSM::OBBCondition.
Determine if the point is inside a OBB, centered on the given position.
pt | The point to test. |
pos | The position of the circle. |
Implements Menge::Math::Geometry2D.
Construct an offset version of this shape.
pt | The offset value. |
void Menge::Math::OBBShape::set | ( | const Vector2 & | pivot, |
float | width, | ||
float | height, | ||
float | angle | ||
) |
Sets the extent of the OBB.
pivot | The pivot point of the OBB |
width | The width of the unrotated box (length along the x-axis). |
height | The width of the unrotated box (length along the x-axis). |
angle | The 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.
angle | The angle (in radians) the OBB is rotated around its pivot. |
|
inline |
Sets the size of the OBB.
The pivot point and angle remain unchanged.
size | The width and height of the box. |