From 013c671451a230b6c2db9d96de59fa0a7e6a0593 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Thu, 11 Jul 2019 22:22:44 +0930 Subject: [PATCH] Fix intermediate nodes generation --- thirdparty/nodemesh/nodemesh/builder.cpp | 1 + thirdparty/nodemesh/nodemesh/modifier.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/thirdparty/nodemesh/nodemesh/builder.cpp b/thirdparty/nodemesh/nodemesh/builder.cpp index 30fefc3f..2f27d942 100644 --- a/thirdparty/nodemesh/nodemesh/builder.cpp +++ b/thirdparty/nodemesh/nodemesh/builder.cpp @@ -490,6 +490,7 @@ bool Builder::generateCutsForNode(size_t nodeIndex) revisedNearCutNormal = &farOriginNode.cutNormal; revisedFarCutNormal = &node.cutNormal; } + distanceFactor *= 1.75; if (QVector3D::dotProduct(*revisedNearCutNormal, *revisedFarCutNormal) <= 0) cutNormal = (*revisedNearCutNormal * (1.0 - distanceFactor) - *revisedFarCutNormal * distanceFactor).normalized(); else diff --git a/thirdparty/nodemesh/nodemesh/modifier.cpp b/thirdparty/nodemesh/nodemesh/modifier.cpp index 9001989e..26b3e756 100644 --- a/thirdparty/nodemesh/nodemesh/modifier.cpp +++ b/thirdparty/nodemesh/nodemesh/modifier.cpp @@ -105,12 +105,12 @@ void Modifier::finalize() for (const auto &edge: oldEdges) { const Node &firstNode = m_nodes[edge.firstNodeIndex]; const Node &secondNode = m_nodes[edge.secondNodeIndex]; - float edgeLengthThreshold = (firstNode.radius + secondNode.radius) * 0.75; + //float edgeLengthThreshold = (firstNode.radius + secondNode.radius) * 0.75; auto firstAverageCutTemplateEdgeLength = averageCutTemplateEdgeLength(firstNode.cutTemplate) * firstNode.radius; auto secondAverageCutTemplateEdgeLength = averageCutTemplateEdgeLength(secondNode.cutTemplate) * secondNode.radius; float targetEdgeLength = (firstAverageCutTemplateEdgeLength + secondAverageCutTemplateEdgeLength) * 0.5; - if (targetEdgeLength < edgeLengthThreshold) - targetEdgeLength = edgeLengthThreshold; + //if (targetEdgeLength < edgeLengthThreshold) + // targetEdgeLength = edgeLengthThreshold; float currentEdgeLength = (firstNode.position - secondNode.position).length(); if (targetEdgeLength >= currentEdgeLength) { addEdge(edge.firstNodeIndex, edge.secondNodeIndex);