|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Represents a point in 3D space with exact rational coordinates. More...
#include <point.H>
Public Member Functions | |
| Point3D () | |
| Default constructor. | |
| Point3D (const Geom_Number &x, const Geom_Number &y, const Geom_Number &z) | |
| Constructs a 3D point from x, y, and z coordinates. | |
| Point3D (const Point3D &)=default | |
| Point3D & | operator= (const Point3D &)=default |
| const Geom_Number & | get_x () const |
| Gets the x-coordinate. | |
| const Geom_Number & | get_y () const |
| Gets the y-coordinate. | |
| const Geom_Number & | get_z () const |
| Gets the z-coordinate. | |
| bool | operator== (const Point3D &p) const |
| Checks for exact equality between two 3D points. | |
| bool | operator!= (const Point3D &p) const |
| Checks for inequality between two 3D points. | |
| Point3D | operator+ (const Point3D &p) const |
| Vector addition. | |
| Point3D | operator- (const Point3D &p) const |
| Vector subtraction. | |
| Point3D & | operator+= (const Point3D &p) |
| Vector addition and assignment. | |
| Point3D & | operator-= (const Point3D &p) |
| Vector subtraction and assignment. | |
| Point3D | operator- () const |
| Unary negation. | |
| Point3D | operator* (const Geom_Number &s) const |
| Scalar multiplication. | |
| Point3D | operator/ (const Geom_Number &s) const |
| Scalar division. | |
| Geom_Number | dot (const Point3D &p) const |
| Dot product. | |
| Point3D | cross (const Point3D &p) const |
| Cross product. | |
| Geom_Number | distance_squared_to (const Point3D &p) const |
| Squared Euclidean distance to another point. | |
| Geom_Number | norm_squared () const |
| Squared Euclidean norm (magnitude). | |
| Geom_Number | norm () const |
| Euclidean norm (magnitude). | |
| Geom_Number | distance_to (const Point3D &p) const |
| Euclidean distance to another point. | |
| Point3D | normalize () const |
| Returns a normalized copy of this vector (unit vector). | |
| Point | to_2d () const |
| Projects this 3D point to a 2D point by dropping the z-coordinate. | |
Static Public Member Functions | |
| static Point3D | from_2d (const Point &p) |
| Lifts a 2D point to 3D, setting its z-coordinate to 0. | |
| static Point3D | from_2d (const Point &p, const Geom_Number &z) |
| Lifts a 2D point to 3D with a specified z-coordinate. | |
Private Attributes | |
| Geom_Number | x_ |
| Geom_Number | y_ |
| Geom_Number | z_ |
Represents a point in 3D space with exact rational coordinates.
Extends the 2D geometry module with a basic 3D point type. All operations use exact Geom_Number arithmetic.
|
inline |
|
inline |
Cross product.
| p | The other vector. |
Point3D representing the cross product vector. Definition at line 3112 of file point.H.
Referenced by Aleph::Segment3D::contains(), Aleph::Triangle3D::normal(), Aleph::scalar_triple_product(), and TEST_F().
|
inline |
Squared Euclidean distance to another point.
| p | The other point. |
Definition at line 3126 of file point.H.
References Aleph::divide_and_conquer_partition_dp(), x_, y_, and z_.
Referenced by distance_to(), Aleph::Segment3D::length_squared(), and TEST_F().
|
inline |
Euclidean distance to another point.
| p | The other point. |
Definition at line 3157 of file point.H.
References distance_squared_to(), and Aleph::square_root().
Referenced by Aleph::Segment3D::distance_to(), and Aleph::Segment3D::length().
|
inline |
Dot product.
| p | The other vector. |
Definition at line 3102 of file point.H.
Referenced by Aleph::Segment3D::contains(), Aleph::Segment3D::distance_to(), Aleph::scalar_triple_product(), and TEST_F().
Lifts a 2D point to 3D, setting its z-coordinate to 0.
| p | The 2D point. |
Point3D. Definition at line 3185 of file point.H.
References Aleph::Point::get_x(), and Aleph::Point::get_y().
Referenced by TEST_F().
Lifts a 2D point to 3D with a specified z-coordinate.
| p | The 2D point. |
| z | The value for the z-coordinate. |
Point3D. Definition at line 3196 of file point.H.
References Aleph::Point::get_x(), and Aleph::Point::get_y().
|
inline |
Gets the x-coordinate.
Definition at line 2996 of file point.H.
References x_.
Referenced by Aleph::operator<<(), Aleph::GeomSerializer::to_geojson(), and Aleph::GeomSerializer::to_wkt().
|
inline |
Gets the y-coordinate.
Definition at line 2998 of file point.H.
References y_.
Referenced by Aleph::operator<<(), Aleph::GeomSerializer::to_geojson(), and Aleph::GeomSerializer::to_wkt().
|
inline |
Gets the z-coordinate.
Definition at line 3000 of file point.H.
References z_.
Referenced by Aleph::operator<<(), Aleph::GeomSerializer::to_geojson(), and Aleph::GeomSerializer::to_wkt().
|
inline |
Euclidean norm (magnitude).
Definition at line 3147 of file point.H.
References norm_squared(), and Aleph::square_root().
Referenced by normalize().
|
inline |
Squared Euclidean norm (magnitude).
Definition at line 3138 of file point.H.
Referenced by Aleph::Triangle3D::double_area_squared(), Aleph::Triangle3D::is_degenerate(), norm(), and TEST_F().
|
inline |
Returns a normalized copy of this vector (unit vector).
Point3D with a magnitude of 1. | std::domain_error | if normalizing the zero vector is attempted. |
Definition at line 3167 of file point.H.
References ah_domain_error_if, and norm().
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Definition at line 2974 of file point.H.
Referenced by cross(), distance_squared_to(), dot(), get_x(), norm_squared(), operator*(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator==(), and to_2d().
|
private |
Definition at line 2974 of file point.H.
Referenced by cross(), distance_squared_to(), dot(), get_y(), norm_squared(), operator*(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator==(), and to_2d().
|
private |
Definition at line 2974 of file point.H.
Referenced by cross(), distance_squared_to(), dot(), get_z(), norm_squared(), operator*(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), and operator==().