Skip to content

Commit 48c6786

Browse files
committed
PolygonalVertexes by length
1 parent 31de713 commit 48c6786

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CSMath/Geometry/CurveExtensions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@ public static List<XYZ> PolygonalVertexes(int precision, XYZ center, double star
6060
return points;
6161
}
6262

63+
/// <summary>
64+
/// Converts a curve into a list of vertexes.
65+
/// </summary>
66+
/// <param name="length"></param>
67+
/// <param name="center"></param>
68+
/// <param name="startAngle"></param>
69+
/// <param name="endAngle"></param>
70+
/// <param name="radius"></param>
71+
/// <param name="normal"></param>
72+
/// <returns></returns>
73+
public static List<XYZ> PolygonalVertexes(double length, XYZ center, double startAngle, double endAngle, double radius, XYZ normal)
74+
{
75+
var longitude = 2 * Math.PI * radius;
76+
77+
int nsegments = (int)Math.Ceiling(longitude / length);
78+
79+
if (nsegments < 2)
80+
{
81+
nsegments = 3;
82+
}
83+
84+
return PolygonalVertexes(nsegments, center, startAngle, endAngle, radius, normal);
85+
}
86+
6387
/// <summary>
6488
/// Converts an elliptical curve into a list of vertexes.
6589
/// </summary>

0 commit comments

Comments
 (0)