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

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.
 

Detailed Description

A simple portal definition.

A portal is simply a line segment - a region through which agents can pass.

Constructor & Destructor Documentation

Menge::Portal::Portal ( float  x0,
float  y0,
float  x1,
float  y1 
)

Constructor specifying portal geometry.

Parameters
x0The x-position of the first end point.
y0The y-position of the first end point.
x1The x-position of the second end point.
y1The y-position of the second end point.

Member Function Documentation

Vector2 Menge::Portal::nearestPoint ( const Vector2 pos,
float  radius 
)

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.

Parameters
posThe position of the agent.
radiusThe radius of the agent.
Returns
The nearest clearable point.
void Menge::Portal::set ( float  x0,
float  y0,
float  x1,
float  y1 
)

Sets the geometry of the portal.

Parameters
x0The x-position of the first end point.
y0The y-position of the first end point.
x1The x-position of the second end point.
y1The y-position of the second end point.
void Menge::Portal::set ( const Vector2 p0,
const Vector2 p1 
)

Sets the geometry of the portal.

Parameters
p0The position of the first end point.
p1The position of the second end point.

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