pub struct Fence { /* private fields */ }Expand description
Geodesic polygon fence on WGS84.
Implementations§
Source§impl Fence
impl Fence
Sourcepub fn new<I>(vertices: I) -> Result<Self, GeofenceError>where
I: IntoIterator<Item = Wgs84Geodetic>,
pub fn new<I>(vertices: I) -> Result<Self, GeofenceError>where
I: IntoIterator<Item = Wgs84Geodetic>,
Construct a fence from WGS84 geodetic vertices.
The polygon edge between adjacent vertices is the shortest WGS84 geodesic. A closing vertex equal to the first vertex is accepted and removed. Height is ignored by containment and distance calculations.
Sourcepub fn vertices(&self) -> &[Wgs84Geodetic]
pub fn vertices(&self) -> &[Wgs84Geodetic]
Fence vertices in their open polygon form.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of polygon edges.
Sourcepub fn planar_fast_path_applies(&self, position: Wgs84Geodetic) -> bool
pub fn planar_fast_path_applies(&self, position: Wgs84Geodetic) -> bool
Returns true when the small-region planar path can evaluate this point.
Sourcepub fn contains(&self, position: Wgs84Geodetic) -> Result<bool, GeofenceError>
pub fn contains(&self, position: Wgs84Geodetic) -> Result<bool, GeofenceError>
Boolean containment using geodesic polygon edges.
Points within GEOFENCE_BOUNDARY_TOLERANCE_M of the boundary are
classified as contained.
Sourcepub fn distance_to_boundary(
&self,
position: Wgs84Geodetic,
) -> Result<f64, GeofenceError>
pub fn distance_to_boundary( &self, position: Wgs84Geodetic, ) -> Result<f64, GeofenceError>
Signed distance to the polygon boundary, in metres.
Positive values are inside, negative values are outside, and values near
zero are on the boundary under GEOFENCE_BOUNDARY_TOLERANCE_M.
Sourcepub fn distance_to_boundary_planar_fast(
&self,
position: Wgs84Geodetic,
) -> Result<Option<f64>, GeofenceError>
pub fn distance_to_boundary_planar_fast( &self, position: Wgs84Geodetic, ) -> Result<Option<f64>, GeofenceError>
Fast signed boundary distance for small regions, in metres.
Returns None when the fence or query point is outside
PLANAR_FAST_PATH_MAX_RADIUS_M. This is a local-plane approximation.
Use Self::distance_to_boundary when exact geodesic distance is
required.
Trait Implementations§
impl StructuralPartialEq for Fence
Auto Trait Implementations§
impl Freeze for Fence
impl RefUnwindSafe for Fence
impl Send for Fence
impl Sync for Fence
impl Unpin for Fence
impl UnsafeUnpin for Fence
impl UnwindSafe for Fence
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.