pub struct PolygonScene {
pub world_bounds: WorldBounds,
pub obstacles: Vec<Polygon>,
}Expand description
Bounded free space with polygon obstacles and walkability predicates.
Public fields are the static scene snapshot: world rectangle plus obstacle
rings. Pathfinders and prepared maps treat geometry as immutable for a query.
Prefer Self::validate_static / Self::validate before trusting a hand-
built scene; constructors do not enforce invariants.
Fields§
§world_bounds: WorldBoundsAxis-aligned world rectangle that bounds free space.
obstacles: Vec<Polygon>Simple polygon obstacle rings; free space is the world rectangle minus their strict interiors.
Implementations§
Source§impl PolygonScene
impl PolygonScene
Sourcepub fn is_walkable(&self, point: Point2) -> bool
pub fn is_walkable(&self, point: Point2) -> bool
Point free-space test: in bounds and not strictly inside any obstacle.
Does not reject sealed world-boundary edges by itself; endpoint
validation (validate, validate_source, validate_goal) and
Self::segment_is_walkable apply the sealed-edge rule.
Sourcepub fn segment_is_walkable(&self, start: Point2, end: Point2) -> bool
pub fn segment_is_walkable(&self, start: Point2, end: Point2) -> bool
Whether the segment from start to end stays in free space.
Rejects either endpoint when non-traversable (including sealed boundary), then samples every obstacle-edge intersection parameter and each open sub-interval midpoint. Visibility graphs and TFS use this as the edge legality predicate; cost is always Euclidean length of accepted segments.
Sourcepub fn validate_static(&self) -> Result<(), PolygonValidationError>
pub fn validate_static(&self) -> Result<(), PolygonValidationError>
Validates world bounds, obstacle geometry, and pairwise obstacle disjointness.
§Errors
Returns a PolygonValidationError for invalid bounds, obstacle
geometry, or intersecting obstacles.
Sourcepub fn validate_source(
&self,
source: Point2,
) -> Result<(), PolygonValidationError>
pub fn validate_source( &self, source: Point2, ) -> Result<(), PolygonValidationError>
Validates static scene invariants and that source is traversable.
§Errors
Returns a PolygonValidationError when static geometry or the source
endpoint is invalid.
Sourcepub fn validate_goal(&self, goal: Point2) -> Result<(), PolygonValidationError>
pub fn validate_goal(&self, goal: Point2) -> Result<(), PolygonValidationError>
Validates static scene invariants and that goal is traversable.
§Errors
Returns a PolygonValidationError when static geometry or the goal
endpoint is invalid.
Sourcepub fn validate(
&self,
request: PolygonSearchRequest,
) -> Result<(), PolygonValidationError>
pub fn validate( &self, request: PolygonSearchRequest, ) -> Result<(), PolygonValidationError>
Validates static scene invariants and that both endpoints are traversable.
§Errors
Returns a PolygonValidationError when static geometry or either
endpoint is invalid.
Trait Implementations§
Source§impl Clone for PolygonScene
impl Clone for PolygonScene
Source§fn clone(&self) -> PolygonScene
fn clone(&self) -> PolygonScene
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more