struct TrackIntervals {
intervals: SmallVec<[OccupiedInterval; 2]>,
}Expand description
The occupied cells of a single track, stored as a sorted list of disjoint intervals in OriginZero line coordinates. Gaps between intervals are unoccupied. Touching intervals with the same state are merged.
Fields§
§intervals: SmallVec<[OccupiedInterval; 2]>The sorted, disjoint list of occupied intervals within the track
Implementations§
Source§impl TrackIntervals
impl TrackIntervals
Sourcefn state_at(&self, coordinate: i16) -> CellOccupancyState
fn state_at(&self, coordinate: i16) -> CellOccupancyState
The occupancy state of the cell whose start line is at coordinate
Sourcefn paint(&mut self, range: Range<i16>, state: CellOccupancyState)
fn paint(&mut self, range: Range<i16>, state: CellOccupancyState)
Set the cells covered by range to state, overwriting the state of any already-occupied
cells within the range (matching the overwrite semantics of a dense matrix of cells)
Sourcefn collision_extent(&self, range: &Range<i16>, reversed: bool) -> Option<i16>
fn collision_extent(&self, range: &Range<i16>, reversed: bool) -> Option<i16>
Find the extent of the occupied interval which an auto-placement search along the track
would collide with last: the end of the last overlapping interval when searching forwards,
or the start of the first overlapping interval when searching backwards (reversed == true). Returns the extremal occupied cell of that interval (which may lie outside
range: every search position before the returned extent also collides with the
interval), or None if the range is entirely unoccupied.
Sourcefn first_of_state(&self, state: CellOccupancyState) -> Option<i16>
fn first_of_state(&self, state: CellOccupancyState) -> Option<i16>
The start line of the first (lowest coordinate) cell with the specified state, if any
Sourcefn last_of_state(&self, state: CellOccupancyState) -> Option<i16>
fn last_of_state(&self, state: CellOccupancyState) -> Option<i16>
The start line of the last (highest coordinate) cell with the specified state, if any
Trait Implementations§
Source§impl Clone for TrackIntervals
impl Clone for TrackIntervals
Source§fn clone(&self) -> TrackIntervals
fn clone(&self) -> TrackIntervals
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more