Artificial Intelligence
Public Types | Public Member Functions | Private Attributes

OpenSteer::PolylineSegmentedPathwaySingleRadius Class Reference

#include <PolylineSegmentedPathwaySingleRadius.h>

Inheritance diagram for OpenSteer::PolylineSegmentedPathwaySingleRadius:
OpenSteer::SegmentedPathway OpenSteer::Pathway

List of all members.

Public Types

typedef size_t size_type

Public Member Functions

 PolylineSegmentedPathwaySingleRadius ()
 PolylineSegmentedPathwaySingleRadius (float r)
 PolylineSegmentedPathwaySingleRadius (size_type numOfPoints, Vec3 const points[], float r, bool closeCycle)
 PolylineSegmentedPathwaySingleRadius (PolylineSegmentedPathwaySingleRadius const &other)
virtual ~PolylineSegmentedPathwaySingleRadius ()
PolylineSegmentedPathwaySingleRadiusoperator= (PolylineSegmentedPathwaySingleRadius other)
void swap (PolylineSegmentedPathwaySingleRadius &other)
void movePoints (size_type startIndex, size_type numOfPoints, Vec3 const newPointValues[])
void setPathway (size_type numOfPoints, Vec3 const points[], float r, bool closedCycle)
void setRadius (float r)
float radius () const
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_
float radius_

Detailed Description

Segmented pathway build by polylines with a single radius for the whole pathway.


Member Typedef Documentation


Constructor & Destructor Documentation

OpenSteer::PolylineSegmentedPathwaySingleRadius::PolylineSegmentedPathwaySingleRadius ( )

OpenSteer -- Steering Behaviors for Autonomous Characters

Copyright (c) 2002-2005, Sony Computer Entertainment America Original author: Craig Reynolds <craig_reynolds@playstation.sony.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author:
Bjoern Knafla <bknafla@uni-kassel.de>
OpenSteer::PolylineSegmentedPathwaySingleRadius::PolylineSegmentedPathwaySingleRadius ( float  r) [explicit]
OpenSteer::PolylineSegmentedPathwaySingleRadius::PolylineSegmentedPathwaySingleRadius ( size_type  numOfPoints,
Vec3 const  points[],
float  r,
bool  closeCycle 
)
OpenSteer::PolylineSegmentedPathwaySingleRadius::PolylineSegmentedPathwaySingleRadius ( PolylineSegmentedPathwaySingleRadius const &  other)
OpenSteer::PolylineSegmentedPathwaySingleRadius::~PolylineSegmentedPathwaySingleRadius ( ) [virtual]

Member Function Documentation

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

Returns true f the path is closed, otherwise false.

Implements OpenSteer::Pathway.

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

Returns true if the path is valid, false otherwise.

Implements OpenSteer::Pathway.

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

Returns the length of the path.

Implements OpenSteer::Pathway.

void OpenSteer::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::movePoints ( size_type  startIndex,
size_type  numOfPoints,
Vec3 const  newPointValues[] 
)

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.
newPointValuesMoved points to replace the old ones.
OpenSteer::PolylineSegmentedPathwaySingleRadius & OpenSteer::PolylineSegmentedPathwaySingleRadius::operator= ( PolylineSegmentedPathwaySingleRadius  other)
OpenSteer::Vec3 OpenSteer::PolylineSegmentedPathwaySingleRadius::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::PolylineSegmentedPathwaySingleRadius::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.

float OpenSteer::PolylineSegmentedPathwaySingleRadius::radius ( void  ) const

Returns the pathway radius.

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

Returns the number of segments that build the pathway.

Implements OpenSteer::SegmentedPathway.

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

Returns the end point of segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

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

Returns the length of segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

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

Returns the start point of the segment segmentIndex.

Implements OpenSteer::SegmentedPathway.

void OpenSteer::PolylineSegmentedPathwaySingleRadius::setPathway ( size_type  numOfPoints,
Vec3 const  points[],
float  r,
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.

Parameters:
numOfPointsNumber of points defining the pathway.
pointsThe actual points.
rRadius of the whole pathway.
closedCycletrue if the pathway is cyclic, false otherwise.
void OpenSteer::PolylineSegmentedPathwaySingleRadius::setRadius ( float  r)

Sets the radius of the whole pathway to r.

void OpenSteer::PolylineSegmentedPathwaySingleRadius::swap ( PolylineSegmentedPathwaySingleRadius 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