TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Distance3D Class Reference

Represents a 3D distance or position vector with unit support. More...

#include <Distance.h>

Public Member Functions

 Distance3D (float x, float y, float z, DistanceUnit unit)
 
float getX (DistanceUnit desiredUnit) const
 
float getY (DistanceUnit desiredUnit) const
 
float getZ (DistanceUnit desiredUnit) const
 

Public Attributes

float x = 0.0f
 
float y = 0.0f
 
float z = 0.0f
 
DistanceUnit unit
 Unit of the 3D distance.
 

Detailed Description

Represents a 3D distance or position vector with unit support.

This class encapsulates a 3D distance measurement, storing x, y, and z components along with a unit (meters, centimeters, millimeters, or feet). It provides methods to retrieve each component in any supported unit, handling conversion as needed.

Distance3D is useful for robotics, navigation, mapping, and simulation applications where 3D positions or displacements must be represented and manipulated in a type-safe and unit-aware manner. It is compatible with the Distance class for 1D distance.

Example usage: Distance3D p(1.0, 2.0, 3.0, DistanceUnit::M); // 1m, 2m, 3m in x, y, z float x_cm = p.getX(DistanceUnit::CM); // Convert x to centimeters

Member Data Documentation

◆ unit

Initial value:
=
DistanceUnit::M

Unit of the 3D distance.

See also
DistanceUnit

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