logo
pub struct LineSegment<S> {
    pub from: Point<S>,
    pub to: Point<S>,
}
Expand description

A linear segment.

Fields

from: Point<S>to: Point<S>

Implementations

Sample the segment at t (expecting t between 0 and 1).

Sample the x coordinate of the segment at t (expecting t between 0 and 1).

Sample the y coordinate of the segment at t (expecting t between 0 and 1).

Returns an inverted version of this segment where the beginning and the end points are swapped.

Return the sub-segment inside a given range of t.

This is equivalent splitting at the range’s end points.

Split this curve into two sub-segments.

Return the segment before the split point.

Return the segment after the split point.

Return the smallest rectangle containing this segment.

Return the smallest rectangle containing this segment.

Returns the vector between this segment’s from and to points.

Returns the line containing this segment.

Computes the length of this segment.

Changes the segment’s length, moving destination point.

Applies the transform to this segment and returns the results.

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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Start of the curve.

End of the curve.

Sample the curve at t (expecting t between 0 and 1).

Sample x at t (expecting t between 0 and 1).

Sample y at t (expecting t between 0 and 1).

Sample the derivative at t (expecting t between 0 and 1).

Sample x derivative at t (expecting t between 0 and 1).

Sample y derivative at t (expecting t between 0 and 1).

Return the curve inside a given range of t. Read more

Split this curve into two sub-curves.

Return the curve before the split point.

Return the curve after the split point.

Swap the direction of the segment.

Compute the length of the segment using a flattened approximation.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.