Trait libreda_pnr::db::TryBoundingBox[]

pub trait TryBoundingBox<T> where
    T: CoordinateType
{ pub fn try_bounding_box(&self) -> Option<Rect<T>>; }

Try the calculation of the 'bounding box', i.e. the smallest rectangle that contains the geometrical object. In some cases this is not always possible, so the try might fail. For instance a set of polygons does not have a bounding box if the set is empty.

Required methods

pub fn try_bounding_box(&self) -> Option<Rect<T>>

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

Loading content...

Implementors

impl<C> TryBoundingBox<C> for Cell<C> where
    C: CoordinateType
[src]

impl<T> TryBoundingBox<T> for Geometry<T> where
    T: CoordinateType

pub fn try_bounding_box(&self) -> Option<Rect<T>>

Calculate the bounding box of this geometrical shape by calling the bounding box method of the concrete type.

impl<T> TryBoundingBox<T> for Edge<T> where
    T: CoordinateType

pub fn try_bounding_box(&self) -> Option<Rect<T>>

Get bounding box of edge (always exists).

impl<T> TryBoundingBox<T> for Path<T> where
    T: CoordinateType

pub fn try_bounding_box(&self) -> Option<Rect<T>>

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

TODO: Find a better approximation.

impl<T> TryBoundingBox<T> for PointString<T> where
    T: CoordinateType

pub fn try_bounding_box(&self) -> Option<Rect<T>>

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))));

impl<T> TryBoundingBox<T> for Polygon<T> where
    T: CoordinateType

impl<T> TryBoundingBox<T> for Rect<T> where
    T: CoordinateType

pub fn try_bounding_box(&self) -> Option<Rect<T>>

Get bounding box of rectangle (always exists).

impl<T> TryBoundingBox<T> for Shapes<T> where
    T: CoordinateType
[src]

impl<T> TryBoundingBox<T> for SimplePolygon<T> where
    T: CoordinateType

impl<T> TryBoundingBox<T> for SimpleRPolygon<T> where
    T: CoordinateType

impl<T, S> TryBoundingBox<T> for Text<T, S> where
    T: CoordinateType

Loading content...