1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #ifndef QUICK_HULL_H
- #define QUICK_HULL_H
- #include "aabb.h"
- #include "geometry.h"
- #include "list.h"
- #include "set.h"
- class QuickHull {
- public:
- struct Edge {
- union {
- uint32_t vertices[2];
- uint64_t id;
- };
- bool operator<(const Edge &p_edge) const {
- return id < p_edge.id;
- }
- Edge(int p_vtx_a = 0, int p_vtx_b = 0) {
- if (p_vtx_a > p_vtx_b) {
- SWAP(p_vtx_a, p_vtx_b);
- }
- vertices[0] = p_vtx_a;
- vertices[1] = p_vtx_b;
- }
- };
- struct Face {
- Plane plane;
- int vertices[3];
- Vector<int> points_over;
- bool operator<(const Face &p_face) const {
- return points_over.size() < p_face.points_over.size();
- }
- };
- private:
- struct FaceConnect {
- List<Face>::Element *left, *right;
- FaceConnect() {
- left = NULL;
- right = NULL;
- }
- };
- struct RetFaceConnect {
- List<Geometry::MeshData::Face>::Element *left, *right;
- RetFaceConnect() {
- left = NULL;
- right = NULL;
- }
- };
- public:
- static uint32_t debug_stop_after;
- static Error build(const Vector<Vector3> &p_points, Geometry::MeshData &r_mesh);
- };
- #endif
|