Fix intermediate nodes generation

master
Jeremy Hu 2019-07-11 22:22:44 +09:30
parent 81fec2ed44
commit 013c671451
2 changed files with 4 additions and 3 deletions

View File

@ -490,6 +490,7 @@ bool Builder::generateCutsForNode(size_t nodeIndex)
revisedNearCutNormal = &farOriginNode.cutNormal; revisedNearCutNormal = &farOriginNode.cutNormal;
revisedFarCutNormal = &node.cutNormal; revisedFarCutNormal = &node.cutNormal;
} }
distanceFactor *= 1.75;
if (QVector3D::dotProduct(*revisedNearCutNormal, *revisedFarCutNormal) <= 0) if (QVector3D::dotProduct(*revisedNearCutNormal, *revisedFarCutNormal) <= 0)
cutNormal = (*revisedNearCutNormal * (1.0 - distanceFactor) - *revisedFarCutNormal * distanceFactor).normalized(); cutNormal = (*revisedNearCutNormal * (1.0 - distanceFactor) - *revisedFarCutNormal * distanceFactor).normalized();
else else

View File

@ -105,12 +105,12 @@ void Modifier::finalize()
for (const auto &edge: oldEdges) { for (const auto &edge: oldEdges) {
const Node &firstNode = m_nodes[edge.firstNodeIndex]; const Node &firstNode = m_nodes[edge.firstNodeIndex];
const Node &secondNode = m_nodes[edge.secondNodeIndex]; 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 firstAverageCutTemplateEdgeLength = averageCutTemplateEdgeLength(firstNode.cutTemplate) * firstNode.radius;
auto secondAverageCutTemplateEdgeLength = averageCutTemplateEdgeLength(secondNode.cutTemplate) * secondNode.radius; auto secondAverageCutTemplateEdgeLength = averageCutTemplateEdgeLength(secondNode.cutTemplate) * secondNode.radius;
float targetEdgeLength = (firstAverageCutTemplateEdgeLength + secondAverageCutTemplateEdgeLength) * 0.5; float targetEdgeLength = (firstAverageCutTemplateEdgeLength + secondAverageCutTemplateEdgeLength) * 0.5;
if (targetEdgeLength < edgeLengthThreshold) //if (targetEdgeLength < edgeLengthThreshold)
targetEdgeLength = edgeLengthThreshold; // targetEdgeLength = edgeLengthThreshold;
float currentEdgeLength = (firstNode.position - secondNode.position).length(); float currentEdgeLength = (firstNode.position - secondNode.position).length();
if (targetEdgeLength >= currentEdgeLength) { if (targetEdgeLength >= currentEdgeLength) {
addEdge(edge.firstNodeIndex, edge.secondNodeIndex); addEdge(edge.firstNodeIndex, edge.secondNodeIndex);