Possible Bug in Computing Surface Area of Certain Geometric Regions
Until this is fixed in a future version, here is a workaround for now:
Unprotect[RegionBoundary];
RegionBoundary /: Area @ RegionBoundary @ SphericalShell[c_, {ri_, r_}] :=
Area @ Sphere[c, r] + Area @ Sphere[c, ri];
RegionBoundary /: Area @ RegionBoundary @ CapsuleShape[{v1_, v2_}, r_] :=
2 π r (2 r + EuclideanDistance[v2, v1]);
Protect[RegionBoundary];
The idea is to add the definition to RegionBoundary
instead of Area
to avoid returning a wrong value if one applies Area
directly to these 3D
regions. So e.g. these
Area @ CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1];
Area @ SphericalShell[{0, 0, 0}, {3, 4}]
still correctly returns Infinity
as they should; but with RegionBoundary
we get:
Area @ RegionBoundary @ SphericalShell[{0, 0, 0}, {3, 4}]
Area @ RegionBoundary @ CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1]
$100\pi$
$8\pi$
as expected.