Main MRPT website > C++ reference for MRPT 1.9.9
slerp.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "math-precomp.h" // Precompiled headers
11 
12 #include <mrpt/math/slerp.h>
13 
14 using namespace mrpt;
15 using namespace mrpt::math;
16 
18  const TPose3D& p0, const TPose3D& p1, const double t, TPose3D& p)
19 {
20  CQuaternionDouble q0, q1, q;
21  p0.getAsQuaternion(q0);
22  p1.getAsQuaternion(q1);
23  // The quaternion part (this will raise exception on t not in [0,1])
24  mrpt::math::slerp(q0, q1, t, q);
25  q.rpy(p.roll, p.pitch, p.yaw);
26  // XYZ:
27  p.x = (1 - t) * p0.x + t * p1.x;
28  p.y = (1 - t) * p0.y + t * p1.y;
29  p.z = (1 - t) * p0.z + t * p1.z;
30 }
31 
33  const mrpt::math::TPose3D& q0, const mrpt::math::TPose3D& q1,
34  const double t, mrpt::math::TPose3D& p)
35 {
38  q0.getAsQuaternion(quat0);
39  q1.getAsQuaternion(quat1);
40  mrpt::math::slerp(quat0, quat1, t, q);
41 
42  p.x = p.y = p.z = 0;
43  q.rpy(p.roll, p.pitch, p.yaw);
44 }
q
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:3721
t
GLdouble GLdouble t
Definition: glext.h:3689
math-precomp.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::math::TPose3D::y
double y
Definition: lightweight_geom_data.h:610
p
GLfloat GLfloat p
Definition: glext.h:6305
mrpt::math::slerp
void slerp(const CQuaternion< T > &q0, const CQuaternion< T > &q1, const double t, CQuaternion< T > &q)
SLERP interpolation between two quaternions.
Definition: slerp.h:34
mrpt::math::TPose3D::getAsQuaternion
void getAsQuaternion(mrpt::math::CQuaternion< double > &q, mrpt::math::CMatrixFixedNumeric< double, 4, 3 > *out_dq_dr=NULL) const
Returns the quaternion associated to the rotation of this object (NOTE: XYZ translation is ignored)
Definition: lightweight_geom_data.cpp:220
mrpt::math::TPose3D::z
double z
Definition: lightweight_geom_data.h:610
slerp.h
mrpt::math::TPose3D::x
double x
X,Y,Z, coords.
Definition: lightweight_geom_data.h:610
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: lightweight_geom_data.h:603
mrpt::math::CQuaternion
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
Definition: CQuaternion.h:46
mrpt::math::slerp_ypr
void slerp_ypr(const mrpt::math::TPose3D &q0, const mrpt::math::TPose3D &q1, const double t, mrpt::math::TPose3D &p)
Definition: slerp.cpp:32
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:13
mrpt::math::UNINITIALIZED_QUATERNION
@ UNINITIALIZED_QUATERNION
Definition: CQuaternion.h:24



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST