pub struct REdge<T> {
    pub start: T,
    pub end: T,
    pub offset: T,
    pub orientation: REdgeOrientation,
}
Expand description

An rectilinear edge (horizontal or vertical line segment) is represented by its starting point and end point.

Fields

start: T

Start-coordinate of the edge.

end: T

End-coordinate of the edge.

offset: T

Distance to to the origin (0, 0).

orientation: REdgeOrientation

Orientation: Either horizontal or vertical.

Implementations

Create a new rectilinear edge.

Parameters
  • start: Start-coordinate of the edge.
  • end: End-coordinate of the edge.
  • offset: Distance to to the origin (0, 0).
  • orientation: Orientation: Either horizontal or vertical.

Get the start point of the edge.

Get the end point of the edge.

Return the same edge but with the two points swapped.

Check if edge is degenerate. An edge is degenerate if start point and end point are equal.

Test if this edge is either horizontal or vertical.

Test if this edge is horizontal.

Test if this edge is vertical.

Get the length of the edge.

Create a new REdge from two arguments that implement Into<Point>. The two points must lie either on a vertical or horizontal line, otherwise None is returned.

Panics

Panics if the two points are not on the same horizontal or vertical line.

Create a new REdge from two arguments that implement Into<Point>. The two points must lie either on a vertical or horizontal line, otherwise None is returned.

Returns the vector from self.start() to self.end().

Get a vector of unit length pointing in the same direction as the edge. Returns None if the length of the edge is zero.

Tells on which side of the edge a point is.

Panics

Panics if the edge is degenerate.

Returns Side::Left if the point is on the left side, Side::Right if the point is on the right side or Side::Center if the point lies exactly on the line.

Test if point lies on the edge. Includes start and end points of edge.

Test if point lies on the line defined by the edge.

Test if two edges are parallel.

Test if two edges are collinear, i.e. are on the same line.

Test edges for coincidence. Two edges are coincident if they are oriented the same way and share more than one point (implies that they must be parallel).

Test if this edge is crossed by the line defined by the other edge.

Returns WithinBounds if start and end point of this edge lie on different sides of the line defined by the other edge or OnBounds if at least one of the points lies on the line.

Test if lines defined by the edges intersect. If the lines are collinear they are also considered intersecting.

Test if two edges intersect. If the edges coincide, they also intersect.

Calculate the distance from the point to the line given by the edge.

Distance will be positive if the point lies on the right side of the edge and negative if the point is on the left side.

Calculate the distance from the point to the line given by the edge.

Find the perpendicular projection of a point onto the line of the edge.

Compute the intersection of the two lines defined by the edges.

Compute the intersection between two edges.

Rotate the edge by a multiple of 90 degrees around (0, 0).

Trait Implementations

Return the bounding box of this geometry.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Get the start point of the edge.

Get the end point of the edge.

Numeric type used for expressing the end-point coordinates of the edge.

Numeric type used for expressing an intersection-point of two edges. Often this might be the same as Coord. Read more

Compute intersection of two edges.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Converts this type into the (usually inferred) input type.

Converts this type into the (usually inferred) input type.

Converts this type into the (usually inferred) input type.

Converts this type into the (usually inferred) input type.

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

This method tests for !=.

Type used to represent the end points of the segment.

Get the start (LOW) or end (HIGH) point of the segment.

Shortcut to get the ‘low’ end of the segment.

Shortcut to get the ‘high’ end of the segment.

Return the bounding box of this geometry if a bounding box is defined.

Output type of the cast. This is likely the same geometrical type just with other coordinate types. Read more

Try to cast to target data type. Read more

Cast to target data type. Read more

Try to convert an edge into a rectilinear edge. Returns none if the edge is not rectilinear.

The type returned in the event of a conversion error.

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.