Menge Modular Pedestrian Simulation Framework for Research and Development
Menge::Math::OBBShape Class Reference

Oriented bounding box. More...

`#include <Geometry2D.h>`

Inheritance diagram for Menge::Math::OBBShape:

## 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
 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.

Parameters
 shape The 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
 shape The shape to copy from. offset offset 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
 pt The 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
 pt The point to test. pos The 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
 pt The 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
 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.

Parameters
 angle The 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
 size The width and height of the box.

The documentation for this class was generated from the following files:
• src/menge/MengeCore/Math/Geometry2D.h
• src/menge/MengeCore/Math/Geometry2D.cpp