pub struct Segment {
pub start: Vec3,
pub end: Vec3,
}Expand description
A line segment defined by start and end points.
Fields§
§start: Vec3§end: Vec3Implementations§
Source§impl Segment
impl Segment
Sourcepub fn direction(&self) -> Vec3
pub fn direction(&self) -> Vec3
Normalized direction from start to end.
Returns Vec3::X for degenerate (zero-length) segments.
Sourcepub fn closest_point(&self, point: Vec3) -> Vec3
pub fn closest_point(&self, point: Vec3) -> Vec3
Closest point on this segment to the given point.
Sourcepub fn distance_to_point(&self, point: Vec3) -> f32
pub fn distance_to_point(&self, point: Vec3) -> f32
Distance from a point to this segment.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Segment
impl<'de> Deserialize<'de> for Segment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Segment
impl StructuralPartialEq for Segment
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
impl UnwindSafe for Segment
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
Mutably borrows from an owned value. Read more