diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-03-01 22:39:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 22:39:33 +0100 |
commit | 78fcbb80c53ca29a00386087d05ca9abb1b7659b (patch) | |
tree | d3adacc817e7baee093ba53096bd6d56e3bf1eaf /core/math | |
parent | 834a984b08105fae98e1dbe4011563d27febfe1e (diff) | |
parent | 33c6b0ec1a352d964d504c49ea0c09e99b390817 (diff) |
Merge pull request #26455 from hpvb/fix-21141
Scale quickhull tolerance with mesh size
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/quick_hull.cpp | 4 | ||||
-rw-r--r-- | core/math/quick_hull.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index bc2b4e6fe0..fc2eb1454d 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -36,8 +36,6 @@ uint32_t QuickHull::debug_stop_after = 0xFFFFFFFF; Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_mesh) { - static const real_t over_tolerance = 0.0001; - /* CREATE AABB VOLUME */ AABB aabb; @@ -180,6 +178,8 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me faces.push_back(f); } + real_t over_tolerance = 3 * UNIT_EPSILON * (aabb.size.x + aabb.size.y + aabb.size.z); + /* COMPUTE AVAILABLE VERTICES */ for (int i = 0; i < p_points.size(); i++) { diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h index 2e659cab6e..a445a47cbe 100644 --- a/core/math/quick_hull.h +++ b/core/math/quick_hull.h @@ -64,7 +64,7 @@ public: struct Face { Plane plane; - int vertices[3]; + uint32_t vertices[3]; Vector<int> points_over; bool operator<(const Face &p_face) const { |