Brick
Loading...
Searching...
No Matches
Transform2d Class Reference

#include <transform2d.h>

Description

Class representing a transformation of a pose2d, by rotating a translation into the frame of the pose2d, then adding the translation, then rotating by theta.

Assumes conventional cartesian coordinate system: Looking down at the coordinate plane, +X is right +Y is up +Theta is counterclockwise

Public Member Functions

constexpr Transform2d ()=default
 Default Constructor for Transform2d.
constexpr Transform2d (Translation2d translation, Rotation2d rotation)
constexpr Transform2d (units::Length x, units::Length y, Rotation2d rotation)
constexpr Transform2d (units::Length x, units::Length y, units::Angle angle)
constexpr Transform2d (Translation2d translation, units::Angle angle)
constexpr Transform2d (const Eigen::Vector3d &transform_vector, units::Length unit, units::Angle angle_unit=units::radians)
constexpr units::Length x () const
 Gets the x component.
constexpr double x (units::Length unit) const
 Gets x in the supplied length unit.
constexpr void set_x (units::Length val)
 Sets the x component.
constexpr units::Length y () const
 Gets the y component.
constexpr double y (units::Length unit) const
 Gets y in the supplied length unit.
constexpr void set_y (units::Length val)
 Sets the y component.
constexpr Translation2d translation () const
 Gets the translation.
constexpr void set_translation (Translation2d val)
 Sets the translation.
constexpr Rotation2d rotation () const
 Gets the rotation.
constexpr void set_rotation (Rotation2d val)
 Sets the rotation.
constexpr units::Angle angle () const
 Gets the rotation as an Angle.
constexpr double angle (units::Angle unit) const
 Gets the angle in the supplied unit.
constexpr void set_angle (units::Angle val)
 Sets the rotation as an angle.
EVec< 3 > as_vector (units::Length length_unit, units::Angle angle_unit=units::radians) const
constexpr Transform2d inverse () const
 Inverts this transform.
constexpr Transform2d operator+ (const Transform2d &other) const
 Composes this transform and another transform.
constexpr Transform2d & operator+= (const Transform2d &other)
 Composes this transform and another transform.
constexpr Transform2d operator- () const
 Inverts this transform.
constexpr Transform2d operator* (double scalar) const
 Multiplies this transform by a scalar.
constexpr Transform2d & operator*= (double scalar)
 Multiplies this transform by a scalar.
constexpr Transform2d operator/ (double scalar) const
 Divides this transform by a scalar.
constexpr Transform2d & operator/= (double scalar)
 Divides this transform by a scalar.
constexpr bool operator== (const Transform2d &other) const
 Checks exact equality between this and another transform.
constexpr bool is_near (const Transform2d &other, units::Length distance_tolerance=units::Length(1e-6), units::Angle angle_tolerance=units::Angle(1e-6)) const

Friends

constexpr Transform2d operator* (double scalar, const Transform2d &transform)
 Multiplies this transform by a scalar reverse order.

Constructor & Destructor Documentation

◆ Transform2d() [1/5]

Transform2d::Transform2d ( Translation2d translation,
Rotation2d rotation )
inlineconstexpr

Constructs a transform given translation and rotation components.

Parameters
translationthe translational component of the transform.
rotationthe rotational component of the transform.

◆ Transform2d() [2/5]

Transform2d::Transform2d ( units::Length x,
units::Length y,
Rotation2d rotation )
inlineconstexpr

Constructs a transform given translation and rotation components.

Parameters
xthe x component of the transform.
ythe y component of the transform.
rotationthe rotational component of the transform.

◆ Transform2d() [3/5]

Transform2d::Transform2d ( units::Length x,
units::Length y,
units::Angle angle )
inlineconstexpr

Constructs a transform given translation and rotation components.

Parameters
xthe x component of the transform.
ythe y component of the transform.
anglethe rotational component of the transform.

◆ Transform2d() [4/5]

Transform2d::Transform2d ( Translation2d translation,
units::Angle angle )
inlineconstexpr

Constructs a transform given translation and rotation components.

Parameters
translationthe translational component of the transform.
anglethe rotational component of the transform.

◆ Transform2d() [5/5]

Transform2d::Transform2d ( const Eigen::Vector3d & transform_vector,
units::Length unit,
units::Angle angle_unit = units::radians )
inlineconstexpr

Constructs a transform given translation and rotation components given as a vector using the supplied units.

Parameters
transform_vectorvector of the form [x, y, theta]
unitThe length unit to use when assigning the translation.
angle_unitThe angle unit, defaults to radians.

Member Function Documentation

◆ as_vector()

EVec< 3 > Transform2d::as_vector ( units::Length length_unit,
units::Angle angle_unit = units::radians ) const
inline

Returns [x, y, theta] in the supplied units. Angles default to radians.

Parameters
length_unitthe unit of length to get the values as
angle_unitthe unit of angle to get the rotation as, default radians
Returns
EVec<3> containing the values.

◆ is_near()

bool Transform2d::is_near ( const Transform2d & other,
units::Length distance_tolerance = units::Length(1e-6),
units::Angle angle_tolerance = units::Angle(1e-6) ) const
inlineconstexpr

Checks translation distance and the smallest angle against tolerances. Defaults to 1um and 1e-6 radians.


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