CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::PointFloat Class Reference

Floating-point 3D point with an optional attached Size; float counterpart of Point. More...

#include <MathClasses.h>

Collaboration diagram for cmlabs::PointFloat:
[legend]

Public Member Functions

 PointFloat ()
 Origin (0,0,0).
 PointFloat (double px, double py, double pz=0, Size psize=Size())
 From coordinates and optional size.
virtual ~PointFloat ()
 operator Point () const
 Conversion to the integer variant (truncates).
double operator[] (int n) const
 Component access: 0=x, 1=y, 2=z.
bool operator== (const Point &p) const
 Equality against an integer point.
bool operator== (const PointFloat &p) const
 Coordinate equality.
PointFloat operator- (const Point &p) const
 Element-wise difference.
PointFloat operator- (const PointFloat &p) const
 Element-wise difference.
PointFloat operator+ (const Point &p) const
 Element-wise sum.
PointFloat operator+ (const PointFloat &p) const
 Element-wise sum.
PointFloat operator+ (const Vector2D &v) const
 Translate by a 2D vector.
PointFloat operator+ (const Vector3D &v) const
 Translate by a 3D vector.
PointFloat operator* (const Point &p) const
 Element-wise product.
PointFloat operator* (const PointFloat &p) const
 Element-wise product.
PointFloat operator- (double a) const
 Subtract scalar from each coordinate.
PointFloat operator+ (double a) const
 Add scalar to each coordinate.
PointFloat operator* (double a) const
 Scale each coordinate.
double getX () const
double getY () const
double getZ () const
Size getSize () const
bool set (double x, double y, double z=0)
 Set all coordinates.
bool setX (double v)
 Set x.
bool setY (double v)
 Set y.
bool setZ (double v)
 Set z.
bool setSize (Size s)
 Set the attached size.
double getDistanceTo (const Point &p) const
 Euclidean distance to an integer point.
double getDistanceTo (const PointFloat &p) const
 Euclidean distance to a float point.
std::string print ()
 Human-readable representation for debugging.

Public Attributes

double x
double y
double z
Size size

Detailed Description

Floating-point 3D point with an optional attached Size; float counterpart of Point.

Arithmetic operators are element-wise; operator[] indexes x=0, y=1, z=2.

Definition at line 438 of file MathClasses.h.

Constructor & Destructor Documentation

◆ PointFloat() [1/2]

cmlabs::PointFloat::PointFloat ( )

◆ PointFloat() [2/2]

cmlabs::PointFloat::PointFloat ( double px,
double py,
double pz = 0,
Size psize = Size() )

From coordinates and optional size.

Definition at line 217 of file MathClasses.cpp.

References size, x, y, and z.

◆ ~PointFloat()

cmlabs::PointFloat::~PointFloat ( )
virtual

Definition at line 218 of file MathClasses.cpp.

Member Function Documentation

◆ getDistanceTo() [1/2]

double cmlabs::PointFloat::getDistanceTo ( const Point & p) const

Euclidean distance to an integer point.

Definition at line 345 of file MathClasses.cpp.

References cmlabs::Point::getX(), and getX().

◆ getDistanceTo() [2/2]

double cmlabs::PointFloat::getDistanceTo ( const PointFloat & p) const

Euclidean distance to a float point.

Definition at line 348 of file MathClasses.cpp.

References getX(), and PointFloat().

◆ getSize()

Size cmlabs::PointFloat::getSize ( ) const
Returns
Attached size.

Definition at line 337 of file MathClasses.cpp.

References size.

◆ getX()

double cmlabs::PointFloat::getX ( ) const

◆ getY()

double cmlabs::PointFloat::getY ( ) const

◆ getZ()

double cmlabs::PointFloat::getZ ( ) const
Returns
z.

Definition at line 336 of file MathClasses.cpp.

References z.

◆ operator Point()

cmlabs::PointFloat::operator Point ( ) const

Conversion to the integer variant (truncates).

Definition at line 220 of file MathClasses.cpp.

References cmlabs::Point::setSize(), cmlabs::Point::setX(), cmlabs::Point::setY(), cmlabs::Point::setZ(), size, x, y, and z.

◆ operator*() [1/3]

PointFloat cmlabs::PointFloat::operator* ( const Point & p) const

Element-wise product.

Definition at line 298 of file MathClasses.cpp.

References PointFloat(), cmlabs::Point::x, x, cmlabs::Point::y, y, cmlabs::Point::z, and z.

