|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Represents a tetrahedron in 3D space defined by four points. More...
#include <point.H>
Classes | |
| struct | Faces |
| A struct holding the four faces of the tetrahedron. More... | |
Public Member Functions | |
| Tetrahedron ()=default | |
| Default constructor. | |
| Tetrahedron (const Point3D &p1, const Point3D &p2, const Point3D &p3, const Point3D &p4) | |
| Constructs a tetrahedron from four vertices. | |
| const Point3D & | get_p1 () const |
| Gets the first vertex. | |
| const Point3D & | get_p2 () const |
| Gets the second vertex. | |
| const Point3D & | get_p3 () const |
| Gets the third vertex. | |
| const Point3D & | get_p4 () const |
| Gets the fourth vertex. | |
| Geom_Number | signed_volume_x6 () const |
| Calculates 6 times the signed volume of the tetrahedron. | |
| Geom_Number | volume () const |
| Calculates the unsigned volume of the tetrahedron. | |
| bool | is_degenerate () const |
| Checks if the tetrahedron is degenerate (i.e., its vertices are coplanar). | |
| Point3D | centroid () const |
| Computes the centroid (center of mass) of the tetrahedron. | |
| bool | contains (const Point3D &p) const |
| Checks if a point lies inside the tetrahedron. | |
| Faces | faces () const |
| Gets the four faces of the tetrahedron. | |
Private Attributes | |
| Point3D | p1_ |
| Point3D | p2_ |
| Point3D | p3_ |
| Point3D | p4_ |
Represents a tetrahedron in 3D space defined by four points.
|
default |
Default constructor.
Initializes a degenerate tetrahedron at the origin.
|
inline |
Checks if a point lies inside the tetrahedron.
This test is based on checking the sign of the volumes of the four sub-tetrahedra formed by the point and each face.
| p | The point to check. |
true if the point is inside or on the boundary of the tetrahedron. Definition at line 3538 of file point.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), p1_, p2_, p3_, p4_, Aleph::scalar_triple_product(), and signed_volume_x6().
|
inline |
Gets the first vertex.
Definition at line 3482 of file point.H.
References p1_.
Referenced by Aleph::operator<<().
Gets the second vertex.
Definition at line 3484 of file point.H.
References p2_.
Referenced by Aleph::operator<<().
Gets the third vertex.
Definition at line 3486 of file point.H.
References p3_.
Referenced by Aleph::operator<<().
Gets the fourth vertex.
Definition at line 3488 of file point.H.
References p4_.
Referenced by Aleph::operator<<().
|
inline |
Checks if the tetrahedron is degenerate (i.e., its vertices are coplanar).
true if the volume is zero, false otherwise. Definition at line 3517 of file point.H.
References signed_volume_x6().
|
inline |
Calculates 6 times the signed volume of the tetrahedron.
The value is computed using the scalar triple product: (p2-p1) . ((p3-p1) x (p4-p1)). The sign indicates the orientation of the vertices.
Definition at line 3497 of file point.H.
References p1_, p2_, p3_, p4_, and Aleph::scalar_triple_product().
Referenced by contains(), is_degenerate(), and volume().
|
inline |
Calculates the unsigned volume of the tetrahedron.
Definition at line 3506 of file point.H.
References signed_volume_x6().
|
private |
Definition at line 3464 of file point.H.
Referenced by centroid(), contains(), faces(), get_p1(), and signed_volume_x6().
|
private |
Definition at line 3464 of file point.H.
Referenced by centroid(), contains(), faces(), get_p2(), and signed_volume_x6().
|
private |
Definition at line 3464 of file point.H.
Referenced by centroid(), contains(), faces(), get_p3(), and signed_volume_x6().
|
private |
Definition at line 3464 of file point.H.
Referenced by centroid(), contains(), faces(), get_p4(), and signed_volume_x6().