Artificial Intelligence
Public Types | Public Member Functions | Private Attributes

OpenSteer::PolylineSegmentedPathwaySegmentRadii Class Reference

#include <PolylineSegmentedPathwaySegmentRadii.h>

Inheritance diagram for OpenSteer::PolylineSegmentedPathwaySegmentRadii:
OpenSteer::SegmentedPathway OpenSteer::Pathway

List of all members.

Public Types

typedef size_t size_type

Public Member Functions

 PolylineSegmentedPathwaySegmentRadii ()
 PolylineSegmentedPathwaySegmentRadii (size_type numOfPoints, Vec3 const points[], float const radii[], bool closedCycle)
 PolylineSegmentedPathwaySegmentRadii (PolylineSegmentedPathwaySegmentRadii const &other)
virtual ~PolylineSegmentedPathwaySegmentRadii ()
PolylineSegmentedPathwaySegmentRadiioperator= (PolylineSegmentedPathwaySegmentRadii other)
void swap (PolylineSegmentedPathwaySegmentRadii &other)
void movePoints (size_type startIndex, size_type numOfPoints, Vec3 const points[])
void setPathway (size_type numOfPoints, Vec3 const points[], float const radii[], bool closedCycle)
float segmentRadius (size_type segmentIndex) const
void setSegmentRadius (size_type segmentIndex, float r)
void setSegmentRadii (size_type startIndex, size_type numOfRadii, float const radii[])
virtual bool isValid () const
virtual Vec3 mapPointToPath (const Vec3 &point, Vec3 &tangent, float &outside) const
virtual Vec3 mapPathDistanceToPoint (float pathDistance) const
virtual float mapPointToPathDistance (const Vec3 &point) const
virtual bool isCyclic () const
virtual float length () const
virtual size_type pointCount () const
virtual Vec3 point (size_type pointIndex) const
virtual size_type segmentCount () const
virtual float segmentLength (size_type segmentIndex) const
virtual Vec3 segmentStart (size_type segmentIndex) const
virtual Vec3 segmentEnd (size_type segmentIndex) const
virtual float mapPointToSegmentDistance (size_type segmentIndex, Vec3 const &point) const
virtual Vec3 mapSegmentDistanceToPoint (size_type segmentIndex, float segmentDistance) const
virtual float mapSegmentDistanceToRadius (size_type segmentIndex, float distanceOnSegment) const
virtual Vec3 mapSegmentDistanceToTangent (size_type segmentIndex, float segmentDistance) const
virtual void mapDistanceToSegmentPointAndTangentAndRadius (size_type segmentIndex, float segmentDistance, Vec3 &pointOnPath, Vec3 &tangent, float &radius) const
virtual void mapPointToSegmentDistanceAndPointAndTangentAndRadius (size_type segmentIndex, Vec3 const &point, float &distance, Vec3 &pointOnPath, Vec3 &tangent, float &radius) const

Private Attributes

PolylineSegmentedPath path_
std::vector< float > segmentRadii_

Detailed Description

Segmented pathway build by polylines that associates every segment with its own radius.


Member Typedef Documentation


Constructor & Destructor Documentation

OpenSteer::PolylineSegmentedPathwaySegmentRadii::PolylineSegmentedPathwaySegmentRadii ( )
OpenSteer::PolylineSegmentedPathwaySegmentRadii::PolylineSegmentedPathwaySegmentRadii ( size_type  numOfPoints,
Vec3 const  points[],
float const  radii[],
bool  closedCycle 
)

Constructs a segmented pathway consisting of numOfPoints points associating every segment with its own radius radii.

If closedCycle is false radii must have numOfPoints - 1 elements, for every segment one. If closedCycle is true numOfPoints radii elements are needed.

There mustn't be two adjacent points that are equal. The first and last point mustn't be identical, too.

OpenSteer::PolylineSegmentedPathwaySegmentRadii::PolylineSegmentedPathwaySegmentRadii ( PolylineSegmentedPathwaySegmentRadii const &  other)
OpenSteer::PolylineSegmentedPathwaySegmentRadii::~PolylineSegmentedPathwaySegmentRadii ( ) [virtual]

Member Function Documentation

bool OpenSteer::PolylineSegmentedPathwaySegmentRadii::isCyclic ( ) const [virtual]

Returns true f the path is closed, otherwise false.

Implements OpenSteer::Pathway.

bool OpenSteer::PolylineSegmentedPathwaySegmentRadii::isValid ( ) const [virtual]

Returns true if the path is valid, false otherwise.

Implements OpenSteer::Pathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::length ( ) const [virtual]

Returns the length of the path.

Implements OpenSteer::Pathway.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapDistanceToSegmentPointAndTangentAndRadius ( size_type  segmentIndex,
float  segmentDistance,
Vec3 pointOnPath,
Vec3 tangent,
float &  radius 
) const [virtual]

Combines mapSegmentDistanceToPoint and mapSegmentDistanceToTangent and mapSegmentDistanceToRadius.

Implements OpenSteer::SegmentedPathway.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapPathDistanceToPoint ( float  pathDistance) const [virtual]

Given a distance along the path, convert it to a point on the path. If isValid is false the behavior is undefined.

Implements OpenSteer::Pathway.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapPointToPath ( const Vec3 point,
Vec3 tangent,
float &  outside 
) const [virtual]

