38 #ifndef COAL_TRANSFORM_H
39 #define COAL_TRANSFORM_H
47 typedef Eigen::Quaternion<Scalar>
Quats;
49 static inline std::ostream& operator<<(std::ostream& o,
const Quats& q) {
50 o <<
"(" << q.w() <<
" " << q.x() <<
" " << q.y() <<
" " << q.z() <<
")";
71 template <
typename Matrixx3Like,
typename Vector3Like>
73 const Eigen::MatrixBase<Vector3Like>& T_)
77 template <
typename Vector3Like>
79 : R(q_.toRotationMatrix()), T(T_) {}
122 template <
typename Matrix3Like,
typename Vector3Like>
124 const Eigen::MatrixBase<Vector3Like>& T_) {
131 R = q_.toRotationMatrix();
136 template <
typename Derived>
142 template <
typename Derived>
151 template <
typename Derived>
157 template <
typename Derived>
159 return R.transpose() * (v - T);
164 R.transposeInPlace();
171 return Transform3s(R.transpose(), -R.transpose() * T);
176 return Transform3s(R.transpose() * other.R, R.transpose() * (other.T - T));
193 const Scalar& prec = Eigen::NumTraits<Scalar>::dummy_precision())
const {
194 return R.isIdentity(prec) && T.isZero(prec);
211 inline void setRandom();
219 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
222 template <
typename Derived>
225 return Quats(Eigen::AngleAxis<Scalar>(angle, axis));
237 const Scalar mult2 = std::sqrt(u1);
239 static const Scalar PI_value =
static_cast<Scalar>(EIGEN_PI);
240 Scalar s2 = std::sin(2 * PI_value * u2);
241 Scalar c2 = std::cos(2 * PI_value * u2);
242 Scalar s3 = std::sin(2 * PI_value * u3);
243 Scalar c3 = std::cos(2 * PI_value * u3);
263 basis.col(2) = vec.normalized();
264 basis.col(1) = -vec.unitOrthogonal();
265 basis.col(0) = basis.col(1).cross(vec);
#define COAL_DLLAPI
Definition: config.hh:88
#define COAL_DEPRECATED
Definition: deprecated.hh:37
Main namespace.
Definition: broadphase_bruteforce.h:44
Eigen::Quaternion< Scalar > Quats
Definition: transform.h:47
Quats uniformRandomQuaternion()
Uniformly random quaternion sphere. Code taken from Pinocchio (https://github.com/stack-of-tasks/pino...
Definition: transform.h:230
Matrix3s constructOrthonormalBasisFromVector(const Vec3s &vec)
Construct othonormal basis from vector. The z-axis is the normalized input vector.
Definition: transform.h:261
Eigen::Quaternion< Scalar > Quaternion3f
Definition: transform.h:46
Quats fromAxisAngle(const Eigen::MatrixBase< Derived > &axis, Scalar angle)
Definition: transform.h:223
Eigen::Matrix< Scalar, 3, 1 > Vec3s
Definition: data_types.h:70
double Scalar
Definition: data_types.h:68
Eigen::Matrix< Scalar, 3, 3 > Matrix3s
Definition: data_types.h:74