#[repr(C)]pub struct VectorPoint<M: Clone = MValue> {
pub x: f64,
pub y: f64,
pub z: Option<f64>,
pub m: Option<M>,
pub t: Option<f64>,
}Expand description
§Vector Points
§Description
A Vector Point uses a structure for 2D or 3D points. Useful for geometry that also has m-values
Implements the ops Add, AddAssign, Sub, SubAssign, Mul, MulAssign, Div, DivAssign, Rem, RemAssign, Neg, PartialEq, and Eq.
Also implements local traits GetXY, GetZ, GetM, SetXY, SetZ, SetM, NewXY, NewXYM, NewXYZ, NewXYZM, MValueCompatible, MValue, and Interpolate.
§Fields
x: X coordinatey: Y coordinatez: Z coordinate or “altitude”. May be Nonem: M-Valuet: T for tolerance. A tmp value often used for simplification if needed.
§Usage
VectorPoint::new: Creates a new VectorPointVectorPoint::to_m_value: Convert to an MValue VectorPoint using to_m_valueVectorPoint::project: Project the point into the 0->1 coordinate systemVectorPoint::unproject: Unproject the point from the 0->1 coordinate systemVectorPoint::is_empty: Returns true if the point is the zero vectorVectorPoint::face: Returns the S2 face assocated with this point- `VectorPoint::modulo: Apply modular arithmetic
VectorPoint::angle: Returns the angle between “this” and v in radians, in the range [0, pi]. If either vector is zero-length, or nearly zero-length, the result will be zero, regardless of the other valueVectorPoint::cross: Get the cross product of two Vector PointsVectorPoint::dot: dot returns the standard dot product of v and ov.VectorPoint::abs: Returns the absolute value of the point.VectorPoint::invert: Returns the inverse of the pointVectorPoint::len: Returns the length of the pointVectorPoint::norm: norm returns the vector’s norm. (sqrt of norm2)VectorPoint::norm2: norm2 returns the vector’s squared norm (self.dot(self))VectorPoint::normalize: Normalize this point to unit lengthVectorPoint::distance: return the distance from this point to the other pointVectorPoint::largest_abs_component: Returns the largest absolute component of the pointVectorPoint::interpolate: Interpolate between two points with a given t value
Fields§
§x: f64X coordinate
y: f64Y 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>
impl VectorPoint<MValue>
Source§impl<M: Clone> VectorPoint<M>
impl<M: Clone> VectorPoint<M>
Sourcepub fn to_m_value(&self) -> VectorPoint<MValue>
pub fn to_m_value(&self) -> VectorPoint<MValue>
Convert to an MValue VectorPoint
Sourcepub fn project(&mut self, bbox: Option<&mut BBox3D>)
pub fn project(&mut self, bbox: Option<&mut BBox3D>)
Project the point into the 0->1 coordinate system
Sourcepub fn unproject(&mut self)
pub fn unproject(&mut self)
Unproject the point from the 0->1 coordinate system back to a lon-lat coordinate
Sourcepub fn modulo(self, modulus: f64) -> Self
pub fn modulo(self, modulus: f64) -> Self
Apply modular arithmetic to x, y, and z using modulus
Sourcepub fn angle<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
pub fn angle<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
Returns the angle between “this” and v in radians, in the range [0, pi]. If either vector is zero-length, or nearly zero-length, the result will be zero, regardless of the other value.
Sourcepub fn cross<M2: Clone>(&self, b: &VectorPoint<M2>) -> Self
pub fn cross<M2: Clone>(&self, b: &VectorPoint<M2>) -> Self
Get the cross product of two Vector Points
Sourcepub fn dot<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
pub fn dot<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
dot returns the standard dot product of v and ov.
Sourcepub fn distance<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
pub fn distance<M2: Clone>(&self, b: &VectorPoint<M2>) -> f64
return the distance from this point to the other point in radians
Sourcepub fn largest_abs_component(&self) -> u8
pub fn largest_abs_component(&self) -> u8
Returns the largest absolute component of the point.
Sourcepub fn intermediate<M2: Clone>(&self, b: &VectorPoint<M2>, t: f64) -> Self
pub fn intermediate<M2: Clone>(&self, b: &VectorPoint<M2>, t: f64) -> Self
Returns the intermediate point between this and the other point.
Sourcepub fn perpendicular(&self) -> Self
pub fn perpendicular(&self) -> Self
Returns the perpendicular vector
Trait Implementations§
Source§impl<M1: Clone, M2: Clone> Add<&VectorPoint<M2>> for &VectorPoint<M1>
impl<M1: Clone, M2: Clone> Add<&VectorPoint<M2>> for &VectorPoint<M1>
Source§type Output = VectorPoint<M1>
type Output = VectorPoint<M1>
+ operator.Source§impl<M1: Clone, M2: Clone> AddAssign<&VectorPoint<M2>> for VectorPoint<M1>
impl<M1: Clone, M2: Clone> AddAssign<&VectorPoint<M2>> for VectorPoint<M1>
Source§fn add_assign(&mut self, other: &VectorPoint<M2>)
fn add_assign(&mut self, other: &VectorPoint<M2>)
+= operation. Read moreSource§impl<M: Clone> AddAssign<f64> for VectorPoint<M>
impl<M: Clone> AddAssign<f64> for VectorPoint<M>
Source§fn add_assign(&mut self, other: f64)
fn add_assign(&mut self, other: f64)
+= operation. Read moreSource§impl<M: Clone + Clone> Clone for VectorPoint<M>
impl<M: Clone + Clone> Clone for VectorPoint<M>
Source§fn clone(&self) -> VectorPoint<M>
fn clone(&self) -> VectorPoint<M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<M: Default + Clone> Default for VectorPoint<M>
impl<M: Default + Clone> Default for VectorPoint<M>
Source§fn default() -> VectorPoint<M>
fn default() -> VectorPoint<M>
Source§impl<'de, M> Deserialize<'de> for VectorPoint<M>where
M: Deserialize<'de> + Clone,
impl<'de, M> Deserialize<'de> for VectorPoint<M>where
M: Deserialize<'de> + Clone,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<M1: Clone, M2: Clone> Div<&VectorPoint<M2>> for &VectorPoint<M1>
impl<M1: Clone, M2: Clone> Div<&VectorPoint<M2>> for &VectorPoint<M1>
Source§type Output = VectorPoint<M1>
type Output = VectorPoint<M1>
/ operator.Source§impl<M1: Clone, M2: Clone> DivAssign<&VectorPoint<M2>> for VectorPoint<M1>
impl<M1: Clone, M2: Clone> DivAssign<&VectorPoint<M2>> for VectorPoint<M1>
Source§fn div_assign(&mut self, other: &VectorPoint<M2>)
fn div_assign(&mut self, other: &VectorPoint<M2>)
/= operation. Read moreSource§impl<M: Clone> DivAssign<f64> for VectorPoint<M>
impl<M: Clone> DivAssign<f64> for VectorPoint<M>
Source§fn div_assign(&mut self, other: f64)
fn div_assign(&mut self, other: f64)
/= operation. Read moreSource§impl<M: Clone> GetXY for VectorPoint<M>
impl<M: Clone> GetXY for VectorPoint<M>
Source§impl<M: Interpolate + Clone> Interpolate for VectorPoint<M>
impl<M: Interpolate + Clone> Interpolate for VectorPoint<M>
Source§fn interpolate(&self, other: &Self, t: f64) -> Self
fn interpolate(&self, other: &Self, t: f64) -> Self
Source§impl<M1: Clone, M2: Clone> Mul<&VectorPoint<M2>> for &VectorPoint<M1>
impl<M1: Clone, M2: Clone> Mul<&VectorPoint<M2>> for &VectorPoint<M1>
Source§type Output = VectorPoint<M1>
type Output = VectorPoint<M1>
* operator.Source§impl<M1: Clone, M2: Clone> MulAssign<&VectorPoint<M2>> for VectorPoint<M1>
impl<M1: Clone, M2: Clone> MulAssign<&VectorPoint<M2>> for VectorPoint<M1>
Source§fn mul_assign(&mut self, other: &VectorPoint<M2>)
fn mul_assign(&mut self, other: &VectorPoint<M2>)
*= operation. Read moreSource§impl<M: Clone> MulAssign<f64> for VectorPoint<M>
impl<M: Clone> MulAssign<f64> for VectorPoint<M>
Source§fn mul_assign(&mut self, other: f64)
fn mul_assign(&mut self, other: f64)
*= operation. Read moreSource§impl<M: Clone> Neg for &VectorPoint<M>
impl<M: Clone> Neg for &VectorPoint<M>
Source§impl<M: Clone> NewXY for VectorPoint<M>
impl<M: Clone> NewXY for VectorPoint<M>
Source§impl<M: Clone> NewXYM<M> for VectorPoint<M>
impl<M: Clone> NewXYM<M> for VectorPoint<M>
Source§impl<M: Clone> NewXYZ for VectorPoint<M>
impl<M: Clone> NewXYZ for VectorPoint<M>
Source§impl<M: Clone> NewXYZM<M> for VectorPoint<M>
impl<M: Clone> NewXYZM<M> for VectorPoint<M>
Source§impl<M: Clone> Ord for VectorPoint<M>
impl<M: Clone> Ord for VectorPoint<M>
Source§fn cmp(&self, other: &VectorPoint<M>) -> Ordering
fn cmp(&self, other: &VectorPoint<M>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<M: Clone> PartialEq for VectorPoint<M>
impl<M: Clone> PartialEq for VectorPoint<M>
Source§impl<M: Clone> PartialOrd for VectorPoint<M>
impl<M: Clone> PartialOrd for VectorPoint<M>
Source§impl<M: Clone> RemAssign<f64> for VectorPoint<M>
impl<M: Clone> RemAssign<f64> for VectorPoint<M>
Source§fn rem_assign(&mut self, modulus: f64)
fn rem_assign(&mut self, modulus: f64)
%= operation. Read moreSource§impl<M> Serialize for VectorPoint<M>
impl<M> Serialize for VectorPoint<M>
Source§impl<M: Clone> SetXY for VectorPoint<M>
impl<M: Clone> SetXY for VectorPoint<M>
Source§impl<M1: Clone, M2: Clone> Sub<&VectorPoint<M2>> for &VectorPoint<M1>
impl<M1: Clone, M2: Clone> Sub<&VectorPoint<M2>> for &VectorPoint<M1>
Source§type Output = VectorPoint<M1>
type Output = VectorPoint<M1>
- operator.Source§impl<M1: Clone, M2: Clone> SubAssign<&VectorPoint<M2>> for VectorPoint<M1>
impl<M1: Clone, M2: Clone> SubAssign<&VectorPoint<M2>> for VectorPoint<M1>
Source§fn sub_assign(&mut self, other: &VectorPoint<M2>)
fn sub_assign(&mut self, other: &VectorPoint<M2>)
-= operation. Read moreSource§impl<M: Clone> SubAssign<f64> for VectorPoint<M>
impl<M: Clone> SubAssign<f64> for VectorPoint<M>
Source§fn sub_assign(&mut self, other: f64)
fn sub_assign(&mut self, other: f64)
-= operation. Read more