iDynTree::Direction class

Class representing the coordinates of a direction in the 3D space.

Base classes

template<unsigned int VecSize>
class VectorFixSize<3>
Class providing a simple vector of N elements.

Public static functions

static auto Default() -> Direction

Constructors, destructors, conversion operators

Direction()
Default constructor.
Direction(double x, double y, double z)
Constructor from 3 doubles: initialize the direction with the passed values.
Direction(const Direction& other)
Copy constructor: create a Direction from another Direction.
Direction(const double* in_data, const unsigned int in_size)
Copy constructor: create a Direction from a 3 double buffer.

Public functions

auto operator=(const Direction& other) -> Direction&
Assignment operator: assign a Direction from another Direction.
void Normalize(double tol = DEFAULT_TOL)
Normalize the representation of the direction, useful if the coordinates of the direction has been manually setted and you want to be sure that this direction is actually a unit vector.
auto isParallel(const Direction& otherDirection, double tolerance) const -> bool
Check if two directions are parallel.
auto isPerpendicular(const Direction& otherDirection, double tolerance) const -> bool
Check if two directions are perpendicular.
auto reverse() const -> Direction
Return the direction, i.e.

Output helpers.

Output helpers.

auto toString() const -> std::string
auto reservedToString() const -> std::string

Function documentation

iDynTree::Direction::Direction()

Default constructor.

The data is not reset to the default for perfomance reason. Please initialize the data in the class before any use.

iDynTree::Direction::Direction(double x, double y, double z)

Constructor from 3 doubles: initialize the direction with the passed values.

The vector passed is normalized to ensure that the direction is stored as a unit vector.

void iDynTree::Direction::Normalize(double tol = DEFAULT_TOL)

Normalize the representation of the direction, useful if the coordinates of the direction has been manually setted and you want to be sure that this direction is actually a unit vector.

Parameters
tol if the norm of the vector < tol, set the direction to 1,0,0

bool iDynTree::Direction::isParallel(const Direction& otherDirection, double tolerance) const

Check if two directions are parallel.

Parameters
otherDirection the direction to check for parallelism.
tolerance tolerance to use in the parallelism check.

bool iDynTree::Direction::isPerpendicular(const Direction& otherDirection, double tolerance) const

Check if two directions are perpendicular.

Parameters
otherDirection the direction to check for the perpendicular check.
tolerance tolerance to use in the perpendicular check.

Direction iDynTree::Direction::reverse() const

Return the direction, i.e.

return its opposite.