RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::Transform Class Reference

Rigid-body transform in SE(2): translation (meters) + rotation (radians). More...

#include <Transform.hpp>

Public Member Functions

constexpr Transform () noexcept=default
 Identity transform: zero translation, zero rotation.
 Transform (const Pose &initial, const Pose &final) noexcept
 Body-frame transform from initial to final.
 Transform (const Point &point, const Rotation &rotation) noexcept
 Constructs directly from a translation and rotation.
const Point & getPoint () const noexcept
 Access the translation component.
const Rotation & getRotation () const noexcept
 Access the rotation component.
Length X () const noexcept
 X translation (meters).
Length Y () const noexcept
 Y translation (meters).
Angle Theta () const noexcept
 Heading delta (radians, in (-π, π]).
Transform operator+ (const Transform &rhs) const noexcept
 SE(2) composition (apply this, then rhs).
Transform operator- () const noexcept
 Unary inverse.
bool isApprox (const Transform &rhs) const noexcept
 Approximate equality on both translation and rotation.

Detailed Description

Rigid-body transform in SE(2): translation (meters) + rotation (radians).

Transform represents a body-frame motion: a rotation about +Z (right-handed, CCW positive, normalized to (-180, 180] degrees) and a translation expressed in the transform’s own frame when used compositionally with Pose.

Key semantics:

  • Constructing from two poses, Transform(initial, final), produces the body-frame motion that maps initial to final: rotate by -initial.R, then translate, with heading delta final.R - initial.R.
  • Composition A + B is the SE(2) composition (apply A, then B).
  • inverse() returns the exact inverse motion.

Constructor & Destructor Documentation

◆ Transform() [1/3]

rz::Transform::Transform ( )
constexprdefaultnoexcept

Identity transform: zero translation, zero rotation.

◆ Transform() [2/3]

rz::Transform::Transform ( const Pose & initial,
const Pose & final )
noexcept

Body-frame transform from initial to final.

Translation is (final.p - initial.p) expressed in the initial local frame: (final.p - initial.p).rotateBy(-initial.R). Rotation is final.R - initial.R (normalized).

Parameters
initialStart pose.
finalEnd pose.

◆ Transform() [3/3]

rz::Transform::Transform ( const Point & point,
const Rotation & rotation )
noexcept

Constructs directly from a translation and rotation.

Parameters
pointTranslation (meters).
rotationRotation (radians, normalized to (-π, π]).

Member Function Documentation

◆ getPoint()

const Point & rz::Transform::getPoint ( ) const
noexcept

Access the translation component.

◆ getRotation()

const Rotation & rz::Transform::getRotation ( ) const
noexcept

Access the rotation component.

◆ isApprox()

bool rz::Transform::isApprox ( const Transform & rhs) const
noexcept

Approximate equality on both translation and rotation.

Uses Point::isApprox (≤ 1e-9 m) and Rotation::isApprox (≤ 1e-9 rad).

Parameters
rhsOther transform.
Returns
true if both components are approximately equal, otherwise false.

◆ operator+()

Transform rz::Transform::operator+ ( const Transform & rhs) const
noexcept

SE(2) composition (apply this, then rhs).

Equivalent to composing via poses: Pose().transformBy(*this).transformBy(rhs) and extracting the resulting transform from identity.

Parameters
rhsTransform to apply after this one.
Returns
Composed transform.

◆ operator-()

Transform rz::Transform::operator- ( ) const
noexcept

Unary inverse.

Returns the unique transform that composes with *this to yield identity. Translation is rotated by the negative rotation and negated accordingly.

Returns
Inverse transform.

◆ Theta()

Angle rz::Transform::Theta ( ) const
noexcept

Heading delta (radians, in (-π, π]).

◆ X()

Length rz::Transform::X ( ) const
noexcept

X translation (meters).

◆ Y()

Length rz::Transform::Y ( ) const
noexcept

Y translation (meters).


The documentation for this class was generated from the following file: