2017-08-03 01:37:44 +08:00
|
|
|
use num::One;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
use alga::general::Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-05-19 23:15:15 +08:00
|
|
|
use base::{DefaultAllocator, MatrixN};
|
|
|
|
use base::dimension::{DimNameAdd, DimNameSum, U1};
|
|
|
|
use base::allocator::Allocator;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
use geometry::{TCategory, Transform};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
impl<N: Real, D: DimNameAdd<U1>, C: TCategory> Transform<N, D, C>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
|
|
|
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
/// Creates a new identity transform.
|
|
|
|
#[inline]
|
|
|
|
pub fn identity() -> Self {
|
2017-08-03 01:37:44 +08:00
|
|
|
Self::from_matrix_unchecked(MatrixN::<_, DimNameSum<D, U1>>::identity())
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
impl<N: Real, D: DimNameAdd<U1>, C: TCategory> One for Transform<N, D, C>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
|
|
|
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
/// Creates a new identity transform.
|
|
|
|
#[inline]
|
|
|
|
fn one() -> Self {
|
|
|
|
Self::identity()
|
|
|
|
}
|
|
|
|
}
|