![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/Transform.h>
The Transform class provides a transformation from a Frame to another Frame, where each Frame is a coordinate system.
More...
The Transform class provides a transformation from a Frame to another Frame, where each Frame is a coordinate system.
Transform is templated with a To and a From Frames.
<To, From>At compilation time, the validity of Transform operations is checked:
To Frame of the Transform right multiplied must match our FromFromTo define Frames, create a user enumeration where each value represents each Frame.
An example of the Robot transforms:
The following code would not compile:
By default, the Transform uses an Eigen::Matrix4d. A different Eigen matrix can also be used as supporting type, such as Eigen::Isometry3d, or Eigen::Matrix3d for 2D transforms.
Eigen supports operation optimizations, therefore the EigenType will change after calling an operation.
To support these optimizations, use auto as the return of the operation to implicitly hold a Transform<To, From, EigenOperationType> or chain operations in the same line.
For example:
The cast() method is useful to skip Transform in the chain of operations when they're Identity, for example:
A Transform between different Frame enumerations can also be defined, for example:
| To | Frame where the transform maps to |
| From | Frame where the transform originates from |
| EigenType | Underlying type of the Transform, should be an Eigen type |
Public Types | |
| using | TypeTo = decltype(To) |
| using | TypeFrom = decltype(From) |
Public Member Functions | |
| template<typename OtherEigenType> | |
| Transform (OtherEigenType m) | |
| template<auto OtherTo, auto OtherFrom, typename OtherEigenType> | |
| Transform (const Transform< OtherTo, OtherFrom, OtherEigenType > &other) | |
| template<auto OtherTo, auto OtherFrom> | |
| Transform (Transform< OtherTo, OtherFrom > &&other) | |
| template<auto OtherTo, auto OtherFrom> | |
| Transform< FrameTo, FrameFrom, EigenType > & | operator= (Transform< OtherTo, OtherFrom, EigenType > other) |
| template<auto OtherTo, auto OtherFrom, typename OtherEigenType> | |
| Transform< FrameTo, FrameFrom, EigenType > & | operator= (const Transform< OtherTo, OtherFrom, OtherEigenType > &other) |
| template<auto OtherTo, auto OtherFrom, typename OtherEigenType> | |
| auto | operator* (const Transform< OtherTo, OtherFrom, OtherEigenType > &other) const |
| template<auto OtherFrom, typename OtherEigenVector> | |
| auto | operator* (const Vector< OtherFrom, OtherEigenVector > &vector) const |
| auto | inverse () const |
| Returns the inverse Transform, internal value is inverted, and Frames are inverted. | |
| template<auto NewTo, auto NewFrom> | |
| Transform< NewTo, NewFrom, EigenType > | cast () const |
| Casts the Transform to a new set of Frames. The internal value of the Transform is not modified. | |
| EigenType & | matrix () |
| const EigenType & | matrix () const |
| operator EigenType () const | |
Static Public Attributes | |
| static constexpr TypeTo | FrameTo = To |
| static constexpr TypeFrom | FrameFrom = From |