Struct geom::Line

source · []
pub struct Line(Pt2D, Pt2D);
Expand description

A line segment.

Tuple Fields

0: Pt2D1: Pt2D

Implementations

Creates a line segment between two points, which must not be the same

Equivalent to Line::new(pt1, pt2).unwrap(). Use this to effectively document an assertion at the call-site.

Returns an infinite line passing through this line’s two points.

Returns the first point in this line segment.

Returns the second point in this line segment.

Returns the two points in this line segment.

Returns a polyline containing these two points.

Returns a thick line segment.

Length of the line segment

If two line segments intersect – including endpoints – return the point where they hit. Undefined if the two lines have more than one intersection point!

Determine if two line segments intersect, but more so than just two endpoints touching.

If the line segment intersects with an infinite line – including endpoints – return the point where they hit. Undefined if the segment and infinite line intersect at more than one point!

Perpendicularly shifts the line over to the right. Width must be non-negative.

Perpendicularly shifts the line over to the left. Width must be non-negative.

Perpendicularly shifts the line to the right if positive or left if negative.

Returns a reversed line segment

The angle of the line segment, from the first to the second point

Returns a point along the line segment, unless the distance exceeds the segment’s length.

Equivalent to self.dist_along(dist).unwrap(). Use this to document an assertion at the call-site.

Returns a subset of this line, with two percentages along the line’s length.

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

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. 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.