#include <PathSegmentGenerator.hpp>
Public Member Functions | |
PathSegmentGenerator () | |
virtual | ~PathSegmentGenerator () |
double | ds () |
int | m () |
virtual bool | next ()=0 |
void | start (const SpatialGridPath *path) |
void | start (Position bfr, Direction bfk) |
Protected Types | |
enum class | State { Unknown , Inside , Outside } |
Protected Member Functions | |
Direction | k () |
double | kx () const |
double | ky () const |
double | kz () const |
bool | moveInside (const Box &box, double eps) |
void | propagater (double ds) |
void | propagaterx (double ds) |
void | propagatery (double ds) |
void | propagaterz (double ds) |
void | propagateToNextAfter () |
Position | r () |
double | rx () const |
double | ry () const |
double | rz () const |
void | setEmptySegment (double ds=0.) |
void | setrx (double rx) |
void | setry (double ry) |
void | setrz (double rz) |
void | setSegment (int m, double ds) |
void | setState (State state) |
State | state () const |
Private Attributes | |
double | _ds |
double | _kx |
double | _ky |
double | _kz |
int | _m |
double | _rx |
double | _ry |
double | _rz |
State | _state |
PathSegmentGenerator is the abstract base class for classes that calculate and return the segments of a path through a spatial grid segment by segment. This base class offers the public interface for obtaining the segments one by one after initializing the path with a given starting position and direction. A subclass must be provided for each type of spatial grid. Usually, this subclass is implemented as a private class inside the corresponding SpatialGrid subclass.
In addition to the public interface, the PathSegmentGenerator class also offers facilities for use by subclasses. These include functions to access the position and direction of the path, to set the cell index and path length for the next segment, and to help track the state of the generator.
|
strongprotected |
This enumeration lists the states that are passed through by most path segment generators. The start() function sets the state to Unknown.
|
inline |
The constructor creates a path segment generator initialized to an invalid path. To start path segment generation, call the start() function.
|
inlinevirtual |
The destructor does what it is expected to do.
|
inline |
This function returns the length of the current path segment inside the spatial cell crossed by the segment. The value is defined only after a call to the next() function returned true.
|
inlineprotected |
This function returns the path's direction. This value is initialized by the start() function and remains immutable during segment generation for the path.
|
inlineprotected |
This function returns the x component of the path's direction. This value is initialized by the start() function and remains immutable during segment generation for the path.
|
inlineprotected |
This function returns the y component of the path's direction. This value is initialized by the start() function and remains immutable during segment generation for the path.
|
inlineprotected |
This function returns the z component of the path's direction. This value is initialized by the start() function and remains immutable during segment generation for the path.
|
inline |
This function returns the index of the spatial cell crossed by the current path segment. The value is defined only after a call to the next() function returned true.
|
protected |
This function calculates the segment needed to advance the path along its direction from its current position to the closest position inside the specified box (a cuboid aligned with the coordinate axes).
If the path does not intersect the box, the function returns false. In that case, the state is set to Outside and no segment is available (the path position and segment values are undefined). If the original position is inside the box or the path does intersect the box, the function returns true. In that case, the state is set to Inside, the position is adjusted to be inside the box if necessary, the segment cell index is set to -1 indicating a segment outside of the box, and the segment length is set to the distance between the new and original positions. If the original position was inside the box, the segment length is set to zero.
|
pure virtual |
This function calculates the next path segment and stores its cell index and path length in data members that can be accessed through the m() and ds() functions. It should be called only after the path has been intialized through the start() function. The next() function returns true if a path segment is available and false if there are no more segments in the path. In the latter case, the values returned by the m() and ds() functions are undefined.
This function must be implemented by each subclass.
|
inlineprotected |
This function advances the path's position along the path's direction for the specified distance.
|
inlineprotected |
This function advances the x component of the path's position along the path's direction for the specified distance.
|
inlineprotected |
This function advances the y component of the path's position along the path's direction for the specified distance.
|
inlineprotected |
This function advances the z component of the path's position along the path's direction for the specified distance.
|
inlineprotected |
This function advances each component of the path's position to the next representable double-precision flaoting point number in the path's direction.
|
inlineprotected |
This function returns the path's position. This value is initialized by the start() function and can be updated from a subclass through various functions offered by this base class.
|
inlineprotected |
This function returns the x component of the path's position. This value is initialized by the start() function and can be updated from a subclass through various functions offered by this base class.
|
inlineprotected |
This function returns the y component of the path's position. This value is initialized by the start() function and can be updated from a subclass through various functions offered by this base class.
|
inlineprotected |
This function returns the y component of the path's position. This value is initialized by the start() function and can be updated from a subclass through various functions offered by this base class.
|
inlineprotected |
This function sets the information for the current path segment to a cell number of -1, indicating a path segment outside of the grid, and the specified segment length. If the argument is omitted, a length of zero is assumed.
|
inlineprotected |
This function sets the x component of the path's position to the specified value.
|
inlineprotected |
This function sets the y component of the path's position to the specified value.
|
inlineprotected |
This function sets the z component of the path's position to the specified value.
|
inlineprotected |
This function sets the information for the current path segment to the specified cell number and segment length.
|
inlineprotected |
This function sets the current state of the generator to the specified value.
|
inline |
This function initializes path segment generation for the starting position
This function initializes path segment generation for the specified starting position
|
inlineprotected |
This function returns the current state of the generator.