pub struct PyVec3 {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
A 3-component vector suitable for Python interop.
Uses f64 components and maps directly to/from oxiphysics_core::math::Vec3.
Fields§
§x: f64X component.
y: f64Y component.
z: f64Z component.
Implementations§
Source§impl PyVec3
impl PyVec3
Sourcepub fn length_squared(&self) -> f64
pub fn length_squared(&self) -> f64
Squared length.
Sourcepub fn normalized(&self) -> PyVec3
pub fn normalized(&self) -> PyVec3
Normalized (unit) vector; returns zero vector if length is near zero.
Sourcepub fn from_array(arr: [f64; 3]) -> Self
pub fn from_array(arr: [f64; 3]) -> Self
Create from a [f64; 3] array.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PyVec3
impl<'de> Deserialize<'de> for PyVec3
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 PyVec3
impl StructuralPartialEq for PyVec3
Auto Trait Implementations§
impl Freeze for PyVec3
impl RefUnwindSafe for PyVec3
impl Send for PyVec3
impl Sync for PyVec3
impl Unpin for PyVec3
impl UnsafeUnpin for PyVec3
impl UnwindSafe for PyVec3
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.