An Iterator that can take an arbitrary amount of steps through a track. More...
#include <trackiterator.h>
Public Types | |
typedef Real | difference_type |
When doing iterator math what is the type of math results. | |
typedef InterpolatorType::InterpolatableType | InterpolatableType |
The type the interpolator this works with uses. | |
typedef std::random_access_iterator_tag | iterator_category |
This almost supports random access iteration, it does not support any kind of writing to the container. | |
typedef InterpolatableType * | pointer |
The type of a pointer to the iterated type. | |
typedef InterpolatableType & | reference |
The type of a reference to the iterated type. | |
typedef TrackBase < InterpolatorType > | TargetTrackType |
What kind of track with this iterate over. | |
typedef SmoothTrackIterator < InterpolatorType > | ThisType |
The kind of this iterator. | |
typedef InterpolatableType | value_type |
What type is this iterator working with. | |
Public Member Functions | |
SmoothTrackIterator (const TargetTrackType *const TrackToIterate=0, Real WhereToStart=0.0, Real Increment=0.01) | |
The constructor for an iterator that can take an arbitrary amount steps through a series of data points. More... | |
SmoothTrackIterator (const ThisType &Copy) | |
Create a copy of an SmoothTrackIterator. More... | |
Integer | BoundsCheck () const |
Is the Iterator inside the track? More... | |
bool | BoundsCorrect () |
If this is iterator is beyond the bounds of the track it target wrap it around to the other side. More... | |
bool | operator!= (const ThisType &Other) const |
Is this SmoothTrackIterator not on the same track and in the same place as another. More... | |
virtual InterpolatableType | operator* () const |
Get the current location on the SmoothTrackIterator. More... | |
const ThisType | operator+ (Integer Steps) |
Move a copy of this iterator a multiple of steps relative to the amount added. More... | |
ThisType & | operator++ () |
Move the SmoothTrackIterator forwards on the track by on step. More... | |
const ThisType | operator++ (int) |
Move the SmoothTrackIterator forwards on the track and get a copy of its location before. More... | |
ThisType & | operator+= (Integer Steps) |
Move this iterator a given amount of steps forward. More... | |
const ThisType | operator- (Integer Steps) |
Move a copy this iterator a negativemultiple of steps relative to the amount subtract. More... | |
ThisType & | operator-- () |
Move the SmoothTrackIterator backwards on the track by on step. More... | |
const ThisType | operator-- (int) |
Move the SmoothTrackIterator backwards on the track and get a copy of its location before. More... | |
ThisType & | operator-= (Integer Steps) |
Move this iterator a given amount of steps backwards. More... | |
virtual CountedPtr < InterpolatableType > | operator-> () const |
Derefernce this with the syntax for pointer member access. More... | |
bool | operator< (const ThisType &Right) |
Compare which iterator is further along the track. More... | |
bool | operator<= (const ThisType &Right) |
Compare which iterator is further along the track. More... | |
SmoothTrackIterator < InterpolatorType > & | operator= (const ThisType &Other) |
Change this SmoothTrackIterator to match another (Except for Track) More... | |
bool | operator== (const ThisType &Other) const |
Is this SmoothTrackIterator on the same track and in the same place as another. More... | |
bool | operator> (const ThisType &Right) |
Compare which iterator is further toward the track beginning. More... | |
bool | operator>= (const ThisType &Right) |
Compare which iterator is further toward the track beginning. More... | |
const ThisType | operator[] (Integer Steps) |
Get an iterator an arbitrary number of steps forward or backwards. More... | |
Protected Member Functions | |
void | Decrement () |
Move the iterator in the opposite direction from the step. | |
void | Increment () |
Move the iterator in the direction of the step. | |
void | StepAdjust (Integer Steps) |
Move the iterator a multiple (including negative multiples) of the step. | |
Protected Attributes | |
Real | Location |
Where on the track are we? | |
Real | Step |
How far should this. | |
const TargetTrackType *const | TargetTrack |
The track this works against. | |
An Iterator that can take an arbitrary amount of steps through a track.
This stores a value between 0.0 and 1.0 as the current location on a track, and another value between 0.0 an 1.0 as how muc to move when incremented. Everytime this is dereferenced it makes a call against the track it targets and gets the point on the track that corresponds with is current location. For example, presume SomeTrack is a valid track instance:
This code will output 200 Vector3's lying on the path define by the track, which are each separated b approximately 0.5% ofthe tracks full length. If the track is small this could look pretty smooth
Definition at line 76 of file trackiterator.h.
|
inline |
The constructor for an iterator that can take an arbitrary amount steps through a series of data points.
If default constructed this cannot be dereferenced and is only useful for comparisons
TrackToIterate | Which track with this work against. |
WhereToStart | Where on the track (range 0 to 1) Should iteration start. |
Increment | When incremented how much should the location change? Defaults to .01 to create 100 steps. |
Definition at line 120 of file trackiterator.h.
|
inline |
Create a copy of an SmoothTrackIterator.
Copy | The SmoothTrackIterator to copy. |
Definition at line 125 of file trackiterator.h.
|
inline |
Is the Iterator inside the track?
Definition at line 211 of file trackiterator.h.
|
inline |
If this is iterator is beyond the bounds of the track it target wrap it around to the other side.
Since the location on the track is stored as a value between 0.0 and 1.0 as long asthe step is less than ,subtracting or adding one will preserve the apparent offset from the last location on looped tracks
Definition at line 224 of file trackiterator.h.
|
inline |
Is this SmoothTrackIterator not on the same track and in the same place as another.
Other | The Other SmoothTrackIterator to compare this one too. |
Definition at line 151 of file trackiterator.h.
|
inlinevirtual |
Get the current location on the SmoothTrackIterator.
Definition at line 158 of file trackiterator.h.
|
inline |
Move a copy of this iterator a multiple of steps relative to the amount added.
Definition at line 237 of file trackiterator.h.
|
inline |
Move the SmoothTrackIterator forwards on the track by on step.
The iterator is moved to a new position by adding the step from the current location.
Definition at line 192 of file trackiterator.h.
|
inline |
Move the SmoothTrackIterator forwards on the track and get a copy of its location before.
Like the prefix ++ this moves the iterator, but this returns a copy of the iterator before being incremented.
Definition at line 202 of file trackiterator.h.
|
inline |
Move this iterator a given amount of steps forward.
Definition at line 255 of file trackiterator.h.
|
inline |
Move a copy this iterator a negativemultiple of steps relative to the amount subtract.
Definition at line 246 of file trackiterator.h.
|
inline |
Move the SmoothTrackIterator backwards on the track by on step.
The iterator is moved to a new position by subtracting the step from the current location.
Definition at line 171 of file trackiterator.h.
|
inline |
Move the SmoothTrackIterator backwards on the track and get a copy of its location before.
Like the prefix – this moves the iterator, but this returns a copy of the iterator before being increment.
Definition at line 181 of file trackiterator.h.
|
inline |
Move this iterator a given amount of steps backwards.
Definition at line 262 of file trackiterator.h.
|
inlinevirtual |
Derefernce this with the syntax for pointer member access.
Definition at line 164 of file trackiterator.h.
|
inline |
Compare which iterator is further along the track.
Right | The value on the right of the <. |
Definition at line 272 of file trackiterator.h.
|
inline |
Compare which iterator is further along the track.
Right | The value on the right of the <=. |
Definition at line 284 of file trackiterator.h.
|
inline |
Change this SmoothTrackIterator to match another (Except for Track)
Other | The SmoothTrackIterator to copy, except for its target track |
Definition at line 132 of file trackiterator.h.
|
inline |
Is this SmoothTrackIterator on the same track and in the same place as another.
Other | The Other SmoothTrackIterator to compare this one too. |
Definition at line 142 of file trackiterator.h.
|
inline |
Compare which iterator is further toward the track beginning.
Right | The value on the right of the >. |
Definition at line 278 of file trackiterator.h.
|
inline |
Compare which iterator is further toward the track beginning.
Right | The value on the right of the >=. |
Definition at line 290 of file trackiterator.h.
|
inline |
Get an iterator an arbitrary number of steps forward or backwards.
Steps | How many times to increment or decrement the iterator. |
Definition at line 296 of file trackiterator.h.