To find the volume of a regular polygon circumscribed around a triangular prism, we first need to find some measures of the polygon.
Let 'n' be the number of sides of the regular polygon, 'a' be the length of each side, 'h' be the height of the triangular prism and 'r' be the radius of the circumcircle of the polygon.
The formula to find 'a' is a = (2 * h) / (n * √3).
The formula to find 'r' is r = (a / 2) / sin(π/n).
Once we have 'a' and 'r', we can find the area of the polygon using the formula:
Area = (n * a^2) / (4 * tan(π/n)).
Now, the volume of the prism can be calculated using the formula:
Volume = Area * h.
Here is the code to implement the above formulas in JavaScript:
457 chars15 lines
gistlibby LogSnag