Menge
Modular Pedestrian Simulation Framework for Research and Development
|
A simple portal definition. More...
#include <Portal.h>
Public Member Functions | |
Portal () | |
Default constructor. | |
Portal (float x0, float y0, float x1, float y1) | |
Constructor specifying portal geometry. More... | |
void | set (float x0, float y0, float x1, float y1) |
Sets the geometry of the portal. More... | |
void | set (const Vector2 &p0, const Vector2 &p1) |
Sets the geometry of the portal. More... | |
Vector2 | nearestPoint (const Vector2 &pos, float radius) |
Computes the neareset clearable point w.r.t. the portal. More... | |
Public Attributes | |
Vector2 | _p0 |
The first end point of the portal line segment. | |
Vector2 | _p1 |
The second end point of the portal line segment. | |
float | _mag |
The distance between endpoints (i.e., length of the portal). | |
Vector2 | _dir |
The direction from the first to the second end point of the portal. | |
A simple portal definition.
A portal is simply a line segment - a region through which agents can pass.
Menge::Portal::Portal | ( | float | x0, |
float | y0, | ||
float | x1, | ||
float | y1 | ||
) |
Constructor specifying portal geometry.
x0 | The x-position of the first end point. |
y0 | The y-position of the first end point. |
x1 | The x-position of the second end point. |
y1 | The y-position of the second end point. |
Computes the neareset clearable point w.r.t. the portal.
Given the position and radius of an agent, computes the best clearable goal point. Clearable means that the straight-line path between the agent's current position and that goal point does NOT intersect either end point of the goal.
This is important because we assume that the end points attach to obstacles and if the end point intersects the path, that means the preferred velocity is leading the agent into a collision with the obstacle.
pos | The position of the agent. |
radius | The radius of the agent. |
void Menge::Portal::set | ( | float | x0, |
float | y0, | ||
float | x1, | ||
float | y1 | ||
) |
Sets the geometry of the portal.
x0 | The x-position of the first end point. |
y0 | The y-position of the first end point. |
x1 | The x-position of the second end point. |
y1 | The y-position of the second end point. |
Sets the geometry of the portal.
p0 | The position of the first end point. |
p1 | The position of the second end point. |