Skip to content

Commit b375ce5

Browse files
committed
utli fn
1 parent aa4f55d commit b375ce5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

curve/Circle2.cs

+7
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,12 @@ public static double RadiusCircumference(double r) {
152152
return MathUtil.TwoPI * r;
153153
}
154154

155+
/// <summary>
156+
/// Radius of n-sided regular polygon that contains circle of radius r
157+
/// </summary>
158+
public static double BoundingPolygonRadius(double r, int n) {
159+
double theta = (MathUtil.TwoPI / (double)n) / 2.0;
160+
return r / Math.Cos(theta);
161+
}
155162
}
156163
}

0 commit comments

Comments
 (0)