About
A Delaunay triangulation connects a set of points with lines so that a given point is connected to its neighbors. The 3D extension maxon::Delaunay3DInterface allows to fill the space between points with tetrahedrons.
- Note
- This class is used inside the maxon::Voronoi3DInterface, see Voronoi 3D Manual.
Delaunay3DInterface
The maxon::Delaunay3DInterface collects the given points and computes the tetrahedrons filling the space between these points.
An object is initialized with:
Points are added to the object with:
The calculation of the tetrahedrons is performed with:
The resulting geometry data is accessed with:
The tetrahedron containing a given point can be obtained with:
Miscellaneous functions are:
Tetrahedron
A maxon::Tetrahedron object represents a tetrahedron filling the space between the points of the Delaunay object. The class gives access to the tetrahedron's points and faces:
Further functions are:
Example
for (
maxon::Int i = 0; i != points.GetCount(); ++i)
{
}
maxon::Delaunay3DRef delaunay3D = maxon::Delaunay3DRef::Create()
iferr_return;
delaunay3D.AddPointsIntoTetrahedralization(points)
iferr_return;
delaunay3D.CalculateDelaunayTetrahedralization()
iferr_return;
const
maxon::BaseArray<
maxon::Tetrahedron>& tetrahedrons = delaunay3D.GetTetrahedrons();
const
maxon::BaseArray<
Vector>& pointsArray = delaunay3D.GetPoints();
for (const
maxon::Tetrahedron& tetrahedron : tetrahedrons)
{
{
for (
maxon::Int i = 0; i < tetrahedronPoints; ++i)
{
if (tetra.points[i] < internalVertice)
return false;
}
return true;
};
if (CheckTetra(tetrahedron))
{
if (polyObject != nullptr)
{
if (polygons && polyPoints)
{
for (
maxon::Int i = 0; i < tetrahedronPoints; ++i)
{
const maxon::Int pointIndex = tetrahedron.points[i];
polyPoints[i] = pointsArray[pointIndex];
}
{
tetrahedron.GetFacePoints(i, tetraPoints);
polygons[i].
a = tetrahedron.GetPointIndexOfPoint(tetraPoints.
x);
polygons[i].
b = tetrahedron.GetPointIndexOfPoint(tetraPoints.
y);
polygons[i].
c = tetrahedron.GetPointIndexOfPoint(tetraPoints.
z);
polygons[i].
d = tetrahedron.GetPointIndexOfPoint(tetraPoints.
z);
}
}
{
color.
x = (randomGen.Get01() * 0.5) + 0.5;
color.
y = (randomGen.Get01() * 0.5) + 0.5;
color.
z = (randomGen.Get01() * 0.5) + 0.5;
return color;
};
doc->InsertObject(polyObject, nullptr, nullptr);
}
}
}
Further Reading