Enum libreda_db::prelude::Geometry
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, String>),
}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, String>)
Text.
Implementations§
§impl<T> Geometry<T>where
T: CoordinateType,
impl<T> Geometry<T>where T: CoordinateType,
pub fn transformed(&self, tf: &SimpleTransform<T>) -> Geometry<T>
pub fn transformed(&self, tf: &SimpleTransform<T>) -> Geometry<T>
Create a transformed copy of the geometric object.
Trait Implementations§
§impl<'de, T> Deserialize<'de> for Geometry<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Geometry<T>where T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Geometry<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Geometry<T>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> DoubledOrientedArea<T> for Geometry<T>where
T: CoordinateType + NumCast,
impl<T> DoubledOrientedArea<T> for Geometry<T>where T: CoordinateType + NumCast,
§fn area_doubled_oriented(&self) -> T
fn area_doubled_oriented(&self) -> T
Area calculation.
§impl<T> From<SimplePolygon<T>> for Geometry<T>
impl<T> From<SimplePolygon<T>> for Geometry<T>
§fn from(x: SimplePolygon<T>) -> Geometry<T>
fn from(x: SimplePolygon<T>) -> Geometry<T>
Converts to this type from the input type.
§impl<T> From<SimpleRPolygon<T>> for Geometry<T>
impl<T> From<SimpleRPolygon<T>> for Geometry<T>
§fn from(x: SimpleRPolygon<T>) -> Geometry<T>
fn from(x: SimpleRPolygon<T>) -> Geometry<T>
Converts to this type from the input type.
§impl<T> PartialEq<Geometry<T>> for Geometry<T>where
T: PartialEq<T>,
impl<T> PartialEq<Geometry<T>> for Geometry<T>where T: PartialEq<T>,
§impl<T> Serialize for Geometry<T>where
T: Serialize,
impl<T> Serialize for Geometry<T>where T: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<T> ToPolygon<T> for Geometry<T>where
T: CoordinateType + NumCast,
impl<T> ToPolygon<T> for Geometry<T>where T: CoordinateType + NumCast,
§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())§impl<T> TryBoundingBox<T> for Geometry<T>where
T: Copy + PartialOrd<T> + Num,
impl<T> TryBoundingBox<T> for Geometry<T>where T: Copy + PartialOrd<T> + Num,
§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.