Struct libreda_pnr::db::Path[][src]

pub struct Path<T> {
    pub points: PointString<T>,
    pub width: T,
    pub path_type: PathEndType<T>,
}
Expand description

Path is essentially a chain of line segments but with a possibly a non-zero width. It can be thought of the shape resulting by a stroke of a thick pen along the line segments.

Fields

points: PointString<T>

The vertices of the path which define the sequence of line segments.

width: T

Width of the path.

path_type: PathEndType<T>

Type of the path endings.

Implementations

Get number of vertices defining the path.

Create new path by taking vertices from a type that implements Into<PointString<T>>.

Create a path with extended beginning and end.

Create a path with rounded beginning and end.

Translate the path by an offset vector.

Scale the path. Scaling center is the origin (0, 0).

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

Get the transformed version of this path by applying tf.

Compute approximate area occupied by the path. Simply computes length*width.

Examples
use iron_shapes::prelude::*;
let path = Path::new(&[(0, 0), (0, 2)], 1);
assert_eq!(path.area_approx::<f64>(), 2f64);

Convert the path into a polygon. The polygon can be self-intersecting.

Examples
use iron_shapes::prelude::*;
let path = Path::new(&[(0, 0), (10, 0), (10, 20)], 4);
let polygon = path.to_polygon_approx();
assert_eq!(polygon, SimplePolygon::from(&[(0., 2.), (0., -2.), (12., -2.), (12., 20.), (8., 20.), (8., 2.)]));

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

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

Compute the bounding box of this path. The returned bounding box is not necessarily the smallest bounding box.

TODO: Find a better approximation.

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

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.