Struct libreda_pnr::db::REdge[][src]

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

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.