Skip to main content

Geometry

Enum Geometry 

Source
pub enum Geometry {
    Point([f64; 2]),
    BoundingBox(BoundingBox),
    ArcSegment(ArcSegment),
    LineSegment(LineSegment),
    Line(Line),
    Segment(Segment),
    Polysegment(Polysegment),
    Contour(Contour),
    Shape(Shape),
}
Expand description

A container enum for owned geometric types. See the module-level documentation for more.

Variants§

§

Point([f64; 2])

An owned point ([f64; 2]).

§

BoundingBox(BoundingBox)

An owned BoundingBox.

§

ArcSegment(ArcSegment)

An owned ArcSegment.

§

LineSegment(LineSegment)

An owned LineSegment.

§

Line(Line)

An owned Line.

§

Segment(Segment)

An owned Segment.

§

Polysegment(Polysegment)

An owned Polysegment.

§

Contour(Contour)

An owned Contour.

§

Shape(Shape)

An owned Shape.

Implementations§

Source§

impl Geometry

Source

pub fn segment(&self, key: SegmentKey) -> Option<&Segment>

If self holds a Composite, returns a reference to the Segment specified by the given SegmentKey. Otherwise, returns None.

Source

pub fn intersections<'b, T: Into<GeometryRef<'b>>>( &self, other: T, epsilon: f64, max_ulps: u32, ) -> Vec<Intersection>

Returns all intersections between self and other.

See GeometryRef::intersections for details and examples.

Source

pub fn intersections_par<'b, T: Into<GeometryRef<'b>>>( &self, other: T, epsilon: f64, max_ulps: u32, ) -> Vec<Intersection>

Returns all intersections between self and other.

This is a parallelized version of Geometry::intersections, see its docstring for details. It uses parallel variants of the specialized intersection algorithms, if available.

Trait Implementations§

Source§

impl Clone for Geometry

Source§

fn clone(&self) -> Geometry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Geometry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Geometry

Source§

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 From<&Geometry> for BoundingBox

Source§

fn from(value: &Geometry) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Geometry> for GeometryCow<'a>

Source§

fn from(value: &'a Geometry) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Geometry> for GeometryRef<'a>

Source§

fn from(value: &'a Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<[f64; 2]> for Geometry

Source§

fn from(value: [f64; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<ArcSegment> for Geometry

Source§

fn from(value: ArcSegment) -> Self

Converts to this type from the input type.
Source§

impl From<BoundingBox> for Geometry

Source§

fn from(value: BoundingBox) -> Self

Converts to this type from the input type.
Source§

impl From<Contour> for Geometry

Source§

fn from(value: Contour) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Geometry> for GeometryCow<'a>

Source§

fn from(value: Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<Line> for Geometry

Source§

fn from(value: Line) -> Self

Converts to this type from the input type.
Source§

impl From<LineSegment> for Geometry

Source§

fn from(value: LineSegment) -> Self

Converts to this type from the input type.
Source§

impl From<Polysegment> for Geometry

Source§

fn from(value: Polysegment) -> Self

Converts to this type from the input type.
Source§

impl From<Segment> for Geometry

Source§

fn from(value: Segment) -> Self

Converts to this type from the input type.
Source§

impl From<Shape> for Geometry

Source§

fn from(value: Shape) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Geometry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Transformation for Geometry

Source§

fn translate(&mut self, shift: [f64; 2])

Translates self by the given shift. Read more
Source§

fn rotate(&mut self, center: [f64; 2], angle: f64)

Rotates self around the center by the given angle (in rad). Read more
Source§

fn scale(&mut self, factor: f64)

Scales self by factor with respect to the origin [0.0, 0.0]. Read more
Source§

fn line_reflection(&mut self, start: [f64; 2], stop: [f64; 2])

Mirrors self about a line defined by two points. Read more
Source§

fn point_reflection(&mut self, point: [f64; 2])

Mirrors self about a point. This operation is equivalent to a rotation around the point with the angle PI. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToBoundingBox for T
where &'a T: for<'a> Into<BoundingBox>,

Source§

fn bounding_box(&self) -> BoundingBox

Returns a bounding box for the implementor. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,