[−][src]Struct mercator_db::space::Axis
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]
unit: &str,
unit_vector: Vec<f64>,
set: NumberSet,
minimum: f64,
maximum: f64,
steps: u64
) -> Result<Self, String>
Instanciate a new Axis definition.
Parameters
-
unit: SI Unit to use on this axis for the1.0value. 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:
mdmcmmmumnmpm
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl<'_> From<&'_ Axis> for Axis[src]
impl From<Axis> for Axis[src]
impl PartialEq<Axis> for Axis[src]
impl Serialize for Axis[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,