You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
Merge pull request #83353 from Chubercik/expose_delaunay_3d
Expose 3D Delaunay tetrahedralization in `Geometry3D`
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#ifndef GEOMETRY_3D_H
|
||||
#define GEOMETRY_3D_H
|
||||
|
||||
#include "core/math/delaunay_3d.h"
|
||||
#include "core/math/face3.h"
|
||||
#include "core/object/object.h"
|
||||
#include "core/templates/local_vector.h"
|
||||
@@ -532,6 +533,21 @@ public:
|
||||
return clipped;
|
||||
}
|
||||
|
||||
static Vector<int32_t> tetrahedralize_delaunay(const Vector<Vector3> &p_points) {
|
||||
Vector<Delaunay3D::OutputSimplex> tetr = Delaunay3D::tetrahedralize(p_points);
|
||||
Vector<int32_t> tetrahedrons;
|
||||
|
||||
tetrahedrons.resize(4 * tetr.size());
|
||||
int32_t *ptr = tetrahedrons.ptrw();
|
||||
for (int i = 0; i < tetr.size(); i++) {
|
||||
*ptr++ = tetr[i].points[0];
|
||||
*ptr++ = tetr[i].points[1];
|
||||
*ptr++ = tetr[i].points[2];
|
||||
*ptr++ = tetr[i].points[3];
|
||||
}
|
||||
return tetrahedrons;
|
||||
}
|
||||
|
||||
// Create a "wrap" that encloses the given geometry.
|
||||
static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user