Menge
Modular Pedestrian Simulation Framework for Research and Development
|
An oriented bounding box goal region with uniform probability. More...
#include <GoalOBB.h>
Public Member Functions | |
OBBGoal () | |
Default constructor. | |
virtual float | squaredDistance (const Vector2 &pt) const |
Reports the squared distance from the given point to the goal. More... | |
virtual void | setDirections (const Vector2 &q, float r, Agents::PrefVelocity &directions) const |
Set the preferred velocity directions w.r.t. the goal: left, right, and preferred. More... | |
virtual Vector2 | getTargetPoint (const Vector2 &q, float r) const |
Returns the closest "target" point in the goal to the given query point. More... | |
virtual Vector2 | getCentroid () const |
Return the centroid of the goal. | |
void | setPivot (float x, float y) |
Set the OBB's pivot point. More... | |
void | setPivot (const Vector2 &p) |
Set the OBB's pivot point. More... | |
void | setSize (float w, float h) |
Set the AABB's size. More... | |
void | setSize (const Vector2 &size) |
Set the AABB's size. More... | |
void | setRotation (float angle) |
Set the OBB's rotation angle (in radians). More... | |
Public Member Functions inherited from Menge::BFSM::Goal | |
Goal () | |
Basic constructor. | |
bool | hasCapacity () const |
Reports if the goal still has capacity. More... | |
void | assign (const Agents::BaseAgent *agent) |
Inform the goal that it has been assigned. More... | |
void | free () |
Inform the goal that an assignment has been removed. | |
void | setGoalSet (GoalSet *goalSet) |
Sets this goal's goal set. More... | |
GoalSet * | getGoalSet () |
Returns a pointer to this agent's goal set. More... | |
const GoalSet * | getGoalSet () const |
Returns a const pointer to this agent's goal set. More... | |
void | setWeight (float weight) |
Sets the goal's weight. More... | |
float | getWeight () const |
Retrieves the goal's weight. More... | |
void | setCapacity (size_t capacity) |
Sets the goal's capacity. More... | |
size_t | getCapacity () const |
Returns this goal's capacity. More... | |
void | setID (size_t id) |
Sets the id of the goal. More... | |
size_t | getID () const |
Gets the id of the goal. More... | |
virtual void | drawGL () const |
Draws the goal into an OpenGL context. | |
Public Member Functions inherited from Menge::Element | |
void | destroy () |
This supplants the destructor. More... | |
virtual BFSM::Task * | getTask () |
Return an optional task associated with this element. More... | |
virtual SceneGraph::GLNode * | getSGNode () |
Returns an optional visualization element associated with the element. More... | |
Protected Member Functions | |
virtual void | drawGLGeometry () const |
Draws the goal geometry. | |
Protected Member Functions inherited from Menge::BFSM::Goal | |
virtual | ~Goal () |
Destructor. | |
Protected Attributes | |
Vector2 | _pivot |
The minimum point in the box region. | |
Vector2 | _size |
The size of the box region beyond the minimum point. | |
Vector2 | _rot0 |
The first column of the rotation matrix A point, p, can be rotated to the box's orientation as: Vector( p * _rot0, p * _rot1 );. | |
Vector2 | _rot1 |
The second column of the rotation matrix A point, p, can be rotated to the box's orientation as: Vector( p * _rot0, p * _rot1 );. | |
Protected Attributes inherited from Menge::BFSM::Goal | |
float | _weight |
The relative weight of this goal. | |
size_t | _capacity |
The maximum capacity of this goal. | |
size_t | _id |
The id of this goal in its goal set. | |
GoalSet * | _goalSet |
The goal set to which this goal belongs. | |
size_t | _population |
The current "population" of this goal. More... | |
ReadersWriterLock | _lock |
The lock to maintain readers-writer access to the structure which control available goals. | |
Additional Inherited Members | |
Static Public Attributes inherited from Menge::BFSM::Goal | |
static const size_t | MAX_CAPACITY = -1 |
The maximum capacity any goal can hold. | |
An oriented bounding box goal region with uniform probability.
The oriented bounding box (OBB) is defined by a pivot point, a size, and an orientation. An OBB with no rotation is the same as an AABB whose minimum point is the pivot point and which extends along the x-axis and the y-axis the given width and height, respectively. Positive angle causes counter-clockwise rotation.
Returns the closest "target" point in the goal to the given query point.
A "valid" target point is the nearest point to the query point that is sufficiently inside the goal region that a disk with the given radius is completely inside the goal. It need not be literally the best value, an approximation is sufficient.
In the case where the goal region is too small to hold the agent, then the "deepest" point in the region is a good approximation.
q | The query point. |
r | The radius of clearance. |
Implements Menge::BFSM::Goal.
|
virtual |
Set the preferred velocity directions w.r.t. the goal: left, right, and preferred.
The Agents::PrefVelocity class represents a span of velocities that will reach the goal. For a goal that covers a 2D region, the directions in the Agents::PrefVelocity should span the arc subtended by the goal from the query point's perspective. Furthermore, it should have sufficient clearance for a disk with the given radius to pass through. This should be overridden by subclasses to account for their unique geometry.
q | The query point. |
r | The radius of clearance. |
directions | An instance of Agents::PrefVelocity. |
Implements Menge::BFSM::Goal.
|
inline |
Set the OBB's pivot point.
x | The x-value of the OBB's pivot point. |
y | The y-value of the OBB's pivot point. |
|
inline |
Set the OBB's pivot point.
p | The position of the OBB's pivot point. |
void Menge::BFSM::OBBGoal::setRotation | ( | float | angle | ) |
Set the OBB's rotation angle (in radians).
angle | The angle of rotation (in radians). |
|
inline |
Set the AABB's size.
w | The width (extent along the x-axis) of the AABB. |
h | The height (extent along the y-axis) of the AABB. |
|
inline |
Set the AABB's size.
size | The size of the AABB (width, height). |
|
virtual |
Reports the squared distance from the given point to the goal.
pt | The query point. |
Implements Menge::BFSM::Goal.