28 float x{.0f},
y{.0f},
z{.0f};
31 constexpr
TPoint3Df(
const float xx,
const float yy,
const float zz)
58 throw std::out_of_range(
"index out of range");
74 throw std::out_of_range(
"index out of range");
102 constexpr
TPoint3D(
double xx,
double yy,
double zz)
111 x =
static_cast<double>(
p.x);
112 y =
static_cast<double>(
p.y);
113 z =
static_cast<double>(
p.z);
141 throw std::out_of_range(
"index out of range");
156 throw std::out_of_range(
"index out of range");
190 template <
class VECTORLIKE>
223 return {
x +
p.
x,
y +
p.y,
z +
p.z};
230 return {
x -
p.
x,
y -
p.y,
z -
p.z};
235 return {
x * d,
y * d,
z * d};
240 return {
x / d,
y / d,
z / d};
294 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
317 :
pt(
x,
y,
z),
R(R_val),
G(G_val),
B(B_val)
325 return {-p1.
x, -p1.
y, -p1.
z};
331 return (p1.
x == p2.
x) && (p1.
y == p2.
y) && (p1.
z == p2.
z);
336 return (p1.
x != p2.
x) || (p1.
y != p2.
y) || (p1.
z != p2.
z);
std::vector< T1 > operator-(const std::vector< T1 > &v1, const std::vector< T2 > &v2)
double x
X,Y,Z coordinates.
constexpr TPointXYZIu8(double x, double y, double z, uint8_t intensity_val)
Trivially copiable underlying data for TPoint3D.
constexpr TPoint3D operator-(const TPoint3D &p) const
Points substraction.
constexpr TPointXYZfIu8(float x, float y, float z, uint8_t intensity_val)
Base type of all TPoseXX and TPointXX classes in mrpt::math.
double norm() const
Point norm: |v| = sqrt(x^2+y^2+z^2)
TPoint3Df & operator+=(const TPoint3Df &p)
TPoint3D & operator+=(const TPoint3D &p)
Translation.
constexpr TPointXYZRGBu8(double x, double y, double z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
void asVector(VECTORLIKE &v) const
Transformation into vector.
T square(const T x)
Inline function for the square of a number.
This base provides a set of functions for maths stuff.
Lightweight 3D point (float version).
float & operator[](size_t i)
Coordinate access using operator[].
constexpr const float & operator[](size_t i) const
Coordinate access using operator[].
double distanceTo(const TPoint3D &p) const
Point-to-point distance.
constexpr TPoint3D operator+(const TPoint3D &p) const
Points addition.
XYZ point (float) + RGB(u8)
constexpr TPoint3D(const TPoint3D_data &d)
#define MRPT_DECLARE_TTYPENAME_NO_NAMESPACE(_TYPE, __NS)
Declares a typename to be "type" (without the NS prefix)
XYZ point (float) + Intensity(u8)
GLsizei const GLchar ** string
TPoint3D & operator*=(const double f)
Scale point/vector.
constexpr TPoint3D()
Default constructor.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04 -0.8]" )
std::string asString() const
Provided for STL and matrices/vectors compatibility.
constexpr TPoint3D(double xx, double yy, double zz)
Constructor from coordinates.
XYZ point (double) + RGB(u8)
double sqrDistanceTo(const TPoint3D &p) const
Point-to-point distance, squared.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
constexpr TPoint3D operator/(double d) const
bool operator<(const TPoint3D &p) const
constexpr const double & operator[](size_t i) const
Coordinate access using operator[].
double sqrNorm() const
Squared norm: |v|^2 = x^2+y^2+z^2.
constexpr TPoint3Df(const float xx, const float yy, const float zz)
constexpr bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
constexpr TPoint3D operator*(double d) const
constexpr TPointXYZfRGBu8(float x, float y, float z, uint8_t R_val, uint8_t G_val, uint8_t B_val)
XYZ point (double) + Intensity(u8)
constexpr bool operator!=(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
TPoint3D & operator-=(const TPoint3D &p)
Difference between points.
double & operator[](size_t i)
Coordinate access using operator[].
TPoint3D(const TPoint3Df &p)
Explicit constructor from coordinates.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
TPoint3Df operator*(const float s)