CARLA
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
carla::geom::Transform Class Reference

A rigid transform in CARLA's / Unreal's left-handed frame: x forward, y right, z up, metres, with a Rotation in degrees. More...

#include <Transform.h>

Public Member Functions

Vector3D GetForwardVector () const
 
std::array< float, 16 > GetInverseMatrix () const
 Computes the 4-matrix form of the inverse transformation.
 
std::array< float, 16 > GetMatrix () const
 Computes the 4-matrix form of the transformation.
 
Vector3D GetRightVector () const
 
Vector3D GetUpVector () const
 
void InverseTransformPoint (Vector3D &in_point) const
 Applies the inverse of this transformation to in_point.
 
 MSGPACK_DEFINE_ARRAY (location, rotation)
 
 operator FTransform () const
 
bool operator!= (const Transform &rhs) const
 
bool operator== (const Transform &rhs) const
 
constexpr RightHandedTransform ToRightHanded () const
 This transform expressed in a right-handed, x-forward / y-**left** / z-up frame (ROS REP-103 "FLU").
 
 Transform ()=default
 
 Transform (const FTransform &transform)
 
 Transform (const Location &in_location)
 
constexpr Transform (const Location &in_location, const Rotation &in_rotation)
 
void TransformPoint (Vector3D &in_point) const
 Applies this transformation to in_point (first translation then rotation).
 
void TransformVector (Vector3D &in_vector) const
 Applies this transformation to in_vector (rotation only).
 

Static Public Member Functions

static constexpr Transform FromRightHanded (const RightHandedTransform &rhs)
 Inverse of ToRightHanded(): reads a right-handed (FLU) pose back into CARLA's left-handed frame.
 

Public Attributes

Location location
 
Rotation rotation
 

Detailed Description

A rigid transform in CARLA's / Unreal's left-handed frame: x forward, y right, z up, metres, with a Rotation in degrees.

GetMatrix(), GetForwardVector() and friends are all in that frame – they are not "uncorrected" right-handed math and must not be flipped. To hand a pose to a ROS / REP-103 consumer, convert explicitly with ToRightHanded(); see RightHandedTransform and Docs/coordinate_conventions.md.

Definition at line 32 of file geom/Transform.h.

Constructor & Destructor Documentation

◆ Transform() [1/4]

carla::geom::Transform::Transform ( )
default

Referenced by FromRightHanded().

◆ Transform() [2/4]

carla::geom::Transform::Transform ( const Location &  in_location)
inline

Definition at line 51 of file geom/Transform.h.

◆ Transform() [3/4]

constexpr carla::geom::Transform::Transform ( const Location &  in_location,
const Rotation &  in_rotation 
)
inlineconstexpr

Definition at line 55 of file geom/Transform.h.

◆ Transform() [4/4]

carla::geom::Transform::Transform ( const FTransform &  transform)
inline

Definition at line 195 of file geom/Transform.h.

Member Function Documentation

◆ FromRightHanded()

static constexpr Transform carla::geom::Transform::FromRightHanded ( const RightHandedTransform &  rhs)
inlinestaticconstexpr

Inverse of ToRightHanded(): reads a right-handed (FLU) pose back into CARLA's left-handed frame.

The mapping is an involution.

Definition at line 171 of file geom/Transform.h.

References carla::geom::Rotation::FromRightHanded(), carla::geom::Location::FromRightHanded(), carla::geom::RightHandedTransform::location, carla::geom::RightHandedTransform::rotation, and Transform().

Referenced by TEST().

◆ GetForwardVector()

Vector3D carla::geom::Transform::GetForwardVector ( ) const
inline

◆ GetInverseMatrix()

std::array< float, 16 > carla::geom::Transform::GetInverseMatrix ( ) const
inline

Computes the 4-matrix form of the inverse transformation.

Rows are the transpose of the forward rotation; translation component pulled from InverseTransformPoint(origin) to keep both helpers consistent.

Definition at line 128 of file geom/Transform.h.

References InverseTransformPoint(), carla::geom::Rotation::pitch, carla::geom::Rotation::roll, rotation, carla::geom::Math::ToRadians(), carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Rotation::yaw, and carla::geom::Vector3D::z.

◆ GetMatrix()

std::array< float, 16 > carla::geom::Transform::GetMatrix ( ) const
inline

Computes the 4-matrix form of the transformation.

Sign convention matches Rotation::RotateVector and the engine: +pitch puts +sin(pitch) on row 2 column 0 (forward axis tilts up), +roll puts -cos(pitch) * sin(roll) on row 2 column 1 (right axis tilts down). Verified against rendered camera frames on UE5.8 (2026-08-27).

Definition at line 103 of file geom/Transform.h.

References location, carla::geom::Rotation::pitch, carla::geom::Rotation::roll, rotation, carla::geom::Math::ToRadians(), carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Rotation::yaw, and carla::geom::Vector3D::z.

◆ GetRightVector()

Vector3D carla::geom::Transform::GetRightVector ( ) const
inline

Definition at line 67 of file geom/Transform.h.

References carla::geom::Rotation::GetRightVector(), and rotation.

◆ GetUpVector()

Vector3D carla::geom::Transform::GetUpVector ( ) const
inline

Definition at line 71 of file geom/Transform.h.

References carla::geom::Rotation::GetUpVector(), and rotation.

◆ InverseTransformPoint()

void carla::geom::Transform::InverseTransformPoint ( Vector3D &  in_point) const
inline

Applies the inverse of this transformation to in_point.

Definition at line 91 of file geom/Transform.h.

References carla::geom::Rotation::InverseRotateVector(), location, and rotation.

Referenced by carla::geom::BoundingBox::Contains(), GetInverseMatrix(), and TEST().

◆ MSGPACK_DEFINE_ARRAY()

carla::geom::Transform::MSGPACK_DEFINE_ARRAY ( location  ,
rotation   
)

◆ operator FTransform()

carla::geom::Transform::operator FTransform ( ) const
inline

Definition at line 198 of file geom/Transform.h.

References location, and rotation.

◆ operator!=()

bool carla::geom::Transform::operator!= ( const Transform &  rhs) const
inline

Definition at line 185 of file geom/Transform.h.

◆ operator==()

bool carla::geom::Transform::operator== ( const Transform &  rhs) const
inline

Definition at line 181 of file geom/Transform.h.

References location, and rotation.

◆ ToRightHanded()

constexpr RightHandedTransform carla::geom::Transform::ToRightHanded ( ) const
inlineconstexpr

This transform expressed in a right-handed, x-forward / y-**left** / z-up frame (ROS REP-103 "FLU").

location becomes (x, -y, z) and rotation becomes (roll, -pitch, -yaw); equivalently the pose matrix becomes S * GetMatrix() * S with S = diag(1, -1, 1, 1).

Definition at line 163 of file geom/Transform.h.

References location, rotation, carla::geom::Location::ToRightHanded(), and carla::geom::Rotation::ToRightHanded().

◆ TransformPoint()

void carla::geom::Transform::TransformPoint ( Vector3D &  in_point) const
inline

◆ TransformVector()

void carla::geom::Transform::TransformVector ( Vector3D &  in_vector) const
inline

Applies this transformation to in_vector (rotation only).

Definition at line 84 of file geom/Transform.h.

References carla::geom::Rotation::RotateVector(), and rotation.

Member Data Documentation

◆ location

Location carla::geom::Transform::location

◆ rotation

Rotation carla::geom::Transform::rotation

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