Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Tetrahedron Class Reference

Represents a tetrahedron in 3D space defined by four points. More...

#include <point.H>

Collaboration diagram for Aleph::Tetrahedron:
[legend]

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 Point3Dget_p1 () const
 Gets the first vertex.
 
const Point3Dget_p2 () const
 Gets the second vertex.
 
const Point3Dget_p3 () const
 Gets the third vertex.
 
const Point3Dget_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_
 

Detailed Description

Represents a tetrahedron in 3D space defined by four points.

Definition at line 3462 of file point.H.

Constructor & Destructor Documentation

◆ Tetrahedron() [1/2]

Aleph::Tetrahedron::Tetrahedron ( )
default

Default constructor.

Initializes a degenerate tetrahedron at the origin.

◆ Tetrahedron() [2/2]

Aleph::Tetrahedron::Tetrahedron ( const Point3D p1,
const Point3D p2,
const Point3D p3,
const Point3D p4 
)
inline

Constructs a tetrahedron from four vertices.

Parameters
p1The first vertex.
p2The second vertex.
p3The third vertex.
p4The fourth vertex.

Definition at line 3477 of file point.H.

Member Function Documentation

◆ centroid()

Point3D Aleph::Tetrahedron::centroid ( ) const
inline

Computes the centroid (center of mass) of the tetrahedron.

Returns
A Point3D representing the centroid.

Definition at line 3526 of file point.H.

References p1_, p2_, p3_, and p4_.

◆ contains()

bool Aleph::Tetrahedron::contains ( const Point3D p) const
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.

Parameters
pThe point to check.
Returns
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().

◆ faces()

Faces Aleph::Tetrahedron::faces ( ) const
inline

Gets the four faces of the tetrahedron.

Returns
A Faces struct containing four Triangle3D objects.

Definition at line 3573 of file point.H.

References p1_, p2_, p3_, and p4_.

◆ get_p1()

const Point3D & Aleph::Tetrahedron::get_p1 ( ) const
inline

Gets the first vertex.

Definition at line 3482 of file point.H.

References p1_.

Referenced by Aleph::operator<<().

◆ get_p2()

const Point3D & Aleph::Tetrahedron::get_p2 ( ) const
inline

Gets the second vertex.

Definition at line 3484 of file point.H.

References p2_.

Referenced by Aleph::operator<<().

◆ get_p3()

const Point3D & Aleph::Tetrahedron::get_p3 ( ) const
inline

Gets the third vertex.

Definition at line 3486 of file point.H.

References p3_.

Referenced by Aleph::operator<<().

◆ get_p4()

const Point3D & Aleph::Tetrahedron::get_p4 ( ) const
inline

Gets the fourth vertex.

Definition at line 3488 of file point.H.

References p4_.

Referenced by Aleph::operator<<().

◆ is_degenerate()

bool Aleph::Tetrahedron::is_degenerate ( ) const
inline

Checks if the tetrahedron is degenerate (i.e., its vertices are coplanar).

Returns
true if the volume is zero, false otherwise.

Definition at line 3517 of file point.H.

References signed_volume_x6().

◆ signed_volume_x6()

Geom_Number Aleph::Tetrahedron::signed_volume_x6 ( ) const
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.

Returns
6 times the signed volume.

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().

◆ volume()

Geom_Number Aleph::Tetrahedron::volume ( ) const
inline

Calculates the unsigned volume of the tetrahedron.

Returns
The absolute volume.

Definition at line 3506 of file point.H.

References signed_volume_x6().

Member Data Documentation

◆ p1_

Point3D Aleph::Tetrahedron::p1_
private

Definition at line 3464 of file point.H.

Referenced by centroid(), contains(), faces(), get_p1(), and signed_volume_x6().

◆ p2_

Point3D Aleph::Tetrahedron::p2_
private

Definition at line 3464 of file point.H.

Referenced by centroid(), contains(), faces(), get_p2(), and signed_volume_x6().

◆ p3_

Point3D Aleph::Tetrahedron::p3_
private

Definition at line 3464 of file point.H.

Referenced by centroid(), contains(), faces(), get_p3(), and signed_volume_x6().

◆ p4_

Point3D Aleph::Tetrahedron::p4_
private

Definition at line 3464 of file point.H.

Referenced by centroid(), contains(), faces(), get_p4(), and signed_volume_x6().


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