[][src]Enum mercator_db::space::Shape

pub enum Shape {
    Point(Position),
    HyperSphere(PositionCoordinate),
    BoundingBox(PositionPosition),
}

Known shapes descriptions

Variants

Point(Position)

A singular point in space.

HyperSphere(PositionCoordinate)

A sphere in space.

BoundingBox(PositionPosition)

Hyperrectangle whose faces have one of the axis as a normal.

Methods

impl Shape[src]

pub fn rebase(&self, from: &Space, to: &Space) -> Result<Shape, String>[src]

Convert the encoded coordinates between two reference spaces.

The resulting shape is expressed in encoded coordinates in the target space.

Parameters

  • from: Current reference space of the shape.

  • to: Target reference space.

pub fn decode(&self, space: &Space) -> Result<Shape, String>[src]

Decode the coordinates of the shape.

The encoded coordinates of the shapes are expressed in the provided space.

Parameters

  • space: Reference space of the shape. It is used to decode the encoded coordinates into positions.

Return value

The shape with decoded positions within the space.

pub fn encode(&self, space: &Space) -> Result<Shape, String>[src]

Encode the positions of the shape.

The positions of the shapes are expressed in the provided space.

Parameters

  • space: Reference space of the shape. It is used to encode the positions into encoded coordinates.

Return value

The shape with encoded coordinates within the space.

pub fn get_mbb(&self) -> (Position, Position)[src]

Compute the minimum bounding box of the shape.

This is an hyperrectangle whose faces are perpendicular to an axis of the space, and which minimally covers the shape.

pub fn contains(&self, position: &Position) -> bool[src]

Check if the shape overlaps with the given position.

Parameters

  • position: The position to check.

pub fn rasterise(&self) -> Result<Vec<Position>, String>[src]

Transform a Shape into a list of Position which approximate the shape.

pub fn rasterise_from(&self, space: &Space) -> Result<Vec<Position>, String>[src]

Transform a Shape into a list of Position which approximate the shape, in absolute, or Universe positions.

Parameters

  • space: Reference space in which the shape is expressed.

pub fn volume(&self) -> f64[src]

Compute the volume.

Trait Implementations

impl Clone for Shape[src]

impl Debug for Shape[src]

impl<'de> Deserialize<'de> for Shape[src]

impl Serialize for Shape[src]

Auto Trait Implementations

impl RefUnwindSafe for Shape

impl Send for Shape

impl Sync for Shape

impl Unpin for Shape

impl UnwindSafe for Shape

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.