Merge pull request #932 from CAD97/moar-const
Remove scalar bound from geometry type defs
This commit is contained in:
commit
ac61e112dd
|
@ -38,14 +38,23 @@ use simba::scalar::{ClosedNeg, RealField};
|
||||||
/// If a feature that you need is missing, feel free to open an issue or a PR.
|
/// If a feature that you need is missing, feel free to open an issue or a PR.
|
||||||
/// See https://github.com/dimforge/nalgebra/issues/487
|
/// See https://github.com/dimforge/nalgebra/issues/487
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct DualQuaternion<T: Scalar> {
|
pub struct DualQuaternion<T> {
|
||||||
/// The real component of the quaternion
|
/// The real component of the quaternion
|
||||||
pub real: Quaternion<T>,
|
pub real: Quaternion<T>,
|
||||||
/// The dual component of the quaternion
|
/// The dual component of the quaternion
|
||||||
pub dual: Quaternion<T>,
|
pub dual: Quaternion<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Scalar + Eq> Eq for DualQuaternion<T> {}
|
||||||
|
|
||||||
|
impl<T: Scalar> PartialEq for DualQuaternion<T> {
|
||||||
|
#[inline]
|
||||||
|
fn eq(&self, right: &Self) -> bool {
|
||||||
|
self.real == right.real && self.dual == right.dual
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Scalar + Zero> Default for DualQuaternion<T> {
|
impl<T: Scalar + Zero> Default for DualQuaternion<T> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -60,15 +60,17 @@ use crate::geometry::{AbstractRotation, Point, Translation};
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
serde(bound(serialize = "R: Serialize,
|
serde(bound(serialize = "R: Serialize,
|
||||||
DefaultAllocator: Allocator<T, Const<D>>,
|
DefaultAllocator: Allocator<T, Const<D>>,
|
||||||
Owned<T, Const<D>>: Serialize"))
|
Owned<T, Const<D>>: Serialize,
|
||||||
|
T: Scalar"))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
serde(bound(deserialize = "R: Deserialize<'de>,
|
serde(bound(deserialize = "R: Deserialize<'de>,
|
||||||
DefaultAllocator: Allocator<T, Const<D>>,
|
DefaultAllocator: Allocator<T, Const<D>>,
|
||||||
Owned<T, Const<D>>: Deserialize<'de>"))
|
Owned<T, Const<D>>: Deserialize<'de>,
|
||||||
|
T: Scalar"))
|
||||||
)]
|
)]
|
||||||
pub struct Isometry<T: Scalar, R, const D: usize> {
|
pub struct Isometry<T, R, const D: usize> {
|
||||||
/// The pure rotational part of this isometry.
|
/// The pure rotational part of this isometry.
|
||||||
pub rotation: R,
|
pub rotation: R,
|
||||||
/// The pure translational part of this isometry.
|
/// The pure translational part of this isometry.
|
||||||
|
|
|
@ -18,7 +18,7 @@ use crate::base::{Matrix4, Vector, Vector3};
|
||||||
use crate::geometry::{Point3, Projective3};
|
use crate::geometry::{Point3, Projective3};
|
||||||
|
|
||||||
/// A 3D orthographic projection stored as a homogeneous 4x4 matrix.
|
/// A 3D orthographic projection stored as a homogeneous 4x4 matrix.
|
||||||
pub struct Orthographic3<T: RealField> {
|
pub struct Orthographic3<T> {
|
||||||
matrix: Matrix4<T>,
|
matrix: Matrix4<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,12 @@ use simba::scalar::RealField;
|
||||||
|
|
||||||
use crate::base::dimension::U3;
|
use crate::base::dimension::U3;
|
||||||
use crate::base::storage::Storage;
|
use crate::base::storage::Storage;
|
||||||
use crate::base::{Matrix4, Scalar, Vector, Vector3};
|
use crate::base::{Matrix4, Vector, Vector3};
|
||||||
|
|
||||||
use crate::geometry::{Point3, Projective3};
|
use crate::geometry::{Point3, Projective3};
|
||||||
|
|
||||||
/// A 3D perspective projection stored as a homogeneous 4x4 matrix.
|
/// A 3D perspective projection stored as a homogeneous 4x4 matrix.
|
||||||
pub struct Perspective3<T: Scalar> {
|
pub struct Perspective3<T> {
|
||||||
matrix: Matrix4<T>,
|
matrix: Matrix4<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint};
|
use crate::base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint};
|
||||||
use crate::base::{Const, Matrix, Scalar, Unit, Vector};
|
use crate::base::{Const, Matrix, Unit, Vector};
|
||||||
use crate::dimension::{Dim, U1};
|
use crate::dimension::{Dim, U1};
|
||||||
use crate::storage::{Storage, StorageMut};
|
use crate::storage::{Storage, StorageMut};
|
||||||
use simba::scalar::ComplexField;
|
use simba::scalar::ComplexField;
|
||||||
|
@ -7,7 +7,7 @@ use simba::scalar::ComplexField;
|
||||||
use crate::geometry::Point;
|
use crate::geometry::Point;
|
||||||
|
|
||||||
/// A reflection wrt. a plane.
|
/// A reflection wrt. a plane.
|
||||||
pub struct Reflection<T: Scalar, D: Dim, S: Storage<T, D>> {
|
pub struct Reflection<T, D, S> {
|
||||||
axis: Vector<T, D, S>,
|
axis: Vector<T, D, S>,
|
||||||
bias: T,
|
bias: T,
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ use crate::geometry::Point;
|
||||||
///
|
///
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Rotation<T: Scalar, const D: usize> {
|
pub struct Rotation<T, const D: usize> {
|
||||||
matrix: SMatrix<T, D, D>,
|
matrix: SMatrix<T, D, D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,19 +27,19 @@ use crate::geometry::{AbstractRotation, Isometry, Point, Translation};
|
||||||
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize-no-std", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
serde(bound(serialize = "T: Serialize,
|
serde(bound(serialize = "T: Scalar + Serialize,
|
||||||
R: Serialize,
|
R: Serialize,
|
||||||
DefaultAllocator: Allocator<T, Const<D>>,
|
DefaultAllocator: Allocator<T, Const<D>>,
|
||||||
Owned<T, Const<D>>: Serialize"))
|
Owned<T, Const<D>>: Serialize"))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serde-serialize-no-std",
|
feature = "serde-serialize-no-std",
|
||||||
serde(bound(deserialize = "T: Deserialize<'de>,
|
serde(bound(deserialize = "T: Scalar + Deserialize<'de>,
|
||||||
R: Deserialize<'de>,
|
R: Deserialize<'de>,
|
||||||
DefaultAllocator: Allocator<T, Const<D>>,
|
DefaultAllocator: Allocator<T, Const<D>>,
|
||||||
Owned<T, Const<D>>: Deserialize<'de>"))
|
Owned<T, Const<D>>: Deserialize<'de>"))
|
||||||
)]
|
)]
|
||||||
pub struct Similarity<T: Scalar, R, const D: usize> {
|
pub struct Similarity<T, R, const D: usize> {
|
||||||
/// The part of this similarity that does not include the scaling factor.
|
/// The part of this similarity that does not include the scaling factor.
|
||||||
pub isometry: Isometry<T, R, D>,
|
pub isometry: Isometry<T, R, D>,
|
||||||
scaling: T,
|
scaling: T,
|
||||||
|
|
Loading…
Reference in New Issue