pub fn rotation_matrix(&self) -> Matrix4x4 {
        let norm = self.dot(self);
        let s = if norm < 1e-6 {
            0.0
        } else {
            2.0 / norm
        };
        let (w, x, y, z) = (self.w, self.x, self.y, self.z);
        let wx = s*w*x; let wy = s*w*y; let wz = s*w*z;
        let xx = s*x*x; let xy = s*x*y; let xz = s*x*z;
        let yy = s*y*y; let yz = s*y*z; let zz = s*z*z;
        Matrix4x4 {
            a1:  1. - (yy + zz), a2:      (xy - wz), a3:      (xz + wy), a4: 0.0,
            b1:       (xy + wz), b2: 1. - (xx + zz), b3:      (yz - wx), b4: 0.0,
            c1:       (xz - wy), c2:      (yz + wx), c3: 1. - (xx + yy), c4: 0.0,
            d1:             0.0, d2:            0.0, d3:            0.0, d4: 1.0,
        }
    }
/// Create a rotation matrix from this quaternion
Create a rotation matrix from this quaternion
Create a rotation matrix from this quaternion
pub fn rotation_matrix(&self) -> Matrix4x4 {
        let norm = self.dot(self);
        let s = if norm < 1e-6 {
            0.0
        } else {
            2.0 / norm
        };
        let (w, x, y, z) = (self.w, self.x, self.y, self.z);
        let wx = s*w*x; let wy = s*w*y; let wz = s*w*z;
        let xx = s*x*x; let xy = s*x*y; let xz = s*x*z;
        let yy = s*y*y; let yz = s*y*z; let zz = s*z*z;
        Matrix4x4 {
            a1:  1. - (yy + zz), a2:      (xy - wz), a3:      (xz + wy), a4: 0.0,
            b1:       (xy + wz), b2: 1. - (xx + zz), b3:      (yz - wx), b4: 0.0,
            c1:       (xz - wy), c2:      (yz + wx), c3: 1. - (xx + yy), c4: 0.0,
            d1:             0.0, d2:            0.0, d3:            0.0, d4: 1.0,
        }
    }
pub fn rotation_matrix ( & self ) -> Matrix4x4 { let norm = self . dot ( self ) ; let s = if norm < 1e-6 { 0.0 } else { 2.0 / norm } ; let ( w , x , y , z ) = ( self . w , self . x , self . y , self . z ) ; let wx = s * w * x ; let wy = s * w * y ; let wz = s * w * z ; let xx = s * x * x ; let xy = s * x * y ; let xz = s * x * z ; let yy = s * y * y ; let yz = s * y * z ; let zz = s * z * z ; Matrix4x4 { a1 : 1. - ( yy + zz ) , a2 : ( xy - wz ) , a3 : ( xz + wy ) , a4 : 0.0 , b1 : ( xy + wz ) , b2 : 1. - ( xx + zz ) , b3 : ( yz - wx ) , b4 : 0.0 , c1 : ( xz - wy ) , c2 : ( yz + wx ) , c3 : 1. - ( xx + yy ) , c4 : 0.0 , d1 : 0.0 , d2 : 0.0 , d3 : 0.0 , d4 : 1.0 , } }
Create a rotation matrix from this quaternion
Create a rotation matrix from this quaternion
&self
&self