Add rewind function.
This commit is contained in:
parent
3db18cfa50
commit
2252e128bd
1 changed files with 12 additions and 6 deletions
|
@ -88,6 +88,7 @@ public:
|
|||
bool forward(double length);
|
||||
bool backward(double length);
|
||||
bool move(double length); //Move works in both directions
|
||||
void rewind();
|
||||
|
||||
state save_state() const;
|
||||
void restore_state(state s);
|
||||
|
@ -198,12 +199,7 @@ bool vertex_cache::next_subpath()
|
|||
current_subpath_++;
|
||||
}
|
||||
if (current_subpath_ == subpaths_.end()) return false;
|
||||
current_segment_ = current_subpath_->vector.begin();
|
||||
//All subpaths contain at least one segment
|
||||
current_position_ = current_segment_->pos;
|
||||
position_in_segment_ = 0;
|
||||
segment_starting_point_ = current_position_;
|
||||
angle_valid_ = false;
|
||||
rewind();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -276,6 +272,16 @@ bool vertex_cache::move(double length)
|
|||
return true;
|
||||
}
|
||||
|
||||
void vertex_cache::rewind()
|
||||
{
|
||||
current_segment_ = current_subpath_->vector.begin();
|
||||
//All subpaths contain at least one segment
|
||||
current_position_ = current_segment_->pos;
|
||||
position_in_segment_ = 0;
|
||||
segment_starting_point_ = current_position_;
|
||||
angle_valid_ = false;
|
||||
}
|
||||
|
||||
|
||||
vertex_cache::state vertex_cache::save_state() const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue