pub struct Quaternion {
pub typ: String,
pub guid: String,
pub name: String,
pub s: f32,
pub v: Vector,
}
Fields§
§typ: String
§guid: String
§name: String
§s: f32
§v: Vector
Implementations§
Source§impl Quaternion
impl Quaternion
pub fn new(s: f32, v: Vector) -> Self
pub fn from_sv(s: f32, x: f32, y: f32, z: f32) -> Self
pub fn identity() -> Self
pub fn from_axis_angle(axis: Vector, angle: f32) -> Self
pub fn rotate_vector(&self, v: Vector) -> Vector
pub fn magnitude(&self) -> f32
pub fn normalize(&self) -> Self
pub fn conjugate(&self) -> Self
pub fn jsondump(&self) -> Result<String, Box<dyn Error>>
pub fn jsonload(json_data: &str) -> Result<Self, Box<dyn Error>>
pub fn to_json(&self, filepath: &str) -> Result<(), Box<dyn Error>>
pub fn from_json(filepath: &str) -> Result<Self, Box<dyn Error>>
Trait Implementations§
Source§impl Clone for Quaternion
impl Clone for Quaternion
Source§fn clone(&self) -> Quaternion
fn clone(&self) -> Quaternion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Quaternion
impl Debug for Quaternion
Source§impl Default for Quaternion
impl Default for Quaternion
Source§impl<'de> Deserialize<'de> for Quaternion
impl<'de> Deserialize<'de> for Quaternion
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
Source§impl Mul for Quaternion
impl Mul for Quaternion
Source§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
*
operator.Source§impl PartialEq for Quaternion
impl PartialEq for Quaternion
Source§impl Serialize for Quaternion
impl Serialize for Quaternion
impl StructuralPartialEq for Quaternion
Auto Trait Implementations§
impl Freeze for Quaternion
impl RefUnwindSafe for Quaternion
impl Send for Quaternion
impl Sync for Quaternion
impl Unpin for Quaternion
impl UnwindSafe for Quaternion
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