diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-06 15:08:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 15:08:19 +0200 |
commit | 50f4f0f9aedc904acabab0f01d03cb3784d704a3 (patch) | |
tree | d6caa359017999d4469e17295bc4edc41e69651c | |
parent | aca9cfa76c047a2cab72b5328b498c618c2fcccc (diff) | |
parent | 75553c4f90e704e25da4aa962c18406406650a7b (diff) |
Merge pull request #38506 from madmiraal/fix-scale-calculation
Fix scale calculation in VHACD Volume::Voxelize().
-rw-r--r-- | thirdparty/vhacd/0005-fix-scale-calculation.patch | 20 | ||||
-rw-r--r-- | thirdparty/vhacd/inc/vhacdVolume.h | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/thirdparty/vhacd/0005-fix-scale-calculation.patch b/thirdparty/vhacd/0005-fix-scale-calculation.patch new file mode 100644 index 0000000000..4b05f64fbf --- /dev/null +++ b/thirdparty/vhacd/0005-fix-scale-calculation.patch @@ -0,0 +1,20 @@ +diff --git a/thirdparty/vhacd/inc/vhacdVolume.h b/thirdparty/vhacd/inc/vhacdVolume.h +index 8c47fa1e2c..c445f20122 100644 +--- a/thirdparty/vhacd/inc/vhacdVolume.h ++++ b/thirdparty/vhacd/inc/vhacdVolume.h +@@ -316,13 +316,13 @@ void Volume::Voxelize(const T* const points, const uint32_t stridePoints, const + + double d[3] = { m_maxBB[0] - m_minBB[0], m_maxBB[1] - m_minBB[1], m_maxBB[2] - m_minBB[2] }; + double r; +- if (d[0] > d[1] && d[0] > d[2]) { ++ if (d[0] >= d[1] && d[0] >= d[2]) { + r = d[0]; + m_dim[0] = dim; + m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[0]); + m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[0]); + } +- else if (d[1] > d[0] && d[1] > d[2]) { ++ else if (d[1] >= d[0] && d[1] >= d[2]) { + r = d[1]; + m_dim[1] = dim; + m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[1]); diff --git a/thirdparty/vhacd/inc/vhacdVolume.h b/thirdparty/vhacd/inc/vhacdVolume.h index 8c47fa1e2c..c445f20122 100644 --- a/thirdparty/vhacd/inc/vhacdVolume.h +++ b/thirdparty/vhacd/inc/vhacdVolume.h @@ -316,13 +316,13 @@ void Volume::Voxelize(const T* const points, const uint32_t stridePoints, const double d[3] = { m_maxBB[0] - m_minBB[0], m_maxBB[1] - m_minBB[1], m_maxBB[2] - m_minBB[2] }; double r; - if (d[0] > d[1] && d[0] > d[2]) { + if (d[0] >= d[1] && d[0] >= d[2]) { r = d[0]; m_dim[0] = dim; m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[0]); m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[0]); } - else if (d[1] > d[0] && d[1] > d[2]) { + else if (d[1] >= d[0] && d[1] >= d[2]) { r = d[1]; m_dim[1] = dim; m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[1]); |