forked from M-Labs/nalgebra
Merge pull request #585 from fusion-engineering-forks/pr-default
This commit is contained in:
commit
423b4b27b0
@ -48,6 +48,19 @@ where
|
|||||||
/// Renamed to [ArrayStorage].
|
/// Renamed to [ArrayStorage].
|
||||||
pub type MatrixArray<N, R, C> = ArrayStorage<N, R, C>;
|
pub type MatrixArray<N, R, C> = ArrayStorage<N, R, C>;
|
||||||
|
|
||||||
|
impl<N, R, C> Default for ArrayStorage<N, R, C>
|
||||||
|
where
|
||||||
|
R: DimName,
|
||||||
|
C: DimName,
|
||||||
|
R::Value: Mul<C::Value>,
|
||||||
|
Prod<R::Value, C::Value>: ArrayLength<N>,
|
||||||
|
N: Default,
|
||||||
|
{
|
||||||
|
fn default() -> Self {
|
||||||
|
ArrayStorage { data: Default::default() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<N, R, C> Hash for ArrayStorage<N, R, C>
|
impl<N, R, C> Hash for ArrayStorage<N, R, C>
|
||||||
where
|
where
|
||||||
N: Hash,
|
N: Hash,
|
||||||
|
@ -94,6 +94,21 @@ impl<N: Scalar, R: Dim, C: Dim, S: fmt::Debug> fmt::Debug for Matrix<N, R, C, S>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<N, R, C, S> Default for Matrix<N, R, C, S>
|
||||||
|
where
|
||||||
|
N: Scalar,
|
||||||
|
R: Dim,
|
||||||
|
C: Dim,
|
||||||
|
S: Default,
|
||||||
|
{
|
||||||
|
fn default() -> Self {
|
||||||
|
Matrix {
|
||||||
|
data: Default::default(),
|
||||||
|
_phantoms: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde-serialize")]
|
#[cfg(feature = "serde-serialize")]
|
||||||
impl<N, R, C, S> Serialize for Matrix<N, R, C, S>
|
impl<N, R, C, S> Serialize for Matrix<N, R, C, S>
|
||||||
where
|
where
|
||||||
|
@ -33,6 +33,14 @@ pub struct Quaternion<N: Scalar + SimdValue> {
|
|||||||
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: SimdRealField> Abomonation for Quaternion<N>
|
impl<N: SimdRealField> Abomonation for Quaternion<N>
|
||||||
where
|
where
|
||||||
@ -1536,6 +1544,12 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
Block a user