PositionPath Class Reference

A 6DOF position in 3D space that may vary over time. More...

#include <PositionPath.h>

List of all members.

Public Member Functions

 PositionPath ()
 ~PositionPath ()
Position GetPosition (int time)
void SetConstantPosition (float x, float y, float z, float roll, float pitch, float yaw)
bool IsDefined (int time)
bool HasDynamicRotation ()
bool HasStaticRotation ()
BoundingBox GetTranslationBox ()
void StartPath (int offset, float x, float y, float z, float roll, float pitch, float yaw)
void CompletePath (float x, float y, float z, float roll, float pitch, float yaw)
void AddCheckpoint (float x, float y, float z, float roll, float pitch, float yaw)
void SetDuration (int time)
void SetGlobalTransition (int mode, float parameter)
void SetTransitionModes (int mode_x, int mode_y, int mode_z, int mode_roll, int mode_pitch, int mode_yaw)
void SetParameters (float param_x, float param_y, float param_z, float param_roll, float param_pitch, float param_yaw)
void Shift (float x, float y, float z)
void PrintToConsole ()

Private Types

typedef PositionPath::PathNode Path

Private Member Functions

void SeekTime (int time)
void DeletePath ()
void Initialize ()
void ConservativeUpdate (PathNode *node)
Position EvaluateNode (PathNode *node, float progress)
float EvaluateValue (int mode, float value, float parameter)

Private Attributes

bool is_constant
bool has_dynamic_rotation
bool has_static_rotation
BoundingBox translation_box
Position constant_position
Pathfirst_node
bool not_complete
PathNodecurrent_node
PathNodenode_pointer

Classes

struct  PathNode


Detailed Description

A 6DOF position in 3D space that may vary over time.

A PositionPath is a 6DOF position in 3D space that may vary over time. Such a path is defined by checkpoints that are reached at specific points in time. For times that lie between two checkpoints, the positions of those checkpoints are interpolated. There are several modes of interpolation possible, either linearly PP_LINEAR, using a cosine (which means smooth start) PP_COSINE, using a sine (which means a smooth stop) or jumping directly from position one to position two PP_JUMP. Each value of the position (x, y, z, roll, pitch, yaw) may either be interpolated in the same way or independently of the other values (for example linearly interpolating between two x coordinates and using a cosine to interpolate between the pitch angles). Each interpolation may additionally have a parameter. While the parameter has no meaning for the linear interpolation, it specifies the number of oscillations when using a sine or cosine interpolation. When using the jumpy interpolation, it must lie between 0.0 and 1.0 and determines the time of the position jump as a the fraction of the timespan between the two checkpoints.

Furthermore, each PositionPath may contain several sequences of checkpoints. Between two such sequences, the object may not be defined if there is a gap between the end resp. start times of the two sequences.

Definition at line 56 of file PositionPath.h.


Member Typedef Documentation

typedef struct PositionPath::PathNode PositionPath::Path [private]
 

This structure holds the required path information.


Constructor & Destructor Documentation

PositionPath::PositionPath  ) 
 

Constructor: Initializes the class and sets it to the zero position {0, 0, 0, 0, 0, 0}

Definition at line 3 of file PositionPath.cpp.

PositionPath::~PositionPath  ) 
 

Destructor: Destroys the path.

Definition at line 8 of file PositionPath.cpp.


Member Function Documentation

void PositionPath::AddCheckpoint float  x,
float  y,
float  z,
float  roll,
float  pitch,
float  yaw
 

Used to construct a path. This routine adds a checkpoint to the current path. It may only be called between 'StartPath (...)' and 'CompletePath (...)'.

Parameters:
x x coordinate at the checkpoint.
y y coordinate at the checkpoint.
z z coordinate at the checkpoint.
roll roll angle at the checkpoint.
pitch pitch angle at the checkpoint.
yaw yaw angle at the checkpoint.

Definition at line 64 of file PositionPath.cpp.

void PositionPath::CompletePath float  x,
float  y,
float  z,
float  roll,
float  pitch,
float  yaw
 

Used to construct a path. This routine ends the current path. It may only be called if a path has already been started with 'StartPath (...)'.

Parameters:
x x coordinate at the end of the path.
y y coordinate at the end of the path.
z z coordinate at the end of the path.
roll roll angle at the end of the path.
pitch pitch angle at the end of the path.
yaw yaw angle at the end of the path.

Definition at line 170 of file PositionPath.cpp.

