|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Integer 3D point with an optional attached Size; interoperates with PointFloat and vectors. More...
#include <MathClasses.h>
Public Member Functions | |
| Point () | |
| Origin (0,0,0). | |
| Point (int px, int py, int pz=0, Size psize=Size()) | |
| From coordinates and optional size. | |
| virtual | ~Point () |
| operator PointFloat () const | |
| Implicit conversion to the floating-point variant. | |
| int | operator[] (int n) const |
| Component access: 0=x, 1=y, 2=z. | |
| bool | operator== (const Point &p) const |
| Exact coordinate equality. | |
| bool | operator== (const PointFloat &p) const |
| Equality against a float point. | |
| Point | operator- (const Point &p) const |
| Element-wise difference. | |
| PointFloat | operator- (const PointFloat &p) const |
| Difference, promoted to float. | |
| Point | operator+ (const Point &p) const |
| Element-wise sum. | |
| PointFloat | operator+ (const PointFloat &p) const |
| Sum, promoted to float. | |
| PointFloat | operator+ (const Vector2D &v) const |
| Translate by a 2D vector. | |
| PointFloat | operator+ (const Vector3D &v) const |
| Translate by a 3D vector. | |
| Point | operator* (const Point &p) const |
| Element-wise product. | |
| PointFloat | operator* (const PointFloat &p) const |
| Element-wise product, promoted to float. | |
| Point | operator- (double a) const |
| Subtract scalar from each coordinate. | |
| Point | operator+ (double a) const |
| Add scalar to each coordinate. | |
| Point | operator* (double a) const |
| Scale each coordinate. | |
| int | getX () const |
| int | getY () const |
| int | getZ () const |
| Size | getSize () const |
| bool | set (int x, int y, int z=0) |
| Set all coordinates. | |
| bool | setX (int n) |
| Set x. | |
| bool | setY (int n) |
| Set y. | |
| bool | setZ (int n) |
| Set z. | |
| bool | setSize (Size s) |
| Set the attached size. | |
| double | getDistanceTo (Point &p) const |
| Euclidean distance to another point. | |
| double | getDistanceTo (PointFloat &p) const |
| Euclidean distance to a float point. | |
| std::string | print () |
| Human-readable representation for debugging. | |
Public Attributes | |
| int | x |
| int | y |
| int | z |
| Size | size |
Integer 3D point with an optional attached Size; interoperates with PointFloat and vectors.
Arithmetic operators are element-wise; operator[] indexes x=0, y=1, z=2. Mixed Point/PointFloat arithmetic promotes to PointFloat; converting a PointFloat back to Point truncates (does not round) each coordinate. The attached Size lets a point double as "position + extent" (e.g. a detection center with its bounding size) without a separate Box.
Definition at line 385 of file MathClasses.h.
| cmlabs::Point::Point | ( | ) |
Origin (0,0,0).
Definition at line 67 of file MathClasses.cpp.
Referenced by getDistanceTo(), operator*(), operator*(), operator+(), operator+(), operator-(), operator-(), and operator==().
|
virtual |
Definition at line 69 of file MathClasses.cpp.
| double cmlabs::Point::getDistanceTo | ( | Point & | p | ) | const |
Euclidean distance to another point.
Definition at line 197 of file MathClasses.cpp.
References getX(), getY(), and Point().
Referenced by cmlabs::MathClasses_UnitTest().
| double cmlabs::Point::getDistanceTo | ( | PointFloat & | p | ) | const |
Euclidean distance to a float point.
Definition at line 200 of file MathClasses.cpp.
References getX(), cmlabs::PointFloat::getX(), getY(), and cmlabs::PointFloat::getY().
| Size cmlabs::Point::getSize | ( | ) | const |
| int cmlabs::Point::getX | ( | ) | const |
Definition at line 186 of file MathClasses.cpp.
References x.
Referenced by getDistanceTo(), getDistanceTo(), cmlabs::PointFloat::getDistanceTo(), and cmlabs::MathClasses_UnitTest().
| int cmlabs::Point::getY | ( | ) | const |
Definition at line 187 of file MathClasses.cpp.
References y.
Referenced by getDistanceTo(), getDistanceTo(), and cmlabs::MathClasses_UnitTest().
| int cmlabs::Point::getZ | ( | ) | const |
| cmlabs::Point::operator PointFloat | ( | ) | const |
Implicit conversion to the floating-point variant.
Definition at line 71 of file MathClasses.cpp.
References cmlabs::PointFloat::setSize(), cmlabs::PointFloat::setX(), cmlabs::PointFloat::setY(), cmlabs::PointFloat::setZ(), size, x, y, and z.
| PointFloat cmlabs::Point::operator* | ( | const PointFloat & | p | ) | const |
Element-wise product, promoted to float.
Definition at line 156 of file MathClasses.cpp.
References cmlabs::PointFloat::x, cmlabs::PointFloat::y, and cmlabs::PointFloat::z.
| Point cmlabs::Point::operator* | ( | double | a | ) | const |
| PointFloat cmlabs::Point::operator+ | ( | const PointFloat & | p | ) | const |
Sum, promoted to float.
Definition at line 129 of file MathClasses.cpp.
References cmlabs::PointFloat::x, cmlabs::PointFloat::y, and cmlabs::PointFloat::z.
| PointFloat cmlabs::Point::operator+ | ( | const Vector2D & | v | ) | const |
Translate by a 2D vector.
Definition at line 136 of file MathClasses.cpp.
References cmlabs::PointFloat::x, cmlabs::Vector2D::x, cmlabs::PointFloat::y, and cmlabs::Vector2D::y.
| PointFloat cmlabs::Point::operator+ | ( | const Vector3D & | v | ) | const |
Translate by a 3D vector.
Definition at line 142 of file MathClasses.cpp.
References cmlabs::PointFloat::x, cmlabs::Vector3D::x, cmlabs::PointFloat::y, cmlabs::Vector3D::y, cmlabs::PointFloat::z, and cmlabs::Vector3D::z.
| Point cmlabs::Point::operator+ | ( | double | a | ) | const |
| PointFloat cmlabs::Point::operator- | ( | const PointFloat & | p | ) | const |
Difference, promoted to float.
Definition at line 115 of file MathClasses.cpp.
References cmlabs::PointFloat::x, cmlabs::PointFloat::y, and cmlabs::PointFloat::z.
| Point cmlabs::Point::operator- | ( | double | a | ) | const |
| bool cmlabs::Point::operator== | ( | const Point & | p | ) | const |
| bool cmlabs::Point::operator== | ( | const PointFloat & | p | ) | const |
Equality against a float point.
Definition at line 100 of file MathClasses.cpp.
References cmlabs::PointFloat::size, x, cmlabs::PointFloat::x, cmlabs::PointFloat::y, and cmlabs::PointFloat::z.
| int cmlabs::Point::operator[] | ( | int | n | ) | const |
Component access: 0=x, 1=y, 2=z.
Definition at line 80 of file MathClasses.cpp.
| std::string cmlabs::Point::print | ( | ) |
Human-readable representation for debugging.
Definition at line 204 of file MathClasses.cpp.
References size, cmlabs::utils::StringFormat(), x, y, and z.
| bool cmlabs::Point::set | ( | int | x, |
| int | y, | ||
| int | z = 0 ) |
| bool cmlabs::Point::setSize | ( | Size | s | ) |
Set the attached size.
Definition at line 195 of file MathClasses.cpp.
References size.
Referenced by cmlabs::PointFloat::operator Point().
| bool cmlabs::Point::setX | ( | int | n | ) |
Set x.
Definition at line 192 of file MathClasses.cpp.
References x.
Referenced by cmlabs::PointFloat::operator Point().
| bool cmlabs::Point::setY | ( | int | n | ) |
Set y.
Definition at line 193 of file MathClasses.cpp.
References y.
Referenced by cmlabs::PointFloat::operator Point().
| bool cmlabs::Point::setZ | ( | int | n | ) |
Set z.
Definition at line 194 of file MathClasses.cpp.
References z.
Referenced by cmlabs::PointFloat::operator Point().
| Size cmlabs::Point::size |
Definition at line 397 of file MathClasses.h.
Referenced by getSize(), operator PointFloat(), operator==(), cmlabs::PointFloat::operator==(), Point(), print(), and setSize().
| int cmlabs::Point::x |
Definition at line 394 of file MathClasses.h.
Referenced by cmlabs::Bitmap::drawBitmap(), getX(), cmlabs::Box::growToIncludePoint(), operator PointFloat(), operator*(), operator*(), cmlabs::PointFloat::operator*(), operator+(), operator+(), cmlabs::PointFloat::operator+(), operator-(), operator-(), cmlabs::PointFloat::operator-(), operator==(), operator==(), cmlabs::PointFloat::operator==(), operator[](), Point(), Point(), print(), set(), and setX().
| int cmlabs::Point::y |
Definition at line 395 of file MathClasses.h.
Referenced by cmlabs::Bitmap::drawBitmap(), getY(), cmlabs::Box::growToIncludePoint(), operator PointFloat(), operator*(), operator*(), cmlabs::PointFloat::operator*(), operator+(), operator+(), cmlabs::PointFloat::operator+(), operator-(), operator-(), cmlabs::PointFloat::operator-(), operator==(), cmlabs::PointFloat::operator==(), operator[](), Point(), Point(), print(), set(), and setY().
| int cmlabs::Point::z |
Definition at line 396 of file MathClasses.h.
Referenced by getZ(), operator PointFloat(), operator*(), operator*(), cmlabs::PointFloat::operator*(), operator+(), operator+(), cmlabs::PointFloat::operator+(), operator-(), operator-(), cmlabs::PointFloat::operator-(), operator==(), cmlabs::PointFloat::operator==(), operator[](), Point(), Point(), print(), set(), and setZ().