Enum libreda_db::prelude::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, 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
sourceimpl<T> Geometry<T> where
T: CoordinateType,
impl<T> Geometry<T> where
T: CoordinateType,
sourcepub 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
sourceimpl<'de, T> Deserialize<'de> for Geometry<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Geometry<T> where
T: Deserialize<'de>,
sourcefn 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
sourceimpl<T> DoubledOrientedArea<T> for Geometry<T> where
T: CoordinateType + NumCast,
impl<T> DoubledOrientedArea<T> for Geometry<T> where
T: CoordinateType + NumCast,
sourcefn area_doubled_oriented(&self) -> T
fn area_doubled_oriented(&self) -> T
Area calculation.
sourceimpl<T> From<SimplePolygon<T>> for Geometry<T>
impl<T> From<SimplePolygon<T>> for Geometry<T>
sourcefn from(x: SimplePolygon<T>) -> Geometry<T>
fn from(x: SimplePolygon<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T> From<SimpleRPolygon<T>> for Geometry<T>
impl<T> From<SimpleRPolygon<T>> for Geometry<T>
sourcefn from(x: SimpleRPolygon<T>) -> Geometry<T>
fn from(x: SimpleRPolygon<T>) -> Geometry<T>
Converts to this type from the input type.
sourceimpl<T> Serialize for Geometry<T> where
T: Serialize,
impl<T> Serialize for Geometry<T> where
T: Serialize,
sourcefn 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
sourceimpl<T> ToPolygon<T> for Geometry<T> where
T: CoordinateType + NumCast,
impl<T> ToPolygon<T> for Geometry<T> where
T: CoordinateType + NumCast,
sourcefn 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())
sourceimpl<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,
sourcefn 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.
sourceimpl<T, Dst> TryCastCoord<T, Dst> for Geometry<T> where
T: CoordinateType + NumCast,
Dst: CoordinateType + NumCast,
impl<T, Dst> TryCastCoord<T, Dst> for Geometry<T> where
T: CoordinateType + NumCast,
Dst: CoordinateType + NumCast,
impl<T> Eq for Geometry<T> where
T: Eq,
impl<T> StructuralEq for Geometry<T>
impl<T> StructuralPartialEq for Geometry<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Geometry<T> where
T: RefUnwindSafe,
impl<T> Send for Geometry<T> where
T: Send,
impl<T> Sync for Geometry<T> where
T: Sync,
impl<T> Unpin for Geometry<T> where
T: Unpin,
impl<T> UnwindSafe for Geometry<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more