Trait flo_curves::Line
source · pub trait Line: Geo {
fn from_points(p1: Self::Point, p2: Self::Point) -> Self;
fn points(&self) -> (Self::Point, Self::Point);
fn point_at_pos(&self, t: f64) -> Self::Point { ... }
fn pos_for_point(&self, point: &Self::Point) -> f64 { ... }
}
Expand description
Represents a straight line
Required Methods
sourcefn from_points(p1: Self::Point, p2: Self::Point) -> Self
fn from_points(p1: Self::Point, p2: Self::Point) -> Self
Creates a new line from points
Provided Methods
sourcefn point_at_pos(&self, t: f64) -> Self::Point
fn point_at_pos(&self, t: f64) -> Self::Point
Given a value ‘t’ from 0 to 1, returns the point at that position along the line
sourcefn pos_for_point(&self, point: &Self::Point) -> f64
fn pos_for_point(&self, point: &Self::Point) -> f64
Given a point (assumed to be on the line), returns the ‘t’ value on the line
If the point is not on the line, this will return a t value where at least one of the components of the point matches with the point on the line.
Implementations on Foreign Types
sourceimpl<Point: Coordinate + Clone> Line for (Point, Point)
impl<Point: Coordinate + Clone> Line for (Point, Point)
Simplest line is just a tuple of two points