# Define a region of revolution

My goal is to use "RegionCentroid" on a solid of revolution.

This works great for 2d regions:

reg = ImplicitRegion[0 <= y <= 20 - 2 x, {{x, 0, 10}, {y, 0, 20}}];

RegionPlot[reg]

RegionCentroid[reg]


I've been playing with my code for a while now and I can't seem to figure out how to revolve the region around the axis of my choice (in this case y)

## 1 Answer

You can use the new in V12.1 OpenCascaeLink to do something like this. It's not quite the way you want it but works well.

Define a 3D polygon of the surface you want to compute

pp = Polygon[{{0, 0, 0}, {10, 0, 0}, {0, 0, 20}}];
Graphics3D[pp]


Next, load the package and convert the polygon into an OpenCascade shape

Needs["OpenCascadeLink"]
shape = OpenCascadeShape[pp];


Specify the axis around which you want to perform the rotational sweep and how much you want to sweep.

axis = {{0, 0, 0}, {0, 0, 25}};
sweep = OpenCascadeShapeRotationalSweep[shape, axis, 3 \[Pi]/2]


Extract the result as a boundary element mesh and visualize:

bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[sweep];
Show[Graphics3D[{{Red, pp}, {Blue, Thick, Arrow[axis]}}],
bmesh["Wireframe"], Boxed -> False]


Compute the region centroid:

RegionCentroid[MeshRegion[bmesh]]
{-0.767186, 0.767186, 5.0352}
`
• (+1) Nice answer :) Apr 6, 2020 at 15:15
• Thank you so much for the answer! i learned a lot from this Apr 7, 2020 at 23:43