Deprecate into_owned and clone_owned for Quaternion, UnitQuaternion, and Transform.
This commit is contained in:
parent
70bb2cbe46
commit
e84b73c848
@ -250,7 +250,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clones this matrix into one that owns its data.
|
/// Clones this matrix to one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn clone_owned(&self) -> MatrixMN<N, R, C>
|
pub fn clone_owned(&self) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
|
@ -105,7 +105,7 @@ pub unsafe trait Storage<N: Scalar, R: Dim, C: Dim = U1>: Debug + Sized {
|
|||||||
fn into_owned(self) -> Owned<N, R, C>
|
fn into_owned(self) -> Owned<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C>;
|
where DefaultAllocator: Allocator<N, R, C>;
|
||||||
|
|
||||||
/// Clones this data storage into one that does not contain any reference.
|
/// Clones this data storage to one that does not contain any reference.
|
||||||
fn clone_owned(&self) -> Owned<N, R, C>
|
fn clone_owned(&self) -> Owned<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C>;
|
where DefaultAllocator: Allocator<N, R, C>;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,14 @@ where Owned<N, U4>: serde::Deserialize<'a> {
|
|||||||
impl<N: Real> Quaternion<N> {
|
impl<N: Real> Quaternion<N> {
|
||||||
/// Moves this unit quaternion into one that owns its data.
|
/// Moves this unit quaternion into one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[deprecated(note = "This method is a no-op and will be removed in a future release.")]
|
||||||
pub fn into_owned(self) -> Quaternion<N> {
|
pub fn into_owned(self) -> Quaternion<N> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clones this unit quaternion into one that owns its data.
|
/// Clones this unit quaternion into one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[deprecated(note = "This method is a no-op and will be removed in a future release.")]
|
||||||
pub fn clone_owned(&self) -> Quaternion<N> {
|
pub fn clone_owned(&self) -> Quaternion<N> {
|
||||||
Quaternion::from_vector(self.coords.clone_owned())
|
Quaternion::from_vector(self.coords.clone_owned())
|
||||||
}
|
}
|
||||||
@ -153,7 +155,7 @@ impl<N: Real> Quaternion<N> {
|
|||||||
/// Returns, from left to right: the quaternion norm, the half rotation angle, the rotation
|
/// Returns, from left to right: the quaternion norm, the half rotation angle, the rotation
|
||||||
/// axis. If the rotation angle is zero, the rotation axis is set to `None`.
|
/// axis. If the rotation angle is zero, the rotation axis is set to `None`.
|
||||||
pub fn polar_decomposition(&self) -> (N, N, Option<Unit<Vector3<N>>>) {
|
pub fn polar_decomposition(&self) -> (N, N, Option<Unit<Vector3<N>>>) {
|
||||||
if let Some((q, n)) = Unit::try_new_and_get(self.clone_owned(), N::zero()) {
|
if let Some((q, n)) = Unit::try_new_and_get(*self, N::zero()) {
|
||||||
if let Some(axis) = Unit::try_new(self.vector().clone_owned(), N::zero()) {
|
if let Some(axis) = Unit::try_new(self.vector().clone_owned(), N::zero()) {
|
||||||
let angle = q.angle() / ::convert(2.0f64);
|
let angle = q.angle() / ::convert(2.0f64);
|
||||||
|
|
||||||
@ -292,14 +294,16 @@ pub type UnitQuaternion<N> = Unit<Quaternion<N>>;
|
|||||||
impl<N: Real> UnitQuaternion<N> {
|
impl<N: Real> UnitQuaternion<N> {
|
||||||
/// Moves this unit quaternion into one that owns its data.
|
/// Moves this unit quaternion into one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[deprecated(note = "This method is a no-op and will be removed in a future release.")]
|
||||||
pub fn into_owned(self) -> UnitQuaternion<N> {
|
pub fn into_owned(self) -> UnitQuaternion<N> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clones this unit quaternion into one that owns its data.
|
/// Clones this unit quaternion into one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[deprecated(note = "This method is a no-op and will be removed in a future release.")]
|
||||||
pub fn clone_owned(&self) -> UnitQuaternion<N> {
|
pub fn clone_owned(&self) -> UnitQuaternion<N> {
|
||||||
UnitQuaternion::new_unchecked(self.as_ref().clone_owned())
|
*self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The rotation angle in [0; pi] of this unit quaternion.
|
/// The rotation angle in [0; pi] of this unit quaternion.
|
||||||
@ -396,7 +400,7 @@ impl<N: Real> UnitQuaternion<N> {
|
|||||||
|
|
||||||
// self == other
|
// self == other
|
||||||
if c_hang.abs() >= N::one() {
|
if c_hang.abs() >= N::one() {
|
||||||
return Some(self.clone_owned())
|
return Some(*self)
|
||||||
}
|
}
|
||||||
|
|
||||||
let hang = c_hang.acos();
|
let hang = c_hang.acos();
|
||||||
|
@ -257,6 +257,7 @@ impl<N: Real, D: DimNameAdd<U1>, C: TCategory> Transform<N, D, C>
|
|||||||
|
|
||||||
/// Clones this transform into one that owns its data.
|
/// Clones this transform into one that owns its data.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[deprecated(note = "This method is a no-op and will be removed in a future release.")]
|
||||||
pub fn clone_owned(&self) -> Transform<N, D, C> {
|
pub fn clone_owned(&self) -> Transform<N, D, C> {
|
||||||
Transform::from_matrix_unchecked(self.matrix.clone_owned())
|
Transform::from_matrix_unchecked(self.matrix.clone_owned())
|
||||||
}
|
}
|
||||||
|
@ -304,8 +304,8 @@ md_impl_all!(
|
|||||||
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>, Output = Transform<N, D, CA::Representative>;
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>, Output = Transform<N, D, CA::Representative>;
|
||||||
[val val] => self * rhs.inverse();
|
[val val] => self * rhs.inverse();
|
||||||
[ref val] => self * rhs.inverse();
|
[ref val] => self * rhs.inverse();
|
||||||
[val ref] => self * rhs.clone_owned().inverse();
|
[val ref] => self * rhs.clone().inverse();
|
||||||
[ref ref] => self * rhs.clone_owned().inverse();
|
[ref ref] => self * rhs.clone().inverse();
|
||||||
);
|
);
|
||||||
|
|
||||||
// Transform ÷ Rotation
|
// Transform ÷ Rotation
|
||||||
@ -513,8 +513,8 @@ md_assign_impl_all!(
|
|||||||
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
||||||
for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>;
|
for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>;
|
||||||
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
|
||||||
[val] => *self *= rhs.clone_owned().inverse();
|
[val] => *self *= rhs.inverse();
|
||||||
[ref] => *self *= rhs.clone_owned().inverse();
|
[ref] => *self *= rhs.clone().inverse();
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user