pub struct RacingGatePlane3D { /* private fields */ }Expand description
A rectangular racing gate plane in 3-D.
The gate is defined by its center, a unit normal pointing in the race
direction, and an in-plane up axis. The right axis is derived as
normal x up. A point is inside the aperture when its in-plane offset along
right/up is within half_width/half_height respectively.
Implementations§
Source§impl RacingGatePlane3D
impl RacingGatePlane3D
Sourcepub fn new(
center: [f64; 3],
normal: [f64; 3],
up_hint: [f64; 3],
half_width: f64,
half_height: f64,
) -> RoboticsResult<Self>
pub fn new( center: [f64; 3], normal: [f64; 3], up_hint: [f64; 3], half_width: f64, half_height: f64, ) -> RoboticsResult<Self>
Build a gate from a center, race-direction normal, and up hint.
up_hint need not be perpendicular to the normal or unit length; it is
orthonormalized against the normal. The width axis is normal x up.
pub fn center(&self) -> [f64; 3]
pub fn normal(&self) -> [f64; 3]
pub fn half_width(&self) -> f64
pub fn half_height(&self) -> f64
Sourcepub fn signed_distance(&self, point: [f64; 3]) -> f64
pub fn signed_distance(&self, point: [f64; 3]) -> f64
Signed distance to the gate plane; positive is in front (race direction).
Sourcepub fn plane_offsets(&self, point: [f64; 3]) -> (f64, f64)
pub fn plane_offsets(&self, point: [f64; 3]) -> (f64, f64)
In-plane offsets (right, up) of a point relative to the gate center.
pub fn squared_distance(&self, point: [f64; 3]) -> f64
Sourcepub fn within_aperture(&self, point: [f64; 3], tolerance: f64) -> bool
pub fn within_aperture(&self, point: [f64; 3], tolerance: f64) -> bool
Whether a point projects inside the rectangular aperture (with tolerance).
Sourcepub fn crosses(&self, from: [f64; 3], to: [f64; 3], tolerance: f64) -> bool
pub fn crosses(&self, from: [f64; 3], to: [f64; 3], tolerance: f64) -> bool
Whether the segment from -> to passes through the gate aperture.
The segment must cross the plane from behind (negative side) to in front (non-negative side), and the plane-crossing point must lie inside the aperture.
Sourcepub fn aperture_margin(&self, point: [f64; 3]) -> f64
pub fn aperture_margin(&self, point: [f64; 3]) -> f64
Normalized aperture margin of a crossing point in [0, 1]: 1 at the gate center, 0 at the aperture edge. Used as a clearance metric.
Trait Implementations§
Source§impl Clone for RacingGatePlane3D
impl Clone for RacingGatePlane3D
Source§fn clone(&self) -> RacingGatePlane3D
fn clone(&self) -> RacingGatePlane3D
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 RacingGatePlane3D
impl Debug for RacingGatePlane3D
Source§impl PartialEq for RacingGatePlane3D
impl PartialEq for RacingGatePlane3D
Source§fn eq(&self, other: &RacingGatePlane3D) -> bool
fn eq(&self, other: &RacingGatePlane3D) -> bool
self and other values to be equal, and is used by ==.impl Copy for RacingGatePlane3D
impl StructuralPartialEq for RacingGatePlane3D
Auto Trait Implementations§
impl Freeze for RacingGatePlane3D
impl RefUnwindSafe for RacingGatePlane3D
impl Send for RacingGatePlane3D
impl Sync for RacingGatePlane3D
impl Unpin for RacingGatePlane3D
impl UnsafeUnpin for RacingGatePlane3D
impl UnwindSafe for RacingGatePlane3D
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 more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.