[][src]Struct mercator_db::space::Axis

pub struct Axis { /* fields omitted */ }

Definition of an axis of a base.

This links together valid values on this axis, as well as the direction in the Universe of the axis and the base length unit of the 1.0 value.

Methods

impl Axis[src]

pub fn new(
    unit: &str,
    unit_vector: Vec<f64>,
    set: NumberSet,
    minimum: f64,
    maximum: f64,
    steps: u64
) -> Result<Self, String>
[src]

Instanciate a new Axis definition.

Parameters

  • unit: SI Unit to use on this axis for the 1.0 value. See measurement_unit.

  • unit_vector: A vector providing the direction in the Universe space of this axis.

  • set: The valid numbers on this axis.

  • minimum: The minimum value described by this axis included.

  • maximum: The maximum value described by this axis included.

  • steps: The number of steps, or discrete ticks on this axis.

pub fn measurement_unit(&self) -> &str[src]

The unit, as in SI unit used on this axis, more specifically, a metric prefix of the meter.

Currently the following values are supported:

  • m
  • dm
  • cm
  • mm
  • um
  • nm
  • pm

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

The unit vector of the axis.

This vector is expressed in the Universe coordinate system.

pub fn graduation(&self) -> &Graduation[src]

The valid number range and properties on this axis.

pub fn project_in(&self, position: &Position) -> Result<Coordinate, String>[src]

Project a position on this axis.

The resulting coordinate is expressed as an encoded coordinate on this axis.

Parameters

  • position: The position to project on this axis. It must be defined in Universe coordinates, but with any translations already applied so that the origin of the vector is the origin of this axis.

pub fn project_out(&self, coordinate: &Coordinate) -> Result<Position, String>[src]

Convert an encoded coordinate expressed on this axis into a position.

The resulting position is expressed in the Universe reference space, but from the origin of this axis. Any required translation must be applied to this resulting position to obtain an absolute value in the Universe space.

Parameters

  • coordinate: The coordinate to project out of this axis. It must be defined as an encoded coordinate on this axis.

pub fn encode(&self, val: f64) -> Result<Coordinate, String>[src]

Encode a coordinate expressed on this axis.

Parameters

  • val: The coordinate to encode. It must be defined as a coordinate on this axis.

pub fn decode(&self, val: &Coordinate) -> Result<f64, String>[src]

Decode a coordinate expressed on this axis.

Parameters

  • val: The coordinate to decode. It must be defined as an encoded coordinate on this axis.

Trait Implementations

impl Clone for Axis[src]

impl Debug for Axis[src]

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

impl<'_> From<&'_ Axis> for Axis[src]

impl From<Axis> for Axis[src]

impl PartialEq<Axis> for Axis[src]

impl Serialize for Axis[src]

impl StructuralPartialEq for Axis[src]

Auto Trait Implementations

impl RefUnwindSafe for Axis

impl Send for Axis

impl Sync for Axis

impl Unpin for Axis

impl UnwindSafe for Axis

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.