pub struct Point3D {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
3D point in space
Fields§
§x: f64X coordinate
y: f64Y coordinate
z: f64Z coordinate
Implementations§
Source§impl Point3D
impl Point3D
Sourcepub fn distance_to(&self, other: &Point3D) -> f64
pub fn distance_to(&self, other: &Point3D) -> f64
Calculate Euclidean distance to another point
Sourcepub fn to_spherical(&self) -> (f64, f64, f64)
pub fn to_spherical(&self) -> (f64, f64, f64)
Convert to spherical coordinates (r, theta, phi) theta: polar angle (0 to PI) phi: azimuthal angle (-PI to PI)
Sourcepub fn from_spherical(r: f64, theta: f64, phi: f64) -> Point3D
pub fn from_spherical(r: f64, theta: f64, phi: f64) -> Point3D
Create from spherical coordinates
Sourcepub fn dot(&self, other: &Point3D) -> f64
pub fn dot(&self, other: &Point3D) -> f64
Compute dot product with another point (treating as vectors)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Point3D
impl<'de> Deserialize<'de> for Point3D
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point3D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point3D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Point3D> for Point3DConfig
impl From<Point3D> for Point3DConfig
Source§fn from(p: Point3D) -> Point3DConfig
fn from(p: Point3D) -> Point3DConfig
Converts to this type from the input type.
Source§impl From<Point3DConfig> for Point3D
impl From<Point3DConfig> for Point3D
Source§fn from(p: Point3DConfig) -> Point3D
fn from(p: Point3DConfig) -> Point3D
Converts to this type from the input type.
Source§impl Serialize for Point3D
impl Serialize for Point3D
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Point3D
impl StructuralPartialEq for Point3D
Auto Trait Implementations§
impl Freeze for Point3D
impl RefUnwindSafe for Point3D
impl Send for Point3D
impl Sync for Point3D
impl Unpin for Point3D
impl UnsafeUnpin for Point3D
impl UnwindSafe for Point3D
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more