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 moreSource§impl Debug for PolygonScene
impl Debug for PolygonScene
Source§impl PartialEq for PolygonScene
impl PartialEq for PolygonScene
impl StructuralPartialEq for PolygonScene
Auto Trait Implementations§
impl Freeze for PolygonScene
impl RefUnwindSafe for PolygonScene
impl Send for PolygonScene
impl Sync for PolygonScene
impl Unpin for PolygonScene
impl UnsafeUnpin for PolygonScene
impl UnwindSafe for PolygonScene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more