pub struct Point {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
Point in space (1D, 2D, or 3D)
Fields§
§x: f64x-coordinate
y: f64y-coordinate (0 for 1D)
z: f64z-coordinate (0 for 1D/2D)
Implementations§
Source§impl Point
impl Point
Sourcepub fn from_polar(r: f64, theta: f64) -> Self
pub fn from_polar(r: f64, theta: f64) -> Self
Polar coordinates (r, θ) for 2D
Sourcepub fn from_spherical(r: f64, theta: f64, phi: f64) -> Self
pub fn from_spherical(r: f64, theta: f64, phi: f64) -> Self
Spherical coordinates (r, θ, φ) for 3D θ = polar angle from z-axis φ = azimuthal angle in xy-plane
Sourcepub fn distance_to(&self, other: &Point) -> f64
pub fn distance_to(&self, other: &Point) -> f64
Distance to another point
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Point
impl<'de> Deserialize<'de> for Point
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnsafeUnpin for Point
impl UnwindSafe for Point
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more