SOLVED Calculate the rounding radius max value of a n-Side object

Hi,
I'm searching how to calculate the rounding radius maximum value of a n-Side object.
I tried with the following but it doesn't work:

Float calculateSide(Int32 n, Float r)
{
	Float theta, theta_in_radians;
	theta = 360 / n;
	theta_in_radians = theta * 3.14 / 180;
	return 2 * r * sin(theta_in_radians / 2);
}


Float	max_rrad = calculateSide(n, r)/2;

Thanks

Assuming you mean a regular polygon, the maximum rounding radius is the same as the incircle of the polygon (as at this point all roundings touch and form a circle).

For formulas, see e.g.
https://www.mathopenref.com/polygonincircle.html

Assuming you mean a regular polygon, the maximum rounding radius is the same as the incircle of the polygon (as at this point all roundings touch and form a circle).

For formulas, see e.g.
https://www.mathopenref.com/polygonincircle.html

@Cairyn
Hi,
Thank you.

Solution:

Float GeIncircle(Int32 n, Float r)
{
	return r * cos(PI / n);
}

Float	max_rrad = GeIncircle(n, r);