Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Path Class Reference

Three dimensional path in space. More...

#include <Simulation/path.h>

Inheritance diagram for Path:

Entity List of all members.

Public Types

enum  Error {
  INIT_ERROR, RESULT_PAST_PATH, RESULT_BEHIND_PATH, NOT_ON_PATH,
  PROTECTION_FAULT, INVALID_COORD
}
 Special Path Errors. More...

Public Member Functions

void Step (Point &in_pt, const double delta) const
 Step displaces in_pt delta distance along the path.
virtual void Jump (Point &in_pt, const double dist) const
 Jump displaces in_pt to a point on the path that is delta distance away in 3 space.
void Reduce (const double dist, LineContext *lc_array)
 Optimize the SAMPLE representation of the path.
virtual void Splice (const double begin, const double end)
 Clip path to subsection as per length coordinates.
virtual double Length (void) const
 the length of the path
virtual double Curvature (void) const
 measure of path's curvature; integration of the 2nd derivative
virtual LineContext * ClosestDistance (LineContext *lc_array) const
 find the distance to the obstacle closest to the path
virtual Intersection Collide (const double radius, LineContext *lc_array) const
 see if any obstacle is within a certain distance of the path
virtual double GetDistance (const Path &path, Point &ret1, Point &ret2) const
 determine the closest distance between two paths
void SetProtectedLength (const double len)
 protect the path range [0..len] from any mutations
virtual Point ProjectPoint (const Vector &p) const
 find point on path closest to p
virtual Point GetPoint (const Vector &p) const
 retrieve point on path
virtual Point GetPoint (const double d) const
 retrieve point on path
Point operator[] (const double s) const
 retrieve point on path
Point operator[] (const Vector &v) const
 retrieve point on path
virtual Vector Tangent (const Point &p) const
 retrieve tangent of a path point given 3D position
virtual Vector Tangent (const double d) const
 retrieve tangent of a path point given path coordinate
void AddSample (const Vector &pos)
 append a sample to the path; note that this connects pos to the current end of the path
Pathoperator+= (const Vector &v)
 operator version of AddSample
Pathoperator+= (const Path &app)
 much like AddSample, but adds an entire path at once
Path operator+ (const Path &app) const
 much like AddSample, but adds an entire path at once
virtual Path Subsection (const double begin, const double end) const
 similar to Splice, except does not modify parent path
void Render (const double color[]) const
 draw the path's samples with the desired color (RGBA)
void Render (void) const
 render the path's samples with the path's default color
virtual ConStruct ToConstruct () const
 archives the path in a ConStruct and outputs to a file
void SetColor (const Vector &color, double opacity)
 set the path's color
virtual Path Clone (void) const
 Explicitly copy data to new Path, instead of just getting a reference.
 Path ()
 constructs empty path
 Path (const Path &path)
 copy constructor
 Path (const ConStruct &con)
 constructs path from ConStruct data
virtual ~Path ()
 destructor

Static Public Member Functions

static Path Combine (const Path &p1, const Path &p2)
 appends the list of SAMPLES in p2 to the SAMPLES in p1

Static Public Attributes

static const double BEGIN = 0.
 specifies the beginning of the path in path coordinates
static const double END = -1.
 specifies the end of the path in path coordinates

Protected Attributes

double fixed_length
 prevents mutation of path from [0..fixed_length]
Samplessamples
 pointer to the path's data

Classes

class  Point
 an estimate of a sample on a path More...
struct  Samples
 all relevant path data; in a struct to make reference counting easier More...

Detailed Description

Three dimensional path in space.

Note:
The Path class AND its descendents are one dimensional manifolds in three space. Since paths have many different representations (implicit, spline, nonanalytical) all this class does is store SAMPLEs of the points along the true path. The class also maintains a path length coordinate for each SAMPLE. Linear interpolation is used to work with points between samples. Descendant classes can override members to use more appropriate interpolation.
As is typical in numerical computing, keep in mind that SAMPLEs and especially their corresponding path coordinate should be considered as estimates, not 100% accurate values.

For descendents of Path, the POINT ACQUISITION functions *should* guarantee that they will return an accurate estimate on the path. In the case of Path, it returns an interpolated point.

Path will throw two kinds of exceptions: regular Construct Errors and special Path Errors.


Member Enumeration Documentation

enum Path::Error
 

Special Path Errors.

Enumerator:
INIT_ERROR  problem initializing the path
RESULT_PAST_PATH  an operation (such as a Step) produced a result that would have a path length coordinate greater than the path length
RESULT_BEHIND_PATH  similar to the RESULT_PAST_PATH, except coordinate would be < 0
NOT_ON_PATH  input provided did not result in a point on the path
PROTECTION_FAULT  attempted to modify a part of the path that was set as "immutable"
INVALID_COORD  invalid path coordinate was used


Member Function Documentation