◆ operator*() [2/3]

PointFloat cmlabs::PointFloat::operator* ( const PointFloat & p) const

Element-wise product.

Definition at line 305 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator*() [3/3]

PointFloat cmlabs::PointFloat::operator* ( double a) const

Scale each coordinate.

Definition at line 326 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator+() [1/5]

PointFloat cmlabs::PointFloat::operator+ ( const Point & p) const

Element-wise sum.

Definition at line 271 of file MathClasses.cpp.

References PointFloat(), cmlabs::Point::x, x, cmlabs::Point::y, y, cmlabs::Point::z, and z.

◆ operator+() [2/5]

PointFloat cmlabs::PointFloat::operator+ ( const PointFloat & p) const

Element-wise sum.

Definition at line 278 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator+() [3/5]

PointFloat cmlabs::PointFloat::operator+ ( const Vector2D & v) const

Translate by a 2D vector.

Definition at line 285 of file MathClasses.cpp.

References PointFloat(), x, cmlabs::Vector2D::x, y, and cmlabs::Vector2D::y.

◆ operator+() [4/5]

PointFloat cmlabs::PointFloat::operator+ ( const Vector3D & v) const

Translate by a 3D vector.

Definition at line 291 of file MathClasses.cpp.

References PointFloat(), x, cmlabs::Vector3D::x, y, cmlabs::Vector3D::y, z, and cmlabs::Vector3D::z.

◆ operator+() [5/5]

PointFloat cmlabs::PointFloat::operator+ ( double a) const

Add scalar to each coordinate.

Definition at line 319 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator-() [1/3]

PointFloat cmlabs::PointFloat::operator- ( const Point & p) const

Element-wise difference.

Definition at line 257 of file MathClasses.cpp.

References PointFloat(), cmlabs::Point::x, x, cmlabs::Point::y, y, cmlabs::Point::z, and z.

◆ operator-() [2/3]

PointFloat cmlabs::PointFloat::operator- ( const PointFloat & p) const

Element-wise difference.

Definition at line 264 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator-() [3/3]

PointFloat cmlabs::PointFloat::operator- ( double a) const

Subtract scalar from each coordinate.

Definition at line 312 of file MathClasses.cpp.

References PointFloat(), x, y, and z.

◆ operator==() [1/2]

bool cmlabs::PointFloat::operator== ( const Point & p) const

Equality against an integer point.

Definition at line 241 of file MathClasses.cpp.

References cmlabs::Point::size, cmlabs::Point::x, x, cmlabs::Point::y, and cmlabs::Point::z.

◆ operator==() [2/2]

bool cmlabs::PointFloat::operator== ( const PointFloat & p) const

Coordinate equality.

Definition at line 249 of file MathClasses.cpp.

References PointFloat(), size, x, y, and z.

◆ operator[]()

double cmlabs::PointFloat::operator[] ( int n) const

Component access: 0=x, 1=y, 2=z.

Definition at line 229 of file MathClasses.cpp.

References x, y, and z.

◆ print()

std::string cmlabs::PointFloat::print ( )

Human-readable representation for debugging.

Definition at line 352 of file MathClasses.cpp.

References size, cmlabs::utils::StringFormat(), x, y, and z.

◆ set()

bool cmlabs::PointFloat::set ( double x,
double y,
double z = 0 )

Set all coordinates.

Returns
true.

Definition at line 339 of file MathClasses.cpp.

References x, y, and z.

◆ setSize()

bool cmlabs::PointFloat::setSize ( Size s)

Set the attached size.

Returns
true.

Definition at line 343 of file MathClasses.cpp.

References size.

Referenced by cmlabs::Point::operator PointFloat().

◆ setX()

bool cmlabs::PointFloat::setX ( double v)

Set x.

Returns
true.

Definition at line 340 of file MathClasses.cpp.

References x.

Referenced by cmlabs::Point::operator PointFloat().

◆ setY()

bool cmlabs::PointFloat::setY ( double v)

Set y.

Returns
true.

Definition at line 341 of file MathClasses.cpp.

References y.

Referenced by cmlabs::Point::operator PointFloat().

◆ setZ()

bool cmlabs::PointFloat::setZ ( double v)

Set z.

Returns
true.

Definition at line 342 of file MathClasses.cpp.

References z.

Referenced by cmlabs::Point::operator PointFloat().

Member Data Documentation

◆ size

Size cmlabs::PointFloat::size

◆ x

◆ y

◆ z


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