void PositionPath::ConservativeUpdate PathNode node  )  [private]
 

Updates the translation box in a conservative manner if a transition mode contains either a SINE or COSINE interpolation and its parameter is different from 0.0. This is necessary, because such an interpolation may result in values between -1 and 1 (instead of 0 and 1), which means that the translation box could be incorrect.

Parameters:
node The PathNode for which the translation box must be updated conservatively.

Definition at line 241 of file PositionPath.cpp.

void PositionPath::DeletePath  )  [private]
 

Destroys the path and frees its ressources.

Definition at line 299 of file PositionPath.cpp.

Position PositionPath::EvaluateNode PathNode node,
float  progress
[private]
 

Returns a position by interpolating between the start and end position of a certain node using its transition evaluator(s) and parameter(s).

Parameters:
node Specifies the node which shall be evaluated
progress Specifies the progress between the start and end position as a value that ranges from 0.0 to 1.0.
Returns:
The interpolated position between the start and end position.

Definition at line 423 of file PositionPath.cpp.

float PositionPath::EvaluateValue int  mode,
float  value,
float  parameter
[inline, private]
 

Applies an evaluator.

Parameters:
mode Specifies the mode of the interpolation (PP_LINEAR, PP_SINE, PP_COSINE or PP_JUMP).
value The value which shall be evaluated.
parameter Specifies the value of the parameter that belongs to the current evaluator.
Returns:
The value returned by applying the evaluator specified by 'mode' to the 'value' with the given 'parameter'.

Definition at line 462 of file PositionPath.cpp.

Position PositionPath::GetPosition int  time  ) 
 

Retrieves the position at any given time. The returned position is only valid if it is indeed defined at the requested time.

Parameters:
time Specifies the time which the position shall be retrieved at.
Returns:
Returns a 6-DOF position.

Definition at line 399 of file PositionPath.cpp.

BoundingBox PositionPath::GetTranslationBox  ) 
 

Retrieves a box which contains the minimal and maximal values for each axis that can be achieved over time. All points of the path lie within or on the boundary of this box.

Returns:
A axis aligned bouding box containing the minimal and maximal values for each axix that can be achieved over time.

Definition at line 203 of file PositionPath.cpp.

bool PositionPath::HasDynamicRotation  ) 
 

States if the position has changing rotation values.

Returns:
true if the position contains any changing rotation values over time, false otherwise.

Definition at line 502 of file PositionPath.cpp.

bool PositionPath::HasStaticRotation  ) 
 

States if the position contains any rotation (values different from 0.0, 0.0, 0.0 for roll, pitch and yaw).

Returns:
true if the position contains any rotation values different from {0.0 0.0, 0.0}, false, otherwise.

Definition at line 497 of file PositionPath.cpp.

void PositionPath::Initialize  )  [private]
 

Initializes the path.

Definition at line 13 of file PositionPath.cpp.

bool PositionPath::IsDefined int  time  ) 
 

States if a position is defined at any given time.

Parameters:
time Specifies the time at which the path is either defined or not.
Returns:
true, if the path is defined at the given time; false, if it is not.

Definition at line 477 of file PositionPath.cpp.

void PositionPath::PrintToConsole  ) 
 

Prints the path to the console.

Definition at line 507 of file PositionPath.cpp.

void PositionPath::SeekTime int  time  )  [private]
 

Sets the 'node_pointer' to the correct node of the path, such that it points to the node with the biggest starting time that is still smaller than the requested time. If the requested time is smaller than the starting time of the first node, 'node_pointer' is set to 'NULL'.

Parameters:
time Specifies the time which the actual node shall be sought for.

Definition at line 362 of file PositionPath.cpp.

void PositionPath::SetConstantPosition float  x,
float  y,
float  z,
float  roll,
float  pitch,
float  yaw
 

Sets the position to constant values, which are always defined.

Parameters:
x Value of the x coordinate of the constant position.
y Value of the y coordinate of the constant position.
z Value of the z coordinate of the constant position.
roll Value of the roll angle of the constant position.
pitch Value of the pitch angle of the constant position.
yaw Value of the yaw angle of the constant position.

Definition at line 38 of file PositionPath.cpp.

void PositionPath::SetDuration int  time  ) 
 

Used to construct a path. This routine sets the duration between two points along the path. It may only be called between 'StartPath (...)' and 'CompletePath (...)'.

Parameters:
time time which shall elapse between two points along the path.

Definition at line 317 of file PositionPath.cpp.

