Struct lyon_geom::LineSegment
[−]
[src]
pub struct LineSegment<S> { pub from: Point<S>, pub to: Point<S>, }
A linear segment.
Fields
from: Point<S>
to: Point<S>
Methods
impl<S: Scalar> LineSegment<S>
[src]
fn sample(&self, t: S) -> Point<S>
[src]
Sample the segment at t (expecting t between 0 and 1).
fn x(&self, t: S) -> S
[src]
Sample the x coordinate of the segment at t (expecting t between 0 and 1).
fn y(&self, t: S) -> S
[src]
Sample the y coordinate of the segment at t (expecting t between 0 and 1).
fn from(&self) -> Point<S>
[src]
fn to(&self) -> Point<S>
[src]
fn solve_t_for_x(&self, x: S) -> S
[src]
fn solve_t_for_y(&self, y: S) -> S
[src]
fn solve_y_for_x(&self, x: S) -> S
[src]
fn solve_x_for_y(&self, y: S) -> S
[src]
fn flip(&self) -> Self
[src]
Returns an inverted version of this segment where the beginning and the end points are swapped.
fn split_range(&self, t_range: Range<S>) -> Self
[src]
Return the sub-segment inside a given range of t.
This is equivalent splitting at the range's end points.
fn split(&self, t: S) -> (Self, Self)
[src]
Split this curve into two sub-segments.
fn before_split(&self, t: S) -> Self
[src]
Return the segment before the split point.
fn after_split(&self, t: S) -> Self
[src]
Return the segment after the split point.
fn split_at_x(&self, x: S) -> (Self, Self)
[src]
fn bounding_rect(&self) -> Rect<S>
[src]
Return the minimum bounding rectangle
fn to_vector(&self) -> Vector<S>
[src]
Returns the vector between this segment's from
and to
points.
fn to_line(&self) -> Line<S>
[src]
Returns the line containing this segment.
fn length(&self) -> S
[src]
Computes the length of this segment.
fn translate(&mut self, by: Vector<S>) -> Self
[src]
fn transform(&self, transform: &Transform2D<S>) -> Self
[src]
Applies the transform to this segment and returns the results.
fn intersection_t(&self, other: &Self) -> Option<(S, S)>
[src]
Computes the intersection (if any) between this segment and another one.
The result is provided in the form of the t
parameter of each
segment. To get the intersection point, sample one of the segments
at the corresponding value.
fn intersection(&self, other: &Self) -> Option<Point<S>>
[src]
fn intersects(&self, other: &Self) -> bool
[src]
Trait Implementations
impl<S: Copy> Copy for LineSegment<S>
[src]
impl<S: Clone> Clone for LineSegment<S>
[src]
fn clone(&self) -> LineSegment<S>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Debug> Debug for LineSegment<S>
[src]
impl<S: PartialEq> PartialEq for LineSegment<S>
[src]
fn eq(&self, __arg_0: &LineSegment<S>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &LineSegment<S>) -> bool
[src]
This method tests for !=
.
impl<S: Scalar> Segment for LineSegment<S>
[src]
type Scalar = S
fn from(&self) -> Point<S>
[src]
Start of the curve.
fn to(&self) -> Point<S>
[src]
End of the curve.
fn sample(&self, t: S) -> Point<S>
[src]
Sample the curve at t (expecting t between 0 and 1).
fn x(&self, t: S) -> S
[src]
Sample x at t (expecting t between 0 and 1).
fn y(&self, t: S) -> S
[src]
Sample y at t (expecting t between 0 and 1).
fn derivative(&self, _t: S) -> Vector<S>
[src]
Sample the derivative at t (expecting t between 0 and 1).
fn dx(&self, _t: S) -> S
[src]
Sample x derivative at t (expecting t between 0 and 1).
fn dy(&self, _t: S) -> S
[src]
Sample y derivative at t (expecting t between 0 and 1).
fn split_range(&self, t_range: Range<S>) -> Self
[src]
Return the curve inside a given range of t. Read more
fn split(&self, t: S) -> (Self, Self)
[src]
Split this curve into two sub-curves.
fn before_split(&self, t: S) -> Self
[src]
Return the curve before the split point.
fn after_split(&self, t: S) -> Self
[src]
Return the curve after the split point.
fn flip(&self) -> Self
[src]
Swap the direction of the segment.
fn approximate_length(&self, _tolerance: S) -> S
[src]
Compute the length of the segment using a flattened approximation.
impl<S: Scalar> FlatteningStep for LineSegment<S>
[src]
fn flattening_step(&self, _tolerance: S) -> S
[src]
Find the interval of the begining of the curve that can be approximated with a line segment. Read more
fn flattened(self, tolerance: Self::Scalar) -> Flattened<Self::Scalar, Self>
[src]
Returns the flattened representation of the curve as an iterator, starting after the current point. Read more