Template Struct Pose2
Defined in File pose2.hpp
-
template<typename K>
struct Pose2 Class representing 2D transformations (rigid body motion in 2D).
This class represents elements of the SE(2) group, which combines 2D rotations and translations. Each pose consists of a rotation component (SO2) and a translation vector in 2D space.
- Template Parameters
K – Scalar type (typically float or double).
Public Types
-
using Scalar = K
Public Functions
-
inline Pose2 inverse() const
Get the inverse transformation.
- Returns
Inverse transformation.
-
inline Matrix3<K> matrix() const
Get the 3×3 homogeneous transformation matrix representation.
- Returns
3×3 transformation matrix.
-
template<typename S, typename std::enable_if_t<!std::is_same<S, K>::value, int> = 0>
inline Pose2<S> cast() const Cast to a different scalar type.
- Template Parameters
S – Target scalar type.
- Returns
Pose cast to the target type.
-
template<typename S, typename std::enable_if_t<std::is_same<S, K>::value, int> = 0>
inline const Pose2 &cast() const Cast to the same scalar type (no-op).
- Template Parameters
S – Target scalar type (same as K).
- Returns
Reference to this pose.
-
inline Pose2 pow(K exponent) const
Compute the power of the transformation.
This computes the transformation raised to the given exponent using exponential coordinates and matrix exponentiation.
- Parameters
exponent – Power to raise the transformation to.
- Returns
Transformation raised to the given power.
Public Members
Public Static Functions
-
static inline Pose2 identity()
Create the identity transformation.
- Returns
Identity transformation (no rotation or translation).
-
static inline Pose2 from_translation(const Vector2<K> &translation)
Create a pure translation transformation.
- Parameters
translation – Translation vector.
- Returns
Translation-only transformation.
-
static inline Pose2 from_translation(K x, K y)
Create a pure translation transformation from components.
- Parameters
x – X component of translation.
y – Y component of translation.
- Returns
Translation-only transformation.
-
static inline Pose2 from_rotation(const K angle)
Create a pure rotation transformation.
- Parameters
angle – Rotation angle in radians.
- Returns
Rotation-only transformation.
-
static inline Pose2 from_xy_a(K px, K py, K angle)
Create a pose from position and angle components.
- Parameters
px – X component of translation.
py – Y component of translation.
angle – Rotation angle in radians.
- Returns
Pose with specified translation and rotation.
-
static inline Pose2 from_matrix(const Matrix3<K> &matrix)
Create a pose from a 3×3 transformation matrix.
- Parameters
matrix – 3×3 homogeneous transformation matrix.
- Returns
Pose represented by the matrix.
Public Static Attributes
-
static constexpr int kDimension = 2
Friends
-
inline friend Pose2 operator*(const Pose2 &lhs, const Pose2 &rhs)
Compose two poses.
- Parameters
lhs – Left pose.
rhs – Right pose.
- Returns
Composed pose lhs * rhs.
-
inline friend Vector2<K> operator*(const Pose2 &pose, const Vector2<K> &vec)
Transform a 2D vector with the given transformation.
- Parameters
pose – Transformation to apply.
vec – Vector to transform.
- Returns
Transformed vector.