Avara3D 0.2.0
C++ API reference
ConvexDecomposer.h
1//
2// ConvexDecomposer.h
3// avara3d
4//
5// Created by Morgan Davis on 11/5/23.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_MESH_CONVEXDECOMPOSER_H
10#define AVARA3D_MESH_CONVEXDECOMPOSER_H
11
12#include <cstdint>
13#include <functional>
14#include <memory>
15#include <vector>
16
17class IVHACD;
18
19namespace a3d {
20
21 class MeshElement;
22
23 class ConvexDecomposer {
24
25 public:
26 // [Internal Types]
27
28 enum class FILL_MODE {
29 FLOOD_FILL,
30 SURFACE_ONLY,
31 RAYCAST_FILL
32 };
33
34 struct Options {
35 uint32_t maxConvexHulls {64};
36 uint32_t resolution {400000};
37 double minVolumePercentErr {1};
38 uint32_t maxRecursionDepth {10};
39 bool shrinkWrap {true};
40 FILL_MODE fillMode {FILL_MODE::FLOOD_FILL};
41 uint32_t maxNumVerticesPerHull {64};
42// bool asyncACD {true};
43 uint32_t minEdgeLength {2};
44 bool findBestPlane {false};
45 };
46
47 // [Internal Lifecycle Functions]
48
49 ConvexDecomposer(MeshElement& element, Options& options);
50
51 // [Internal Member Functions]
52
53 std::vector<std::unique_ptr<MeshElement>> decompose();
54
55 private:
56 // [Private Member Variables]
57
58 Options _options;
59 MeshElement* _sourceElement;
60 };
61
62}
63
64#endif // AVARA3D_MESH_CONVEXDECOMPOSER_H