diff --git a/dust3d/mesh/rope_mesh.cc b/dust3d/mesh/rope_mesh.cc index 95b40124..9cf4c192 100644 --- a/dust3d/mesh/rope_mesh.cc +++ b/dust3d/mesh/rope_mesh.cc @@ -87,9 +87,11 @@ void RopeMesh::addRope(const std::vector& positions, bool isCircle) Vector3 baseNormal = isCircle ? BaseNormal::calculateCircleBaseNormal(nodePositions) : BaseNormal::calculateTubeBaseNormal(nodePositions); std::vector> circles; circles.reserve(nodePositions.size()); + Vector3 forwardDirection; for (size_t i = 0; i < nodePositions.size(); ++i) { size_t j = (i + 1) % nodePositions.size(); - Vector3 forwardDirection = (nodePositions[j] - nodePositions[i]).normalized(); + if (isCircle || i + 1 < nodePositions.size()) + forwardDirection = (nodePositions[j] - nodePositions[i]).normalized(); auto circlePositions = BaseNormal::calculateCircleVertices(m_buildParameters.defaultRadius, m_buildParameters.sectionSegments, forwardDirection, diff --git a/dust3d/mesh/section_preview_mesh_builder.cc b/dust3d/mesh/section_preview_mesh_builder.cc index 9d12156d..741eb307 100644 --- a/dust3d/mesh/section_preview_mesh_builder.cc +++ b/dust3d/mesh/section_preview_mesh_builder.cc @@ -84,7 +84,7 @@ void SectionPreviewMeshBuilder::build() RopeMesh ropeMesh(ropeParameters); ropeMesh.addRope(cutFaceVertices, true); for (size_t i = 0; i < cutFaceVertices.size(); ++i) { - ropeMesh.addRope({ cutFaceVertices[i], cutFaceVertices[i] - Vector3(0.0, 0.0, 2.0) }, false); + ropeMesh.addRope({ cutFaceVertices[i], cutFaceVertices[i] - Vector3(0.0, 0.0, 1.5) }, false); } for (const auto& it : ropeMesh.resultVertices()) { m_resultVertices.push_back(it);