From 30fbfad8f9a0db79e56fbfe7670914492afe90fe Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Tue, 13 Aug 2019 07:29:14 +0930 Subject: [PATCH] Change scale factor during subdivision --- thirdparty/nodemesh/nodemesh/misc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/thirdparty/nodemesh/nodemesh/misc.cpp b/thirdparty/nodemesh/nodemesh/misc.cpp index f5ebc3bc..ebab69a0 100644 --- a/thirdparty/nodemesh/nodemesh/misc.cpp +++ b/thirdparty/nodemesh/nodemesh/misc.cpp @@ -533,12 +533,13 @@ void nodemesh::trim(std::vector *vertices, bool normalize) void nodemesh::subdivideFace2D(std::vector *face) { auto oldFace = *face; + float scaleFactor = oldFace.size() == 4 ? 0.8 : 1.0; face->clear(); for (size_t i = 0; i < oldFace.size(); ++i) { size_t j = (i + 1) % oldFace.size(); QVector2D direct = (oldFace[i] + oldFace[j]).normalized(); - float length = (oldFace[i].length() + oldFace[j].length()) * 0.4; // 0.4 = 0.5 * 0.8 - face->push_back(oldFace[i] * 0.8); + float length = (oldFace[i].length() + oldFace[j].length()) * 0.5 * scaleFactor; + face->push_back(oldFace[i] * scaleFactor); face->push_back(direct * length); } }