Represents a translation in 2D space.
More...
#include <trajopt/geometry/translation2.hpp>
template<typename T>
class trajopt::Translation2< T >
Represents a translation in 2D space.
◆ Translation2() [1/3]
template<typename T>
template<typename X, typename Y>
Constructs a translation with the given x and y components.
- Parameters
-
| x | The x component of the translation. |
| y | The y component of the translation. |
◆ Translation2() [2/3]
template<typename T>
template<typename U>
Constructs a translation with the provided distance and angle.
This is essentially converting from polar coordinates to Cartesian coordinates.
- Parameters
-
| distance | The distance from the origin to the end of the translation. |
| angle | The angle between the x-axis and the translation vector. |
◆ Translation2() [3/3]
template<typename T>
template<typename U>
Coerces one translation type into another.
- Parameters
-
| other | The other translation type. |
◆ angle()
Returns the angle this translation forms with the positive x-axis.
- Returns
- The angle of the translation.
◆ cross()
template<typename T>
template<typename U>
Returns the cross product between two translations.
- Parameters
-
| other | The other translation. |
- Returns
- The cross product.
◆ distance()
template<typename T>
template<typename U>
Returns the distance between two translations in 2D space.
The distance between translations is defined as √((x₂−x₁)²+(y₂−y₁)²).
- Parameters
-
| other | The translation to which to compute the distance. |
- Returns
- The distance between the two translations.
◆ dot()
template<typename T>
template<typename U>
Returns the dot product between two translations.
- Parameters
-
| other | The other translation. |
- Returns
- The dot product.
◆ norm()
Returns the norm of the translation. This is the distance from the origin to the translation.
- Returns
- The norm of the translation.
◆ operator*()
template<typename T>
template<typename U>
Returns the translation multiplied by a scalar.
- Parameters
-
| scalar | The scalar to multiply by. |
- Returns
- The scaled translation.
◆ operator+()
template<typename T>
template<typename U>
Returns the sum of two translations in 2D space.
- Parameters
-
| other | The translation to add. |
- Returns
- The sum of the translations.
◆ operator-() [1/2]
Returns the inverse of the current translation.
This is equivalent to rotating by 180 degrees, flipping the point over both axes, or negating all components of the translation.
- Returns
- The inverse of the current translation.
◆ operator-() [2/2]
template<typename T>
template<typename U>
Returns the difference between two translations.
- Parameters
-
| other | The translation to subtract. |
- Returns
- The difference between the two translations.
◆ operator/()
template<typename T>
template<typename U>
Returns the translation divided by a scalar.
- Parameters
-
| scalar | The scalar to divide by. |
- Returns
- The scaled translation.
◆ rotate_by()
template<typename T>
template<typename U>
Applies a rotation to the translation in 2D space.
- Parameters
-
| rotation | The rotation to rotate the translation by. |
- Returns
- The new rotated translation.
◆ squared_norm()
Returns the squared norm of the translation. This is the sum of squares of the translation's components.
- Returns
- The squared norm of the translation.
◆ x()
Returns the x component of the translation.
- Returns
- The x component of the translation.
◆ y()
Returns the y component of the translation.
- Returns
- The y component of the translation.
The documentation for this class was generated from the following file: