nalgebra/src/geometry/transform_construction.rs

32 lines
797 B
Rust
Raw Normal View History

use num::One;
use alga::general::Real;
use base::{DefaultAllocator, MatrixN};
use base::dimension::{DimNameAdd, DimNameSum, U1};
use base::allocator::Allocator;
2018-02-02 19:26:35 +08:00
use geometry::{TCategory, Transform};
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>>,
{
/// Creates a new identity transform.
#[inline]
pub fn identity() -> Self {
Self::from_matrix_unchecked(MatrixN::<_, DimNameSum<D, U1>>::identity())
}
}
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>>,
{
/// Creates a new identity transform.
#[inline]
fn one() -> Self {
Self::identity()
}
}