Struct libreda_pnr::db::PointString[][src]

pub struct PointString<T> {
    pub points: Vec<Point<T>, Global>,
}
Expand description

A point string is a finite sequence of points. TODO: Implement Deref for accessing the list of points.

Fields

points: Vec<Point<T>, Global>

The points defining this point string.

Implementations

Get the number of vertices.

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

Shortcut for self.points.iter().

Get the sequence of edges of the point string starting from the first point to the last.

Examples
use iron_shapes::point_string::PointString;
use iron_shapes::edge::Edge;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

let edges: Vec<_> = point_string.edges().collect();

assert_eq!(edges, vec![Edge::new((0, 0), (1, 0)), Edge::new((1, 0), (2, 0))]);

Same as edges but in reverse order. Get the sequence of edges of the point string starting from the last point to the first.

Examples
use iron_shapes::point_string::PointString;
use iron_shapes::edge::Edge;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

let edges: Vec<_> = point_string.edges_reversed().collect();

assert_eq!(edges, vec![Edge::new((2, 0), (1, 0)), Edge::new((1, 0), (0, 0))]);

Compute geometrical length of the path defined by the point string.

Examples
use iron_shapes::point_string::PointString;
let coords = vec![(0, 0), (1, 0), (2, 0)];

let point_string = PointString::new(coords);

assert_eq!(point_string.path_length::<f64>(), 2.0);

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

Create a point string from something that can be turned into an iterator of values convertible to Points.

Performs the conversion.

Create a point string from a iterator of values convertible to Points.

Creates a value from an iterator. Read more

Feeds this value into the given Hasher. Read more

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

Point wise transformation.

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 all the points in this string. Returns None if the string is empty.

Examples
use iron_shapes::point_string::PointString;
use iron_shapes::traits::TryBoundingBox;
use iron_shapes::rect::Rect;
let coords = vec![(0, 0), (1, 0), (2, 1), (-1, -3)];

let point_string = PointString::new(coords);

assert_eq!(point_string.try_bounding_box(), Some(Rect::new((2, 1), (-1, -3))));

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.

Return the geometrical object mirrored at the x axis.

Return the geometrical object mirrored at the y axis.

Rotate the geometrical shape by a multiple of 90 degrees.

Scale the geometrical shape. Scaling center is the origin (0, 0).

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

Translate the geometrical object by a vector v.

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.