Merge branch 'master-public' into dev
# Conflicts: # Cargo.toml # src/base/matrix.rs # src/geometry/quaternion.rs
This commit is contained in:
commit
ae4afa3d2c
@ -294,7 +294,8 @@ impl<N: Scalar + Ring, D: DimName, S: StorageMut<N, D, D>> SquareMatrix<N, D, S>
|
||||
{
|
||||
for i in 0..D::dim() {
|
||||
for j in 0..D::dim() - 1 {
|
||||
self[(j, i)] += shift[j] * self[(D::dim() - 1, i)];
|
||||
let add = shift[j] * self[(D::dim() - 1, i)];
|
||||
self[(j, i)] += add;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1594,6 +1594,19 @@ impl<N: Scalar + Zero + One + ClosedAdd + ClosedSub + ClosedMul, D: Dim, S: Stor
|
||||
|
||||
impl<N: ComplexField, D: Dim, S: Storage<N, D>> Unit<Vector<N, D, S>> {
|
||||
/// Computes the spherical linear interpolation between two unit vectors.
|
||||
///
|
||||
/// # Examples:
|
||||
///
|
||||
/// ```
|
||||
/// # use nalgebra::geometry::UnitQuaternion;
|
||||
///
|
||||
/// let q1 = UnitQuaternion::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
|
||||
/// let q2 = UnitQuaternion::from_euler_angles(-std::f32::consts::PI, 0.0, 0.0);
|
||||
///
|
||||
/// let q = q1.slerp(&q2, 1.0 / 3.0);
|
||||
///
|
||||
/// assert_eq!(q.euler_angles(), (std::f32::consts::FRAC_PI_2, 0.0, 0.0));
|
||||
/// ```
|
||||
pub fn slerp<S2: Storage<N, D>>(
|
||||
&self,
|
||||
rhs: &Unit<Vector<N, D, S2>>,
|
||||
|
@ -945,13 +945,7 @@ impl<N: RealField> UnitQuaternion<N> {
|
||||
#[inline]
|
||||
pub fn angle(&self) -> N {
|
||||
let w = self.quaternion().scalar().abs();
|
||||
|
||||
// Handle inaccuracies that make break `.acos`.
|
||||
if w >= N::one() {
|
||||
N::zero()
|
||||
} else {
|
||||
w.acos() * crate::convert(2.0f64)
|
||||
}
|
||||
self.quaternion().imag().norm().atan2(w) * crate::convert(2.0f64)
|
||||
}
|
||||
|
||||
/// The underlying quaternion.
|
||||
|
Loading…
Reference in New Issue
Block a user