Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale quickhull tolerance with mesh size #26455

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/math/quick_hull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion core/math/quick_hull.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class QuickHull {
struct Face {

Plane plane;
int vertices[3];
uint32_t vertices[3];
Vector<int> points_over;

bool operator<(const Face &p_face) const {
Expand Down