pub struct Quaternion {
pub w: f32,
pub x: f32,
pub y: f32,
pub z: f32,
}Expand description
Représente un quaternion q = w + xi + yj + z*k ou un point/vecteur dans l’espace 4D.
Fields§
§w: f32§x: f32§y: f32§z: f32Implementations§
Source§impl Quaternion
impl Quaternion
Sourcepub const ZERO: Quaternion
pub const ZERO: Quaternion
Quaternion nul / Point à l’origine
Sourcepub const ONE: Quaternion
pub const ONE: Quaternion
Unité de Hamilton (1)
Sourcepub fn from_angle_plane(angle: f32) -> (f32, f32)
pub fn from_angle_plane(angle: f32) -> (f32, f32)
Crée un quaternion de rotation 4D (Rotor de Hamilton) dans le plan spécifié (ex: XW ou YZ).
Sourcepub fn rotate_xw(self, angle: f32) -> Quaternion
pub fn rotate_xw(self, angle: f32) -> Quaternion
Applique une rotation 4D dans le plan X-W (Propre aux Quaternions)
Sourcepub fn rotate_yz(self, angle: f32) -> Quaternion
pub fn rotate_yz(self, angle: f32) -> Quaternion
Applique une rotation 4D dans le plan Y-Z
Sourcepub fn conjugate(self) -> Quaternion
pub fn conjugate(self) -> Quaternion
Conjugué du quaternion : q* = w - xi - yj - zk
Sourcepub fn norm_squared(self) -> f32
pub fn norm_squared(self) -> f32
Norme au carré (évite le sqrt en embedded)
Sourcepub fn project_2d(
self,
center_x: f32,
center_y: f32,
dist_4d: f32,
dist_3d: f32,
) -> (i16, i16, f32)
pub fn project_2d( self, center_x: f32, center_y: f32, dist_4d: f32, dist_3d: f32, ) -> (i16, i16, f32)
Projection perspective 4D -> 3D -> 2D Retourne (screen_x, screen_y, depth_z)
Sourcepub fn normalize(self) -> Option<Quaternion>
pub fn normalize(self) -> Option<Quaternion>
Normalise le quaternion (le rend unitaire) Retourne None si la norme est trop proche de zéro
Trait Implementations§
Source§impl Add for Quaternion
impl Add for Quaternion
Source§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
+ operator.Source§fn add(self, rhs: Quaternion) -> Quaternion
fn add(self, rhs: Quaternion) -> Quaternion
Performs the
+ operation. Read moreSource§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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Quaternion
Source§impl Debug for Quaternion
impl Debug for Quaternion
Source§impl Mul for Quaternion
impl Mul for Quaternion
Source§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
* operator.Source§fn mul(self, rhs: Quaternion) -> Quaternion
fn mul(self, rhs: Quaternion) -> Quaternion
Performs the
* operation. Read moreSource§impl Mul<f32> for Quaternion
impl Mul<f32> 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
impl StructuralPartialEq for Quaternion
Source§impl Sub for Quaternion
impl Sub for Quaternion
Source§type Output = Quaternion
type Output = Quaternion
The resulting type after applying the
- operator.Source§fn sub(self, rhs: Quaternion) -> Quaternion
fn sub(self, rhs: Quaternion) -> Quaternion
Performs the
- operation. Read moreAuto Trait Implementations§
impl Forget for Quaternion
impl Freeze for Quaternion
impl Move for Quaternion
impl RefUnwindSafe for Quaternion
impl Send for Quaternion
impl Sync for Quaternion
impl Unpin for Quaternion
impl UnsafeUnpin 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