Given an arbitrary point ("A"), returns the nearest point ("P") on this path center line. Also returns, via output arguments, the path tangent at P and a measure of how far A is outside the Pathway's "tube". Note that a negative distance indicates A is inside the Pathway.

If isValid is false the behavior is undefined.

Implements OpenSteer::Pathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapPointToPathDistance ( const Vec3 point) const [virtual]

Given an arbitrary point, convert it to a distance along the path. If isValid is false the behavior is undefined.

Implements OpenSteer::Pathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapPointToSegmentDistance ( size_type  segmentIndex,
Vec3 const &  point 
) const [virtual]

Maps point to the nearest point on the center line of segment segmentIndex and returns the distance from the segment start to this point.

Implements OpenSteer::SegmentedPathway.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapPointToSegmentDistanceAndPointAndTangentAndRadius ( size_type  segmentIndex,
Vec3 const &  point,
float &  distance,
Vec3 pointOnPath,
Vec3 tangent,
float &  radius 
) const [virtual]

Combines mapPointToSegmentDistance, mapSegmentDistanceToPoint, mapSegmentDistanceToRadius, and mapSegmentDistanceToTangent.

Implements OpenSteer::SegmentedPathway.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapSegmentDistanceToPoint ( size_type  segmentIndex,
float  segmentDistance 
) const [virtual]

Maps segmentDistance to the center line of segment segmentIndex and returns the reached point.

If segmentDistance is greater or smaller than the segment length is is clamped to 0.0f or segmentLength().

Implements OpenSteer::SegmentedPathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapSegmentDistanceToRadius ( size_type  segmentIndex,
float  distanceOnSegment 
) const [virtual]

Maps segmentDistance to the center line of segment segmentIndex and returns the radius at the reached point.

If segmentDistance is greater or smaller than the segment length is is clamped to 0.0f or segmentLength().

Implements OpenSteer::SegmentedPathway.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::mapSegmentDistanceToTangent ( size_type  segmentIndex,
float  segmentDistance 
) const [virtual]

Maps segmentDistance to the centerline of the segment segmentIndex and returns the tangent of the pathway at the reached point.

If segmentDistance is greater or smaller than the segment length is is clamped to 0.0f or segmentLength().

Implements OpenSteer::SegmentedPathway.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::movePoints ( size_type  startIndex,
size_type  numOfPoints,
Vec3 const  points[] 
)

Replaces numOfPoints points starting at startIndex.

In the resulting sequence of points there mustn't be two adjacent ones that are equal. The first and last point mustn't be identical, too.

If the first point is changed and the path is cyclic the duplication of the first point at the end of the sequence representing the path closing segment is updated automatically.

Parameters:
startIndexFirst point to be moved or replaced.
numOfPointsNumber of points to move or replace. numOfPoints + startIndex must be lesser or equal to pointCount.
pointsMoved points to replace the old ones.
OpenSteer::PolylineSegmentedPathwaySegmentRadii & OpenSteer::PolylineSegmentedPathwaySegmentRadii::operator= ( PolylineSegmentedPathwaySegmentRadii  other)
OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::point ( size_type  pointIndex) const [virtual]

Returns the point pointIndex.

If the path is cyclic also the last point that is the duplicated first one is accessible.

Implements OpenSteer::SegmentedPathway.

OpenSteer::SegmentedPathway::size_type OpenSteer::PolylineSegmentedPathwaySegmentRadii::pointCount ( ) const [virtual]

Returns the number of points defining the segments.

This also includes the duplicated first point if the path is cyclic.

Implements OpenSteer::SegmentedPathway.

OpenSteer::PolylineSegmentedPathwaySegmentRadii::size_type OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentCount ( ) const [virtual]

Returns the number of segments that build the pathway.

Implements OpenSteer::SegmentedPathway.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentEnd ( size_type  segmentIndex) const [virtual]

Returns the end point of segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentLength ( size_type  segmentIndex) const [virtual]

Returns the length of segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

float OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentRadius ( size_type  segmentIndex) const

Returns the radius of the segment segmentIndex.

OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySegmentRadii::segmentStart ( size_type  segmentIndex) const [virtual]

Returns the start point of the segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::setPathway ( size_type  numOfPoints,
Vec3 const  points[],
float const  radii[],
bool  closedCycle 
)

Replaces the pathway information completely.

If closedCycle is true then the pathway has numOfPoints segments and the first point is duplicated and added as the last point to represent the end point of the segment closing the pathway cycle. If closedCycle is false the pathway has numOfPoints - 1 segments.

If closedCycle is false radii must have numOfPoints - 1 elements, for every segment one. If closedCycle is true provide numOfPoints radii elements.

Parameters:
numOfPointsNumber of points defining the pathway.
pointsThe actual points.
radiiRadii of the segments.
closedCycletrue if the pathway is cyclic, false otherwise.
void OpenSteer::PolylineSegmentedPathwaySegmentRadii::setSegmentRadii ( size_type  startIndex,
size_type  numOfRadii,
float const  radii[] 
)

Replace numOfRadii segment radii starting with segment startIndex with the elements of radii.

startIndex + numOfRadii must be lesser or equal to segmentCount.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::setSegmentRadius ( size_type  segmentIndex,
float  r 
)

Sets the radius r of the segment segmentIndex.

void OpenSteer::PolylineSegmentedPathwaySegmentRadii::swap ( PolylineSegmentedPathwaySegmentRadii other)

Swaps the content with other.


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines