NetDEM v1.0
Loading...
Searching...
No Matches
netdem::Simplex Class Reference

A simplex class for representing a convex hull in n-dimensional space. More...

#include <gjk_simplex.hpp>

Public Member Functions

 Simplex ()
 
 Simplex (Vec3d const &a)
 Construct a simplex with one vertex.
 
 Simplex (Vec3d const &a, Vec3d const &b)
 Construct a simplex with two vertices.
 
 Simplex (Vec3d const &a, Vec3d const &b, Vec3d const &c)
 Construct a simplex with three vertices.
 
 Simplex (Vec3d const &a, Vec3d const &b, Vec3d const &c, Vec3d const &d)
 Construct a simplex with four vertices.
 
int Size ()
 
void PushBack (Vec3d const &p)
 Add a new vertex to the end of the simplex.
 
void PushFront (Vec3d const &p)
 Add a new vertex to the front of the simplex.
 

Public Attributes

VecNT< Vec3d, 4 > points
 

Detailed Description

A simplex class for representing a convex hull in n-dimensional space.

This class provides a set of constructors and methods for working with a simplex, which is a geometric object consisting of the convex hull of a set of n+1 points in n-dimensional space. The class is generic and can be used for any dimensionality n, although in practice it is most often used for 2D and 3D graphics applications. The simplex is represented as an array of Vec3d objects, one for each vertex, and a size variable indicating the number of vertices.

Examples
0_demo_erosion_issue.cpp.

Constructor & Destructor Documentation

◆ Simplex() [1/5]

netdem::Simplex::Simplex ( )
inline

A default constructor for this class (creates an empty simplex).

◆ Simplex() [2/5]

netdem::Simplex::Simplex ( Vec3d const & a)
inline

Construct a simplex with one vertex.

This constructor creates a simplex with a single vertex at the specified point. The size of the simplex is set to 1.

Parameters
aThe position of the first vertex.

◆ Simplex() [3/5]

netdem::Simplex::Simplex ( Vec3d const & a,
Vec3d const & b )
inline

Construct a simplex with two vertices.

This constructor creates a simplex with two vertices at the specified positions. The size of the simplex is set to 2.

Parameters
aThe position of the first vertex.
bThe position of the second vertex.

◆ Simplex() [4/5]

netdem::Simplex::Simplex ( Vec3d const & a,
Vec3d const & b,
Vec3d const & c )
inline

Construct a simplex with three vertices.

This constructor creates a simplex with three vertices at the specified positions. The size of the simplex is set to 3.

Parameters
aThe position of the first vertex.
bThe position of the second vertex.
cThe position of the third vertex.

◆ Simplex() [5/5]

netdem::Simplex::Simplex ( Vec3d const & a,
Vec3d const & b,
Vec3d const & c,
Vec3d const & d )
inline

Construct a simplex with four vertices.

This constructor creates a simplex with four vertices at the specified positions. The size of the simplex is set to 4.

Parameters
aThe position of the first vertex.
bThe position of the second vertex.
cThe position of the third vertex.
dThe position of the fourth vertex.

Member Function Documentation

◆ PushBack()

void netdem::Simplex::PushBack ( Vec3d const & p)
inline

Add a new vertex to the end of the simplex.

This method adds a new vertex to the end of the simplex's point array and increments the size of the simplex by one.

Parameters
pThe position of the new vertex to add.

◆ PushFront()

void netdem::Simplex::PushFront ( Vec3d const & p)
inline

Add a new vertex to the front of the simplex.

This method adds a new vertex to the front of the simplex's point array, shifting all existing vertices down by one position, and increments the size of the simplex by one.

Parameters
pThe position of the new vertex to add.

◆ Size()

int netdem::Simplex::Size ( )
inline

Return the number of vertices in the simplex.

Member Data Documentation

◆ points

VecNT<Vec3d, 4> netdem::Simplex::points

An array of Vec3d objects, one for each vertex of the simplex.


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