void Path::AddSample const Vector &  pos  ) 
 

append a sample to the path; note that this connects pos to the current end of the path

Parameters:
pos desired point to append

Path Path::Clone void   )  const [virtual]
 

Explicitly copy data to new Path, instead of just getting a reference.

Returns:
copy of the path

LineContext * Path::ClosestDistance LineContext *  lc_array  )  const [virtual]
 

find the distance to the obstacle closest to the path

Parameters:
lc_array LineContext for carrying out distance calculations
Returns:
description of distance result

Intersection Path::Collide const double  radius,
LineContext *  lc_array
const [virtual]
 

see if any obstacle is within a certain distance of the path

Parameters:
radius threshold distance from the path
lc_array LineContext for carrying out distance calculations
Returns:
structure describing Intersection

Path Path::Combine const Path p1,
const Path p2
[static]
 

appends the list of SAMPLES in p2 to the SAMPLES in p1

Note:
generates a new Path with the combination as its SAMPLE list please note that the resulting type is Path, so any specific parameterizations in p1 and p2 are lost in the resulting type

double Path::GetDistance const Path path,
Point ret1,
Point ret2
const [virtual]
 

determine the closest distance between two paths

Parameters:
path other path from which to determine distance
ret1 return value of closest point to path on this
ret2 return value of closest point to this on path
Returns:
magnitude of distance

Path::Point Path::GetPoint const double  d  )  const [virtual]
 

retrieve point on path

Parameters:
d desired path coordinate
Returns:
point on the path

Path::Point Path::GetPoint const Vector &  p  )  const [virtual]
 

retrieve point on path

Note:
TODO: write this note...
Parameters:
p 3D position of desired point
Returns:
point on the path

void Path::Jump Point in_pt,
const double  dist
const [virtual]
 

Jump displaces in_pt to a point on the path that is delta distance away in 3 space.

Note:
One way to consider jumping is to consider intersecting a sphere centered at in_pt with delta radius with the Path. Call the set of intersected points P. Jump will displace in_pt to the element in P whose length coordinate is the least greater than in_pt's.

Path Path::operator+ const Path app  )  const
 

much like AddSample, but adds an entire path at once

Parameters:
app desired path to append

Path & Path::operator+= const Path app  ) 
 

much like AddSample, but adds an entire path at once

Parameters:
app desired path to append

Path & Path::operator+= const Vector &  v  ) 
 

operator version of AddSample

Parameters:
v desired point to append

Path::Point Path::operator[] const Vector &  v  )  const
 

retrieve point on path

Parameters:
v 3D position of desired point
Returns:
point on the path

Path::Point Path::operator[] const double  s  )  const
 

retrieve point on path

Parameters:
s desired path coordinate
Returns:
point on the path

Path::Point Path::ProjectPoint const Vector &  p  )  const [virtual]
 

find point on path closest to p

Parameters:
p point to project onto this
Returns:
projected point

void Path::Reduce const double  dist,
LineContext *  lc_array
 

Optimize the SAMPLE representation of the path.

Note:
Reduce eliminates SAMPLEs while maintaining the overall shape of the path

void Path::Render const double  color[]  )  const
 

draw the path's samples with the desired color (RGBA)

Parameters:
color color with which to render

void Path::SetColor const Vector &  color,
double  opacity
 

set the path's color

Parameters:
color desired color coordinates
opacity how opaque the path is, 0 is clear, 1 is solid

void Path::SetProtectedLength const double  len  ) 
 

protect the path range [0..len] from any mutations

Parameters:
len the upper range coordinate to protect

void Path::Splice const double  begin,
const double  end
[virtual]
 

Clip path to subsection as per length coordinates.

Note:
if s1 > s2, then the sequence of points is reversed

void Path::Step Point in_pt,
const double  delta
const
 

Step displaces in_pt delta distance along the path.

Parameters:
in_pt the position from which to step
delta the magnitude of the step

Path Path::Subsection const double  begin,
const double  end
const [virtual]
 

similar to Splice, except does not modify parent path

Parameters:
begin the path coordinate defining the beginning of the new path
end the path coordinate definiing the end of the new path

Vector Path::Tangent const double  d  )  const [virtual]
 

retrieve tangent of a path point given path coordinate

Parameters:
d path coordinate at which to measure tangent
Returns:
tangent vector facing in the direction of increasing path coordinate

Vector Path::Tangent const Point p  )  const [virtual]
 

retrieve tangent of a path point given 3D position

Parameters:
p point at which to measure tangent
Returns:
tangent vector facing in the direction of increasing path coordinate

ConStruct Path::ToConstruct  )  const [virtual]
 

archives the path in a ConStruct and outputs to a file

Returns:
ConStruct representation of the path


The documentation for this class was generated from the following files:
Generated on Fri Jan 12 14:15:02 2007 for Construct by  doxygen 1.4.3-20050530