void PositionPath::SetGlobalTransition int  mode,
float  parameter
 

Used to construct a path. Specifies the interpolation between two points of the path. All 6 values of the position are interpolated using the same method.

Parameters:
mode Sets the mode of interpolation. Available choices are: PP_LINEAR, PP_SINE, PP_COSINE or PP_JUMP.
parameter Sets the parameter for the interpolation. Its meaning differs depending on the mode (see class description for more information).

Definition at line 325 of file PositionPath.cpp.

void PositionPath::SetParameters float  param_x,
float  param_y,
float  param_z,
float  param_roll,
float  param_pitch,
float  param_yaw
 

Used to construct a path. Specifies the parameters for the interpolation between two points of the path. There is one parameter for each of the 6 values of the position. The meanings of the parameters differ depending on the chosen interpolation modes.

Parameters:
param_x Parameter used for the interpolation of the x coordinate.
param_y Parameter used for the interpolation of the y coordinate.
param_z Parameter used for the interpolation of the z coordinate.
param_roll Parameter used for the interpolation of the roll angle.
param_pitch Parameter used for the interpolation of the pitch angle.
param_yaw Parameter used for the interpolation of the yaw angle.

Definition at line 349 of file PositionPath.cpp.

void PositionPath::SetTransitionModes int  mode_x,
int  mode_y,
int  mode_z,
int  mode_roll,
int  mode_pitch,
int  mode_yaw
 

Used to construct a path. Specifies the interpolation between two points of the path. All 6 values of the position are interpolated independently. Each parameter of this routine can be one of the following: PP_LINEAR, PP_SINE, PP_COSINE or PP_JUMP.

Parameters:
mode_x Sets the interpolation mode for the x coordinate.
mode_y Sets the interpolation mode for the y coordinate.
mode_z Sets the interpolation mode for the z coordinate.
mode_roll Sets the interpolation mode for the roll angle.
mode_pitch Sets the interpolation mode for the pitch angle.
mode_yaw Sets the interpolation mode for the yaw angle.

Definition at line 335 of file PositionPath.cpp.

void PositionPath::Shift float  x,
float  y,
float  z
 

Shifts the whole path by a certain distance

Parameters:
x Amount to shift along the x axis
y Amount to shift along the y axis
z Amount to shift along the z axis

Definition at line 208 of file PositionPath.cpp.

void PositionPath::StartPath int  offset,
float  x,
float  y,
float  z,
float  roll,
float  pitch,
float  yaw
 

Used to construct a path. This routine starts a new path. It may only be called as the first element of the path or if already existing elements have been completed by calling 'CompletePath (...)'.

Parameters:
offset The path will start 'offset' milliseconds after the last part of the path.
x x coordinate at the beginning of the path.
y y coordinate at the beginning of the path.
z z coordinate at the beginning of the path.
roll roll angle at the beginning of the path.
pitch pitch angle at the beginning of the path.
yaw yaw angle at the beginning of the path.

Definition at line 110 of file PositionPath.cpp.


Member Data Documentation

Position PositionPath::constant_position [private]
 

Constant position, only valid if this 'is_constant' equals 'true'.

Definition at line 238 of file PositionPath.h.

PathNode* PositionPath::current_node [private]
 

internal member for the path construction, points to the current node.

Definition at line 262 of file PositionPath.h.

Path* PositionPath::first_node [private]
 

First node of the path.

Definition at line 256 of file PositionPath.h.

bool PositionPath::has_dynamic_rotation [private]
 

States if the path contains changing rotation values over time.

Definition at line 229 of file PositionPath.h.

bool PositionPath::has_static_rotation [private]
 

States if the path contains rotation values different from {0, 0 ,0}.

Definition at line 232 of file PositionPath.h.

bool PositionPath::is_constant [private]
 

States if the path contains only constant values which are always defined.

Definition at line 226 of file PositionPath.h.

PathNode* PositionPath::node_pointer [private]
 

internal member for the path access, points to the node which has been accessed most lately.

Definition at line 265 of file PositionPath.h.

bool PositionPath::not_complete [private]
 

internal member for the path construction, states if the path is complete or not.

Definition at line 259 of file PositionPath.h.

BoundingBox PositionPath::translation_box [private]
 

A box defining the minimal and maximal positions achieved over time for each axis.

Definition at line 235 of file PositionPath.h.


Generated on Sun Jul 2 13:20:41 2006 for Demo by  doxygen 1.4.6-NO