Struct dumbmath::segment::Segment3f [] [src]

pub struct Segment3f {
    pub start: Vec3f,
    pub end: Vec3f,
}

Line segment between two points

Fields

start
end

Methods

impl Segment3f

fn new(start: Vec3f, end: Vec3f) -> Segment3f

Create a segment between two points

fn to_vec3f(self) -> Vec3f

Get vector from start to end (not normalized)

fn length(self) -> f32

Length of the line segment

fn reversed(self) -> Segment3f

Create a copy of self with endpoints reversed.

fn distance_to_parametric_delta(self, distance: f32) -> f32

Convert a distance in coordinate space to a distance in the line segment's parametric space. The sign of the input is kept.

fn distance_from_parametric_delta(self, delta: f32) -> f32

Convert a parametric delta to coordinate space. The sign of the input is kept.

fn point_from_parametric(self, t: f32) -> Vec3f

Linearly interpolate between the segment's endpoints by the factor t. When t is zero the result is self.start, and when t is one the result is self.end. The range of t is not clamped.

fn segment_from_parametric_range(self, r: Rangef) -> Segment3f

Treat the range's start and end as parametric coords. Use point_from_parametric to interpolate the range into a new segment. The output segment is not clamped.

fn project_segment_as_range(self, other: Segment3f) -> Rangef

Project another segment onto self. The result is a parametric range of self clamped to [0, 1].

fn point_distance_squared(self, point: Vec3f) -> f32

Return the squared distance from this segment to the input point.

Adapted from "Real-Time Collision Detection" by Christer Ericson, published by Morgan Kaufmann Publishers, Copyright 2005 Elsevier Inc

fn point_distance(self, point: Vec3f) -> f32

Return the distance from this segment to the input point.

fn closest_point_to_point(self, point: Vec3f) -> (f32, Vec3f)

Find the point on the segment closest to the input point. The return value contains both the parametric and actual location of the closest point.

Adapted from "Real-Time Collision Detection" by Christer Ericson, published by Morgan Kaufmann Publishers, Copyright 2005 Elsevier Inc

Trait Implementations

impl Add<Vec3f> for Segment3f

type Output = Segment3f

fn add(self, v: Vec3f) -> Self::Output

Derived Implementations

impl PartialEq for Segment3f

fn eq(&self, __arg_0: &Segment3f) -> bool

fn ne(&self, __arg_0: &Segment3f) -> bool

impl Debug for Segment3f

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Copy for Segment3f

impl Clone for Segment3f

fn clone(&self) -> Segment3f

fn clone_from(&mut self, source: &Self)