added docs to slerp and powf for Rotation
This commit is contained in:
parent
7a458cda32
commit
7a43827bb7
@ -89,11 +89,26 @@ impl<T:RealField, const D: usize> Rotation<T,D> where
|
||||
Allocator<T,DimDiff<Const<D>,U1>>
|
||||
{
|
||||
|
||||
///
|
||||
/// Computes the spherical linear interpolation between two general rotations.
|
||||
///
|
||||
/// # Examples:
|
||||
///
|
||||
/// ```
|
||||
/// # use nalgebra::geometry::Rotation3;
|
||||
///
|
||||
/// let q1 = Rotation3::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
|
||||
/// let q2 = Rotation3::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));
|
||||
/// ```
|
||||
///
|
||||
//FIXME: merging slerp for Rotation2 and Rotation3 into this raises the trait bounds
|
||||
//from SimdRealField to RealField
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[warn(missing_docs)]
|
||||
pub fn slerp(&self, other: &Self, t:T) -> Self {
|
||||
|
||||
use std::mem::transmute;
|
||||
|
@ -1010,8 +1010,24 @@ where
|
||||
impl<T:RealField, const D: usize> Rotation<T,D>
|
||||
{
|
||||
|
||||
///
|
||||
/// Raise the rotation to a given floating power, i.e., returns the rotation with the same
|
||||
/// axis as `self` and an angle equal to `self.angle()` multiplied by `n`.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # #[macro_use] extern crate approx;
|
||||
/// # use nalgebra::{Rotation3, Vector3, Unit};
|
||||
///
|
||||
/// let axis = Unit::new_normalize(Vector3::new(1.0, 2.0, 3.0));
|
||||
/// let angle = 1.2;
|
||||
/// let rot = Rotation3::from_axis_angle(&axis, angle);
|
||||
/// let pow = rot.powf(2.0);
|
||||
///
|
||||
/// assert_relative_eq!(pow.axis().unwrap(), axis, epsilon = 1.0e-6);
|
||||
/// assert_eq!(pow.angle(), 2.4);
|
||||
/// ```
|
||||
//FIXME: merging powf for Rotation2 into this raises the trait bounds from SimdRealField to RealField
|
||||
#[warn(missing_docs)]
|
||||
pub fn powf(&self, t: T) -> Self where
|
||||
Const<D>: DimSub<U1>,
|
||||
ArrayStorage<T,D,D>: Storage<T,Const<D>,Const<D>>,
|
||||
|
Loading…
Reference in New Issue
Block a user