Struct VectorPoint

Source
pub struct VectorPoint<M: MValueCompatible = MValue> {
    pub x: f64,
    pub y: f64,
    pub z: Option<f64>,
    pub m: Option<M>,
    pub t: Option<f64>,
}
Expand description

A Vector Point uses a structure for 2D or 3D points

Fields§

§x: f64

X coordinate

§y: f64

Y coordinate

§z: Option<f64>

Z coordinate or “altitude”. May be None

§m: Option<M>

M-Value

§t: Option<f64>

T for tolerance. A tmp value used for simplification

Implementations§

Source§

impl VectorPoint<MValue>

Source

pub fn from_xy(x: f64, y: f64) -> Self

Helper function for tests. Create a new point quickly from an xy coordinate

Source

pub fn from_xyz(x: f64, y: f64, z: f64) -> Self

Helper function for tests. Create a new point quickly from an xyz coordinate

Source§

impl<M: MValueCompatible> VectorPoint<M>

Source

pub fn new(x: f64, y: f64, z: Option<f64>, m: Option<M>) -> Self

Create a new point

Source

pub fn new_xy(x: f64, y: f64, m: Option<M>) -> Self

Create a new point with xy

Source

pub fn new_xyz(x: f64, y: f64, z: f64, m: Option<M>) -> Self

Create a new point with xyz

Source

pub fn project(&mut self, bbox: Option<&mut BBox3D>)

Project the point into the 0->1 coordinate system

Source

pub fn unproject(&mut self)

Unproject the point from the 0->1 coordinate system back to a lon-lat coordinate

Source

pub fn distance<M2: MValueCompatible>(&self, other: &VectorPoint<M2>) -> f64

Calculate the distance between two points, allowing different M types

Source

pub fn modulo(self, modulus: f64) -> Self

Apply modular arithmetic to x, y, and z using modulus

Trait Implementations§

Source§

impl<M1: MValueCompatible, M2: MValueCompatible> Add<VectorPoint<M2>> for VectorPoint<M1>

Source§

type Output = VectorPoint<M1>

The resulting type after applying the + operator.
Source§

fn add(self, other: VectorPoint<M2>) -> Self::Output

Performs the + operation. Read more
Source§

impl<M: MValueCompatible> Add<f64> for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the + operator.
Source§

fn add(self, other: f64) -> Self::Output

Performs the + operation. Read more
Source§

impl<M: Clone + MValueCompatible> Clone for VectorPoint<M>

Source§

fn clone(&self) -> VectorPoint<M>

Returns a copy 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<M: Debug + MValueCompatible> Debug for VectorPoint<M>

Source§

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

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

impl<M: Default + MValueCompatible> Default for VectorPoint<M>

Source§

fn default() -> VectorPoint<M>

Returns the “default value” for a type. Read more
Source§

impl<'de, M> Deserialize<'de> for VectorPoint<M>
where M: Deserialize<'de> + MValueCompatible,

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<M1: MValueCompatible, M2: MValueCompatible> Div<VectorPoint<M2>> for VectorPoint<M1>

Source§

type Output = VectorPoint<M1>

The resulting type after applying the / operator.
Source§

fn div(self, other: VectorPoint<M2>) -> Self::Output

Performs the / operation. Read more
Source§

impl<M: MValueCompatible> Div<f64> for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the / operator.
Source§

fn div(self, other: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl<M: MValueCompatible> From<&Point> for VectorPoint<M>

Source§

fn from(p: &Point) -> Self

Converts to this type from the input type.
Source§

impl<M: MValueCompatible> From<&Point3D> for VectorPoint<M>

Source§

fn from(p: &Point3D) -> Self

Converts to this type from the input type.
Source§

impl<M: MValueCompatible> From<Point> for VectorPoint<M>

Source§

fn from(p: Point) -> Self

Converts to this type from the input type.
Source§

impl<M: MValueCompatible> From<Point3D> for VectorPoint<M>

Source§

fn from(p: Point3D) -> Self

Converts to this type from the input type.
Source§

impl<M1: MValueCompatible, M2: MValueCompatible> Mul<VectorPoint<M2>> for VectorPoint<M1>

Source§

type Output = VectorPoint<M1>

The resulting type after applying the * operator.
Source§

fn mul(self, other: VectorPoint<M2>) -> Self::Output

Performs the * operation. Read more
Source§

impl<M: MValueCompatible> Mul<f64> for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the * operator.
Source§

fn mul(self, other: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl<M: MValueCompatible> Neg for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<M: MValueCompatible> Ord for VectorPoint<M>

Source§

fn cmp(&self, other: &VectorPoint<M>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<M: MValueCompatible> PartialEq for VectorPoint<M>

Source§

fn eq(&self, other: &VectorPoint<M>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M: MValueCompatible> PartialOrd for VectorPoint<M>

Source§

fn partial_cmp(&self, other: &VectorPoint<M>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<M: MValueCompatible> Rem<f64> for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the % operator.
Source§

fn rem(self, modulus: f64) -> Self::Output

Performs the % operation. Read more
Source§

impl<M: MValueCompatible> RemAssign<f64> for VectorPoint<M>

Source§

fn rem_assign(&mut self, modulus: f64)

Performs the %= operation. Read more
Source§

impl<M> Serialize for VectorPoint<M>

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<M1: MValueCompatible, M2: MValueCompatible> Sub<VectorPoint<M2>> for VectorPoint<M1>

Source§

type Output = VectorPoint<M1>

The resulting type after applying the - operator.
Source§

fn sub(self, other: VectorPoint<M2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<M: MValueCompatible> Sub<f64> for VectorPoint<M>

Source§

type Output = VectorPoint<M>

The resulting type after applying the - operator.
Source§

fn sub(self, other: f64) -> Self::Output

Performs the - operation. Read more
Source§

impl<M: MValueCompatible> Eq for VectorPoint<M>

Auto Trait Implementations§

§

impl<M> Freeze for VectorPoint<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for VectorPoint<M>
where M: RefUnwindSafe,

§

impl<M> Send for VectorPoint<M>
where M: Send,

§

impl<M> Sync for VectorPoint<M>
where M: Sync,

§

impl<M> Unpin for VectorPoint<M>
where M: Unpin,

§

impl<M> UnwindSafe for VectorPoint<M>
where M: UnwindSafe,

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> 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>,