Skip to content

Commit 94cc8db

Browse files
committed
Force limit on complexity of dynamic track sections to prevent overflow errors
1 parent ac798e9 commit 94cc8db

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Source/RunActivity/Viewer3D/DynamicTrack.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,9 @@ public virtual void CircArcGen()
15081508
}
15091509
break;
15101510
}
1511+
// Limit the number of sections to prevent overflowing the number of triangles
1512+
if (NumSections > 250)
1513+
NumSections = 250;
15111514
// Ensure an even number of sections
15121515
if (NumSections % 2 == 1)
15131516
NumSections++;

Source/RunActivity/Viewer3D/SuperElevation.cs

+3
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ public override void LinearGen()
838838
// Very short length track, use minimum of two sections
839839
if (NumSections == 0)
840840
NumSections = 2;
841+
// Limit the number of sections to prevent overflowing the number of triangles
842+
else if (NumSections > 250)
843+
NumSections = 250;
841844
// Ensure an even number of sections
842845
if (NumSections % 2 == 1)
843846
NumSections++;

0 commit comments

Comments
 (0)