Struct map_model::Perimeter [−][src]
pub struct Perimeter {
pub roads: Vec<RoadSideID>,
}
Expand description
A sequence of roads in order, beginning and ending at the same place. No “crossings” – tracing along this sequence should geometrically yield a simple polygon.
Fields
roads: Vec<RoadSideID>
Implementations
Starting at any lane, snap to the nearest side of that road, then begin tracing a single block, with no interior roads. This will fail if a map boundary is reached. The results are unusual when crossing the entrance to a tunnel or bridge.
This calculates all single block perimeters for the entire map. The resulting list does not cover roads near the map boundary.
Merges two perimeters using a road in common. Mutates the current perimeter. Panics if they don’t have that road in common. Doesn’t handle blocks that have multiple roads in common.
Find an arbitrary road that two perimeters have in common.
Consider the perimeters as a graph, with adjacency determined by sharing any road in common.
Partition adjacent perimeters, subject to the predicate. Each partition should produce a
single result with merge_all
.
Assign each perimeter one of num_colors
, such that no two adjacent perimeters share the
same color. May fail. The resulting colors are expressed as [0, num_colors)
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Perimeter
impl UnwindSafe for Perimeter
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self