Ocean
Loading...
Searching...
No Matches
Rotation.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MATH_ROTATION_H
9#define META_OCEAN_MATH_ROTATION_H
10
11#include "ocean/math/Math.h"
12#include "ocean/math/Euler.h"
13#include "ocean/math/Numeric.h"
16
17namespace Ocean
18{
19
20// Forward declaration.
21template <typename T> class HomogenousMatrixT4;
22// Forward declaration.
23template <typename T> class RotationT;
24// Forward declaration.
25template <typename T> class SquareMatrixT3;
26
27/**
28 * Definition of the Rotation object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag either with single or double precision float data type.
29 * @see RotationT
30 * @ingroup math
31 */
33
34/**
35 * Instantiation of the RotationT template class using a double precision float data type.
36 * @see RotationT
37 * @ingroup math
38 */
40
41/**
42 * Instantiation of the RotationT template class using a single precision float data type.
43 * @see RotationT
44 * @ingroup math
45 */
47
48/**
49 * Definition of a typename alias for vectors with RotationT objects.
50 * @see RotationT
51 * @ingroup math
52 */
53template <typename T>
54using RotationsT = std::vector<RotationT<T>>;
55
56/**
57 * Definition of a vector holding rotation objects.
58 * @see Rotation
59 * @ingroup math
60 */
61using Rotations = std::vector<Rotation>;
62
63/**
64 * This class implements a axis-angle rotation using floating point values.
65 * The angle is defined in radian [0, 2*PI).<br>
66 * The four elements are stored with order: (x, y, z, angle).
67 * @tparam T Data type used to represent axis and angle
68 * @see Rotation, RotationF, RotationD, Quaternion, Euler, SquareMatrix3, ExponentialMap.
69 * @ingroup math
70 */
71template <typename T>
73{
74 public:
75
76 /**
77 * Definition of the used data type.
78 */
79 using Type = T;
80
81 public:
82
83 /**
84 * Creates a rotation object with default values so that the rotation represents the identity rotation.
85 * The axis will be set to (0, 1, 0) and the angle to 0.
86 */
87 RotationT() = default;
88
89 /**
90 * Creates a rotation object by four given values.
91 * The axis must be a unit vector with length 1.
92 * @param x X value of the rotation axis
93 * @param y Y value of the rotation axis
94 * @param z Z value of the rotation axis
95 * @param angle The angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)
96 */
97 RotationT(const T x, const T y, const T z, const T angle);
98
99 /**
100 * Creates a rotation object by an axis and the angle.
101 * @param axis The axis of the rotation with length 1
102 * @param angle The angle of the rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)
103 */
104 RotationT(const VectorT3<T>& axis, const T angle);
105
106 /**
107 * Creates a rotation object based on two given unit vectors.
108 * The resulting rotation defines a transformation that rotates that reference vector into the offset vector: Rotation(reference, offset) = offset_R_reference.<br>
109 * The following equation holds:
110 * <pre>
111 * offset = Rotation(reference, offset) * reference.
112 * </pre>
113 * @param reference The reference vector, with length 1
114 * @param offset The offset vector, with length 1
115 */
116 RotationT(const VectorT3<T>& reference, const VectorT3<T>& offset);
117
118 /**
119 * Creates a rotation object by a given quaternion rotation.
120 * @param quaternion the quaternion rotation to create an axis-angle rotation from, must be valid
121 */
122 explicit RotationT(const QuaternionT<T>& quaternion);
123
124 /**
125 * Creates an angle-axis rotation by a given euler rotation.
126 * @param euler Euler rotation to create a angle-axis rotation from, must be valid
127 */
128 explicit RotationT(const EulerT<T>& euler);
129
130 /**
131 * Creates a rotation object by a given 3x3 rotation matrix.
132 * Beware: Ensure that the provided matrix does not contain any scale.
133 * @param matrix Rotation matrix to create a axis-angle rotation from, with determinant 1
134 */
135 explicit RotationT(const SquareMatrixT3<T>& matrix);
136
137 /**
138 * Creates a rotation object by a given 4x4 transformation matrix.
139 * @param transformation The transformation matrix to create a axis-angle rotation from, must be valid
140 */
141 explicit RotationT(const HomogenousMatrixT4<T>& transformation);
142
143 /**
144 * Creates a rotation object by an array with four elements.
145 * The element order in the array has to be: (x, y, z, angle).<br>
146 * The axis must have length 1, the angle is provided as radian with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)
147 * @param valueArray Array with four elements
148 */
149 explicit RotationT(const T* valueArray);
150
151 /**
152 * Sets the axis of the rotation.
153 * @param axis The axis with length 1
154 */
155 void setAxis(const VectorT3<T>& axis);
156
157 /**
158 * Sets the angle of the rotation.
159 * @param angle The angle of rotation in radian, with range (-infinity, infinity), however will be converted to the range [0.0, 2 * PI)
160 */
161 void setAngle(const T angle);
162
163 /**
164 * Returns a pointer to the internal values.
165 * @return Pointer to the internal values
166 */
167 inline const T* data() const;
168
169 /**
170 * Returns a pointer to the internal values.
171 * @return Pointer to the internal values
172 */
173 inline T* data();
174
175 /**
176 * Returns the axis of the rotation.
177 * @return Rotation axis with unit length if the rotation is valid
178 */
179 inline VectorT3<T> axis() const;
180
181 /**
182 * Returns the angle of the rotation.
183 * @return Rotation angle in radian, with range [0.0, 2 * PI)
184 */
185 inline T angle() const;
186
187 /**
188 * Returns the inverted rotation, this rotation must be valid.
189 * @return Inverted rotation
190 * @see isValid(), invert().
191 */
192 [[nodiscard]] RotationT inverted() const;
193
194 /**
195 * Inverts this rotation, this rotation must be valid.
196 * @see isValid(), inverted().
197 */
198 void invert();
199
200 /**
201 * Returns whether this rotation has valid parameters.
202 * @return True, if so
203 */
204 bool isValid() const;
205
206 /**
207 * Returns whether two rotations are equal up to a specified epsilon.
208 * @param rotation The second rotation to compare
209 * @param eps Epsilon to be used, with range [0, infinity)
210 * @return True, if so
211 */
212 inline bool isEqual(const RotationT<T>& rotation, const T eps = NumericT<T>::eps()) const;
213
214 /**
215 * Returns whether two rotations are identical up to a small epsilon.
216 * @param right The right operand
217 * @return True, if so
218 */
219 bool operator==(const RotationT<T>& right) const;
220
221 /**
222 * Returns whether two rotations are not identical up to a small epsilon.
223 * @param right The right operand
224 * @return True, if so
225 */
226 inline bool operator!=(const RotationT<T>& right) const;
227
228 /**
229 * Returns the inverse rotation, this rotation must be valid.
230 * @return Inverse rotation
231 */
232 RotationT operator-() const;
233
234 /**
235 * Multiplies two rotations, this rotation must be valid.
236 * @param quaternion The right rotation as unit quaternion, must be valid
237 * @return Resulting rotation
238 */
239 RotationT operator*(const QuaternionT<T>& quaternion) const;
240
241 /**
242 * Multiplies and assign two rotations, this rotation must be valid.
243 * @param quaternion The right rotation as unit quaternion, must be valid
244 * @return Reference to this rotation
245 */
246 RotationT& operator*=(const QuaternionT<T>& quaternion);
247
248 /**
249 * Multiplies two rotations, this rotation must be valid.
250 * @param right The right rotation to multiply, must be valid
251 * @return Resulting rotation
252 */
253 RotationT operator*(const RotationT<T>& right) const;
254
255 /**
256 * Multiplies and assign two rotations, this rotation must be valid.
257 * @param right The right rotation to multiply, must be valid
258 * @return Reference to this rotation
259 */
260 RotationT& operator*=(const RotationT<T>& right);
261
262 /**
263 * Rotates a 3D vector with this rotation, this rotation must be valid.
264 * @param vector The vector to rotate
265 * @return Rotated vector
266 */
267 VectorT3<T> operator*(const VectorT3<T>& vector) const;
268
269 /**
270 * Element access operator.
271 * @param index The index of the element to return, with range [0, 3]
272 * @return Internal element
273 */
274 inline T operator()(unsigned int index) const;
275
276 /**
277 * Element access operator.
278 * @param index The index of the element to return, with range [0, 3]
279 * @return Internal element
280 */
281 inline T& operator()(unsigned int index);
282
283 /**
284 * Element access operator.
285 * @param index The index of the element to return, with range [0, 3]
286 * @return Internal element
287 */
288 inline T operator[](unsigned int index) const;
289
290 /**
291 * Element access operator.
292 * @param index The index of the element to return, with range [0, 3]
293 * @return Internal element
294 */
295 inline T& operator[](unsigned int index);
296
297 /**
298 * Access operator.
299 * @return Pointer to the internal elements.
300 */
301 inline const T* operator()() const;
302
303 /**
304 * Access operator.
305 * @return Pointer to the internal elements.
306 */
307 inline T* operator()();
308
309 /**
310 * Returns a rotation object based on two given unit vectors.
311 * The resulting rotation rotates the right vector to the left vector:
312 * <pre>
313 * left = Rotation::left_R_right(left, right) * right;
314 * </pre>
315 * @param left The left unit vector
316 * @param right The right unit vector
317 * @return The resulting rotation rotating the right vector to the left vector
318 */
319 static RotationT<T> left_R_right(const VectorT3<T>& left, const VectorT3<T>& right);
320
321 protected:
322
323 /// The four values of the angle-axis rotation.
324 T values_[4] = {T(0), T(1), T(0), T(0)};
325};
326
327template <typename T>
328RotationT<T>::RotationT(const T x, const T y, const T z, const T angle)
329{
330 values_[0] = x;
331 values_[1] = y;
332 values_[2] = z;
333
334 values_[3] = NumericT<T>::angleAdjustPositive(angle);
335
336 ocean_assert(isValid());
337}
338
339template <typename T>
340RotationT<T>::RotationT(const VectorT3<T>& axis, const T angle) :
341 RotationT<T>(axis.x(), axis.y(), axis.z(), angle)
342{
343 // nothing to do here
344}
345
346template <typename T>
347RotationT<T>::RotationT(const VectorT3<T>& reference, const VectorT3<T>& offset) :
348 RotationT<T>(left_R_right(offset, reference))
349{
350 // nothing to do here
351}
352
353template <typename T>
355{
356 ocean_assert(quaternion.isValid());
357
358 const T invFactor = NumericT<T>::sqrt(T(1.0) - quaternion.w() * quaternion.w());
359
360 if (NumericT<T>::isEqualEps(invFactor))
361 {
362 values_[0] = T(0.0);
363 values_[1] = T(1.0);
364 values_[2] = T(0.0);
365 values_[3] = T(0.0);
366
367 return;
368 }
369
370 const T factor = T(1.0) / invFactor;
371
372 VectorT3<T> axis(quaternion.x() * factor, quaternion.y() * factor, quaternion.z() * factor);
373 axis.normalize();
374
375 values_[0] = axis[0];
376 values_[1] = axis[1];
377 values_[2] = axis[2];
378
379 values_[3] = T(2.0) * NumericT<T>::acos(quaternion.w());
380
381 ocean_assert(isValid());
382}
383
384template <typename T>
386{
387 ocean_assert(euler.isValid());
388
389 *this = RotationT(QuaternionT<T>(euler));
390 ocean_assert(isValid());
391}
392
393template <typename T>
395{
396 const T cosValue = (matrix.trace() - T(1.0)) * T(0.5);
397
398 if (NumericT<T>::isInsideRange(T(-1.0), cosValue, T(1.0)) == false)
399 {
400 ocean_assert(false && "Invalid rotation matrix, containing scale.");
401 }
402
403 if (NumericT<T>::isEqual(cosValue, T(1.0)))
404 {
405 values_[0] = T(0.0);
406 values_[1] = T(1.0);
407 values_[2] = T(0.0);
408 values_[3] = T(0.0);
409 }
410 else
411 {
412 VectorT3<T> axis;
413
414 if (NumericT<T>::isEqual(cosValue, T(-1.0)))
415 {
416 unsigned int select = 0;
417 T maximum = matrix(0, 0);
418
419 if (maximum < matrix(1, 1))
420 {
421 select = 1;
422 maximum = matrix(1, 1);
423 }
424 if (maximum < matrix(2, 2))
425 {
426 select = 2;
427 }
428
429 switch (select)
430 {
431 case 0:
432 {
433 axis(0) = T(0.5) * NumericT<T>::sqrt(matrix(0, 0) - matrix(1, 1) - matrix(2, 2) + T(1.0));
434 T factor = T(0.5) / axis(0);
435
436 axis(1) = matrix(0, 1) * factor;
437 axis(2) = matrix(0, 2) * factor;
438 break;
439 }
440
441 case 1:
442 {
443 axis(1) = T(0.5) * NumericT<T>::sqrt(matrix(1, 1) - matrix(0, 0) - matrix(2, 2) + T(1.0));
444 T factor = T(0.5) / axis(1);
445
446 axis(0) = matrix(0, 1) * factor;
447 axis(2) = matrix(1, 2) * factor;
448 break;
449 }
450
451 case 2:
452 {
453 axis(2) = T(0.5) * NumericT<T>::sqrt(matrix(2, 2) - matrix(0, 0) - matrix(1, 1) + T(1.0));
454 T factor = T(0.5) / axis(2);
455
456 axis(0) = matrix(0, 2) * factor;
457 axis(1) = matrix(1, 2) * factor;
458 break;
459 }
460
461 default:
462 ocean_assert(false);
463 break;
464 }
465
466 values_[3] = NumericT<T>::pi();
467 }
468 else
469 {
470 axis = VectorT3<T>(matrix(2, 1) - matrix(1, 2), matrix(0, 2) - matrix(2, 0), matrix(1, 0) - matrix(0, 1));
471 values_[3] = NumericT<T>::acos(cosValue);
472 }
473
474 axis.normalize();
475
476 values_[0] = axis(0);
477 values_[1] = axis(1);
478 values_[2] = axis(2);
479 }
480
481 ocean_assert(isValid());
482}
483
484template <typename T>
486{
487 ocean_assert(transformation.isValid());
488
489 const SquareMatrixT3<T> matrix(transformation.orthonormalRotationMatrix());
490 ocean_assert(NumericT<T>::isEqual(matrix.determinant(), T(1.0)));
491
492 *this = RotationT<T>(matrix);
493}
494
495template <typename T>
496RotationT<T>::RotationT(const T* valueArray)
497{
498 ocean_assert(valueArray != nullptr);
499
500 values_[0] = valueArray[0];
501 values_[1] = valueArray[1];
502 values_[2] = valueArray[2];
503
504 values_[3] = NumericT<T>::angleAdjustPositive(valueArray[3]);
505
506 ocean_assert(isValid());
507}
508
509template <typename T>
511{
512 ocean_assert(axis.isUnit());
513
514 values_[0] = axis[0];
515 values_[1] = axis[1];
516 values_[2] = axis[2];
517
518 ocean_assert(isValid());
519}
520
521template <typename T>
522void RotationT<T>::setAngle(const T angle)
523{
524 values_[3] = NumericT<T>::angleAdjustPositive(angle);
525
526 ocean_assert(isValid());
527}
528
529template <typename T>
531{
532 ocean_assert(isValid());
533 return RotationT<T>(-values_[0], -values_[1], -values_[2], values_[3]);
534}
535
536template <typename T>
538{
539 ocean_assert(isValid());
540
541 values_[0] = -values_[0];
542 values_[1] = -values_[1];
543 values_[2] = -values_[2];
544}
545
546template <typename T>
548{
549 return axis().isUnit() && NumericT<T>::isInsideRange(T(0.0), angle(), NumericT<T>::pi2());
550}
551
552template <typename T>
553inline bool RotationT<T>::isEqual(const RotationT<T>& rotation, const T eps) const
554{
555 ocean_assert(isValid() && rotation.isValid());
556 ocean_assert(eps >= T(0.0));
557
558 return (NumericT<T>::isEqual(values_[0], rotation.values_[0], eps) && NumericT<T>::isEqual(values_[1], rotation.values_[1], eps) && NumericT<T>::isEqual(values_[2], rotation.values_[2], eps) && NumericT<T>::isEqual(values_[3], rotation.values_[3], eps))
559 || (NumericT<T>::isEqual(values_[0], -rotation.values_[0], eps) && NumericT<T>::isEqual(values_[1], -rotation.values_[1], eps) && NumericT<T>::isEqual(values_[2], -rotation.values_[2], eps) && NumericT<T>::angleIsEqual(values_[3] + rotation.values_[3], NumericT<T>::pi2(), eps));
560}
561
562template <typename T>
564{
565 ocean_assert(isValid() && right.isValid());
566
567 return isEqual(right);
568}
569
570template <typename T>
572{
573 ocean_assert(isValid());
574
575 return RotationT<T>(-values_[0], -values_[1], -values_[2], values_[3]);
576}
577
578template <typename T>
580{
581 ocean_assert(isValid() && quaternion.isValid());
582
583 const QuaternionT<T> result(QuaternionT<T>(*this) * quaternion);
584
585 return RotationT<T>(result.normalized());
586}
587
588template <typename T>
590{
591 ocean_assert(isValid() && quaternion.isValid());
592
593 const QuaternionT<T> result(QuaternionT<T>(*this) * quaternion);
594
595 *this = RotationT<T>(result.normalized());
596
597 return *this;
598}
599
600template <typename T>
602{
603 ocean_assert(isValid() && right.isValid());
604
605 const QuaternionT<T> result(QuaternionT<T>(*this) * QuaternionT<T>(right));
606
607 return RotationT<T>(result.normalized());
608}
609
610template <typename T>
612{
613 ocean_assert(isValid() && right.isValid());
614
615 const QuaternionT<T> result(QuaternionT<T>(*this) * QuaternionT<T>(right));
616
617 *this = RotationT<T>(result.normalized());
618
619 return *this;
620}
621
622template <typename T>
624{
625 ocean_assert(isValid());
626
627 return QuaternionT<T>(*this) * vector;
628}
629
630template <typename T>
631inline const T* RotationT<T>::data() const
632{
633 return values_;
634}
635
636template <typename T>
638{
639 return values_;
640}
641
642template <typename T>
644{
645 return VectorT3<T>(values_);
646}
647
648template <typename T>
649inline T RotationT<T>::angle() const
650{
651 return values_[3];
652}
653
654template <typename T>
655inline bool RotationT<T>::operator!=(const RotationT& right) const
656{
657 return !(*this == right);
658}
659
660template <typename T>
661inline T RotationT<T>::operator()(unsigned int index) const
662{
663 ocean_assert(index < 4u);
664
665 return values_[index];
666}
667
668template <typename T>
669inline T& RotationT<T>::operator()(unsigned int index)
670{
671 ocean_assert(index < 4u);
672
673 return values_[index];
674}
675
676template <typename T>
677inline T RotationT<T>::operator[](unsigned int index) const
678{
679 ocean_assert(index < 4u);
680
681 return values_[index];
682}
683
684template <typename T>
685inline T& RotationT<T>::operator[](unsigned int index)
686{
687 ocean_assert(index < 4u);
688
689 return values_[index];
690}
691
692template <typename T>
693inline const T* RotationT<T>::operator()() const
694{
695 return values_;
696}
697
698template <typename T>
700{
701 return values_;
702}
703
704template <typename T>
706{
707 ocean_assert(left.isUnit(NumericT<T>::weakEps()));
708 ocean_assert(right.isUnit(NumericT<T>::weakEps()));
709
710 if (left == right)
711 {
712 // identity
713
714 return RotationT<T>(VectorT3<T>(0, 1, 0), T(0));
715 }
716 else if (left == -right)
717 {
718 const VectorT3<T> perpendicular(right.perpendicular().normalized());
719
720 return RotationT<T>(perpendicular, NumericT<T>::pi());
721 }
722
723 const VectorT3<T> axis(right.cross(left).normalized());
724 const T angle = right.angle(left);
725
726 const RotationT<T> result(axis, angle);
727 ocean_assert(result.isValid());
728
729 return result;
730}
731
732}
733
734#endif // META_OCEAN_MATH_ROTATION_H
This class implements an euler rotation with angles: yaw, pitch and roll.
Definition Euler.h:82
bool isValid() const
Returns whether the euler rotation holds valid parameters.
Definition Euler.h:360
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition HomogenousMatrix4.h:110
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition HomogenousMatrix4.h:1806
SquareMatrixT3< T > orthonormalRotationMatrix() const
Returns the 3x3 orthonormal rotation matrix of the 4x4 transformation (by forcing a orthogonal and no...
Definition HomogenousMatrix4.h:1538
This class provides basic numeric functionalities.
Definition Numeric.h:57
static T angleAdjustPositive(const T angle)
Adjusts an arbitrary angle into the range of [0.0, 2PI).
Definition Numeric.h:1770
static constexpr bool isInsideRange(const T lower, const T value, const T upper, const T epsilon=NumericT< T >::eps())
Returns whether a value lies between a given range up to a provided epsilon border.
Definition Numeric.h:2881
static constexpr T pi()
Returns PI which is equivalent to 180 degree.
Definition Numeric.h:926
static T sqrt(const T value)
Returns the square root of a given value.
Definition Numeric.h:1537
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2395
static bool angleIsEqual(const T angleA, const T angleB)
Returns whether two angles represent the same angle up to a small epsilon.
Definition Numeric.h:1825
static T acos(const T value)
Returns the arccosine of a given value.
Definition Numeric.h:2916
This class implements a unit quaternion rotation.
Definition Quaternion.h:100
const T & x() const
Returns the x value of the quaternion.
Definition Quaternion.h:900
bool isValid() const
Returns whether this quaternion is a valid unit quaternion.
Definition Quaternion.h:882
const T & w() const
Returns the w value of the quaternion.
Definition Quaternion.h:888
QuaternionT< T > normalized() const
Returns the normalized quaternion.
Definition Quaternion.h:682
const T & y() const
Returns the y value of the quaternion.
Definition Quaternion.h:912
const T & z() const
Returns the z value of the quaternion.
Definition Quaternion.h:924
This class implements a axis-angle rotation using floating point values.
Definition Rotation.h:73
RotationT()=default
Creates a rotation object with default values so that the rotation represents the identity rotation.
static RotationT< T > left_R_right(const VectorT3< T > &left, const VectorT3< T > &right)
Returns a rotation object based on two given unit vectors.
Definition Rotation.h:705
bool isEqual(const RotationT< T > &rotation, const T eps=NumericT< T >::eps()) const
Returns whether two rotations are equal up to a specified epsilon.
Definition Rotation.h:553
bool operator!=(const RotationT< T > &right) const
Returns whether two rotations are not identical up to a small epsilon.
Definition Rotation.h:655
bool operator==(const RotationT< T > &right) const
Returns whether two rotations are identical up to a small epsilon.
Definition Rotation.h:563
RotationT inverted() const
Returns the inverted rotation, this rotation must be valid.
Definition Rotation.h:530
VectorT3< T > axis() const
Returns the axis of the rotation.
Definition Rotation.h:643
const T * operator()() const
Access operator.
Definition Rotation.h:693
RotationT operator-() const
Returns the inverse rotation, this rotation must be valid.
Definition Rotation.h:571
void invert()
Inverts this rotation, this rotation must be valid.
Definition Rotation.h:537
T angle() const
Returns the angle of the rotation.
Definition Rotation.h:649
T Type
Definition of the used data type.
Definition Rotation.h:79
T operator[](unsigned int index) const
Element access operator.
Definition Rotation.h:677
void setAxis(const VectorT3< T > &axis)
Sets the axis of the rotation.
Definition Rotation.h:510
T values_[4]
The four values of the angle-axis rotation.
Definition Rotation.h:324
RotationT & operator*=(const QuaternionT< T > &quaternion)
Multiplies and assign two rotations, this rotation must be valid.
Definition Rotation.h:589
RotationT operator*(const QuaternionT< T > &quaternion) const
Multiplies two rotations, this rotation must be valid.
Definition Rotation.h:579
void setAngle(const T angle)
Sets the angle of the rotation.
Definition Rotation.h:522
const T * data() const
Returns a pointer to the internal values.
Definition Rotation.h:631
bool isValid() const
Returns whether this rotation has valid parameters.
Definition Rotation.h:547
This class implements a 3x3 square matrix.
Definition SquareMatrix3.h:89
T determinant() const
Returns the determinant of the matrix.
Definition SquareMatrix3.h:1284
T trace() const
Returns the trace of the matrix which is the sum of the diagonal elements.
Definition SquareMatrix3.h:1292
This class implements a vector with three elements.
Definition Vector3.h:97
bool isUnit(const T eps=NumericT< T >::eps()) const
Returns whether this vector is a unit vector (whether the vector has the length 1).
Definition Vector3.h:873
VectorT3< T > perpendicular() const
Returns a vector that is perpendicular to this vector.
Definition Vector3.h:768
bool normalize()
Normalizes this vector.
Definition Vector3.h:659
VectorT3< T > cross(const VectorT3< T > &vector) const
Returns the cross product of two vectors.
Definition Vector3.h:609
T angle(const VectorT3< T > &right) const
Returns the angle between this vector and a second vectors.
Definition Vector3.h:700
std::vector< RotationT< T > > RotationsT
Definition of a typename alias for vectors with RotationT objects.
Definition Rotation.h:54
std::vector< Rotation > Rotations
Definition of a vector holding rotation objects.
Definition Rotation.h:61
The namespace covering the entire Ocean framework.
Definition Accessor.h:15