Implement Default for Quaternion and UnitQuaternion.
This commit is contained in:
parent
e6265da980
commit
85c931520a
|
@ -30,6 +30,14 @@ pub struct Quaternion<N: RealField> {
|
||||||
pub coords: Vector4<N>,
|
pub coords: Vector4<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<N: RealField> Default for Quaternion<N> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Quaternion {
|
||||||
|
coords: Vector4::zeros()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "abomonation-serialize")]
|
#[cfg(feature = "abomonation-serialize")]
|
||||||
impl<N: RealField> Abomonation for Quaternion<N>
|
impl<N: RealField> Abomonation for Quaternion<N>
|
||||||
where Vector4<N>: Abomonation
|
where Vector4<N>: Abomonation
|
||||||
|
@ -1422,6 +1430,12 @@ impl<N: RealField> UnitQuaternion<N> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<N: RealField> Default for UnitQuaternion<N> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::identity()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<N: RealField + fmt::Display> fmt::Display for UnitQuaternion<N> {
|
impl<N: RealField + fmt::Display> fmt::Display for UnitQuaternion<N> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
if let Some(axis) = self.axis() {
|
if let Some(axis) = self.axis() {
|
||||||
|
|
Loading…
Reference in New Issue