Skip to content

Commit 1337f2f

Browse files
srseilCopilot
andauthored
Remove unnecessary extra work during triangulation building
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 448efa7 commit 1337f2f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

CADability/BSpline2D.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,10 +1138,10 @@ private double[] GetTriangulationKnots()
11381138
// turning angle so the resulting triangles stay tight enough to bound the curve.
11391139
const double maxSpanAngle = Math.PI / 4.0; // 45° per sub-span
11401140
List<double> res = new List<double>(tknots.Length);
1141+
GeoVector2D d0 = DirectionAtParam(tknots[0]);
11411142
for (int i = 0; i < tknots.Length - 1; i++)
11421143
{
11431144
res.Add(tknots[i]);
1144-
GeoVector2D d0 = DirectionAtParam(tknots[i]);
11451145
GeoVector2D d1 = DirectionAtParam(tknots[i + 1]);
11461146
if (!d0.IsNullVector() && !d1.IsNullVector())
11471147
{
@@ -1154,6 +1154,7 @@ private double[] GetTriangulationKnots()
11541154
res.Add(tknots[i] + (tknots[i + 1] - tknots[i]) * j / sub);
11551155
}
11561156
}
1157+
d0 = d1;
11571158
}
11581159
res.Add(tknots[tknots.Length - 1]);
11591160
return res.ToArray();

0 commit comments

Comments
 (0)