Enum iron_shapes::shape::Geometry
source · pub enum Geometry<T> {
Point(Point<T>),
Edge(Edge<T>),
Rect(Rect<T>),
SimplePolygon(SimplePolygon<T>),
SimpleRPolygon(SimpleRPolygon<T>),
Polygon(Polygon<T>),
Path(Path<T>),
Text(Text<T>),
}Expand description
Abstracted geometrical shape.
Variants§
Point(Point<T>)
Point.
Edge(Edge<T>)
Edge.
Rect(Rect<T>)
Rect.
SimplePolygon(SimplePolygon<T>)
SimplePolygon.
SimpleRPolygon(SimpleRPolygon<T>)
SimpleRPolygon.
Polygon(Polygon<T>)
Polygon.
Path(Path<T>)
Path.
Text(Text<T>)
Text.
Implementations§
source§impl<T: CoordinateType> Geometry<T>
impl<T: CoordinateType> Geometry<T>
sourcepub fn transformed(&self, tf: &SimpleTransform<T>) -> Self
pub fn transformed(&self, tf: &SimpleTransform<T>) -> Self
Create a transformed copy of the geometric object.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Geometry<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Geometry<T>where T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: CoordinateType + NumCast> DoubledOrientedArea<T> for Geometry<T>
impl<T: CoordinateType + NumCast> DoubledOrientedArea<T> for Geometry<T>
source§fn area_doubled_oriented(&self) -> T
fn area_doubled_oriented(&self) -> T
Area calculation.
source§impl<T> From<SimplePolygon<T>> for Geometry<T>
impl<T> From<SimplePolygon<T>> for Geometry<T>
source§fn from(x: SimplePolygon<T>) -> Geometry<T>
fn from(x: SimplePolygon<T>) -> Geometry<T>
Converts to this type from the input type.
source§impl<T> From<SimpleRPolygon<T>> for Geometry<T>
impl<T> From<SimpleRPolygon<T>> for Geometry<T>
source§fn from(x: SimpleRPolygon<T>) -> Geometry<T>
fn from(x: SimpleRPolygon<T>) -> Geometry<T>
Converts to this type from the input type.
source§impl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T>
impl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T>
source§impl<T: CoordinateType + NumCast> ToPolygon<T> for Geometry<T>
impl<T: CoordinateType + NumCast> ToPolygon<T> for Geometry<T>
source§fn to_polygon(&self) -> Polygon<T>
fn to_polygon(&self) -> Polygon<T>
Convert a geometry into a polygon.
The coordinate type must implement NumCast because there is currently
no way to convert a Path into a polygon without converting it to a float type first.
Examples
use iron_shapes::prelude::*;
let rect = Rect::new((0, 0), (1, 2));
// Convert the rectangle to a `Geometry`.
let g: Geometry<_> = rect.into();
assert_eq!(g.to_polygon(), rect.to_polygon())source§impl<T: Copy + PartialOrd + Num> TryBoundingBox<T> for Geometry<T>
impl<T: Copy + PartialOrd + Num> TryBoundingBox<T> for Geometry<T>
source§fn try_bounding_box(&self) -> Option<Rect<T>>
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.