3
$\begingroup$

I need to find the surface area of a region which is within another region. The regions I'm working with are fairly complex and so I'm looking for a general solution, but I'll use a cylinder and tetrahedron as an example.

Lets say I have the following regions:

Container = Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1];
MyRegion = Tetrahedron[{{0, 2, 0}, {0, -2, 0}, {-2, 0, 0}, {0, 0, 2.5}}];

I want to find the surface area of MyRegion which is contained by ContainerThe way I imagined doing this was using RegionIntersection, finding a boundary mesh, and then using Area. Then I would need to somehow figure out what area of the intersection is not in common with the boundary of MyRegion, but I'm not sure how to approach that or if that is even the best method. Any suggestions?

Edit:

My code generates a function that is used in an implicit region - so its not always the same. I've included a sample one below (sorry - I was trying to avoid posting such a large function). Technically I'm just interested in the surface area, but as I have it, the ImplicitRegion it will be a volume.

f[x_,y_,z_]:=0.564936 Log[(
   6.2 + 2 Sqrt[((-3.1 + y)^2 + (-1.67 + z)^2)^2 + (-3.1 - Abs[0. + x])^2] + 
   2 Abs[0. + x])/(-6.2 + 2 Sqrt[((-3.1 + y)^2 + (-1.67 + z)^2)^2 + (3.1 - 
        Abs[0. + x])^2] + 2 Abs[0. + x])] + 
    0.564936 Log[(6.2 + 2 Sqrt[((3.1 + y)^2 + (-1.67 + z)^2)^2 + (-3.1 - 
        Abs[0. + x])^2] + 2 Abs[0. + x])/(-6.2 + 2 Sqrt[((3.1 + y)^2 + 
    (-1.67 + z)^2)^2 + (3.1 - Abs[0. + x])^2] + 2 Abs[0. + x])] - 
    0.564936 Log[(6.2 + 2 Sqrt[((0. + y)^2 + (0. + z)^2)^2 + (-3.1 - 
        Abs[0. + x])^2] + 2 Abs[0. + x])/(-6.2 + 2 Sqrt[((0. + y)^2 + 
    (0. + z)^2)^2 + (3.1 - Abs[0. + x])^2] + 2 Abs[0. + x])] + 
    0.564936 Log[(6.2 + 2 Sqrt[((-3.1 + x)^2 + (-1.67 + z)^2)^2 + (-3.1 - 
        Abs[0. + y])^2] + 2 Abs[0. + y])/(-6.2 + 2 Sqrt[((-3.1 + x)^2 + 
    (-1.67 + z)^2)^2 + (3.1 - Abs[0. + y])^2] + 2 Abs[0. + y])] + 
    0.564936 Log[(6.2 + 2 Sqrt[((3.1 + x)^2 + (-1.67 + z)^2)^2 + (-3.1 - 
        Abs[0. + y])^2] + 2 Abs[0. + y])/(-6.2 + 
    2 Sqrt[((3.1 + x)^2 + (-1.67 + z)^2)^2 + (3.1 - Abs[0. + y])^2] + 
    2 Abs[0. + y])] - 0.564936 Log[(6.2 + 2 Sqrt[((-3.1 + x)^2 + 
    (0. + z)^2)^2 + (-3.1 - Abs[0. + y])^2] + 2 Abs[0. + y])/(-6.2 + 
    2 Sqrt[((-3.1 + x)^2 + (0. + z)^2)^2 + (3.1 - Abs[0. + y])^2] + 
    2 Abs[0. + y])] - 0.564936 Log[(6.2 + 2 Sqrt[((3.1 + x)^2 + 
    (0. + z)^2)^2 + (-3.1 - Abs[0. + y])^2] + 2 Abs[0. + y])/(-6.2 + 
    2 Sqrt[((3.1 + x)^2 + (0. + z)^2)^2 + (3.1 - Abs[0. + y])^2] + 
    2 Abs[0. + y])] + 0.564936 Log[(1.51 + 2 Sqrt[((-3.1 + x)^2 +
    (-3.1 + y)^2)^2 + (-0.755 - Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])/
    (-1.51 + 2 Sqrt[((-3.1 + x)^2 + (-3.1 + y)^2)^2 + (0.755 - Abs[-0.915 +   
    z])^2] + 2 Abs[-0.915 + z])] + 0.564936 Log[(1.51 + 2 Sqrt[((3.1 + x)^2 + 
    (-3.1 + y)^2)^2 + (-0.755 - Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])/
    (-1.51 + 2 Sqrt[((3.1 + x)^2 + (-3.1 + y)^2)^2 + (0.755 - 
        Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])] + 0.564936 Log[(
   1.51 + 2 Sqrt[((-3.1 + x)^2 + (3.1 + y)^2)^2 + (-0.755 - Abs[-0.915 + z])^2]   + 2 Abs[-0.915 + z])/(-1.51 + 2 Sqrt[((-3.1 + x)^2 + (3.1 + y)^2)^2 + (0.755 - 
        Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])] + 0.564936 Log[(
   1.51 + 2 Sqrt[((3.1 + x)^2 + (3.1 + y)^2)^2 + (-0.755 - 
   Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])/(-1.51 + 2 Sqrt[((3.1 + x)^2 + 
   (3.1 + y)^2)^2 + (0.755 - Abs[-0.915 + z])^2] + 2 Abs[-0.915 + z])] - 
 0.564936 Log[(1.67 + 2 Sqrt[((0. + x)^2 + (0. + y)^2)^2 + (-0.835 - 
 Abs[-0.835 + z])^2] + 2 Abs[-0.835 + z])/(-1.67 + 2 Sqrt[((0. + x)^2 
 + (0. + y)^2)^2 + (0.835 - Abs[-0.835 + z])^2] + 2 Abs[-0.835 + z])];

MyRegion=ImplicitRegion[f[x, y, z] >=  5, {{x, -5.3, 5.3}, {y, -5.3, 5.3}, {z, 0, 1.67}}]

Container=Cylinder[{{0,0,0},{0,0,1.67}},5.3]
$\endgroup$
2
  • 1
    $\begingroup$ In principle, you could just do Area[RegionIntersection[RegionBoundary[myRegion], container]], but I'm not near a Mathematica instance right now to try it out and I recall it having trouble with intersections of regions of different dimensionalities. $\endgroup$
    – user484
    Jul 14, 2015 at 20:07
  • 1
    $\begingroup$ @Rahul Like you said, it doesn't quite work since RegionBoundary[MyRegion] is of a different dimension than Container $\endgroup$
    – BenP1192
    Jul 14, 2015 at 21:39

1 Answer 1

4
$\begingroup$

If I understand the question correctly, one possibility is to decompose the surface of the Tetrahedron into four triangles, intersect each with Container, compute the Area of the resulting planar objects, and sum them.

Area[RegionIntersection[Polygon[#], Container]] & /@ 
  Subsets[{{0, 2, 0}, {0, -2, 0}, {-2, 0, 0}, {0, 0, 2.5}}, {3}] // Total
(* 7.98614 *)

Generalization to an ImplicitRegion

The preceding toy problem could be solved without much difficulty, because the solid Tetrahedron could be replaced by a set of surfaces. As noted in the comment below, the OP would like to compute the area of a truncated ImplicitFunction. If it can be represented as a surface,

ImplicitFuncton[f[x, y, x] == 0, {x, y, z}]];

then the Area of f inside the cylinder given in the Question is

Area[ImplicitFuncton[f[x, y, x] == 0 && x^2 + y^2 < 1 && 2 > z > 0, {x, y, z}]]]

As an example,

Area[ImplicitRegion[x^2 + y^2 + z^2 - 4 == 0 && x^2 + y^2 < 1 && 2 > z > 0, {x, y, z}]]
(* -4 (-2 + Sqrt[3]) π *)

DiscretizeRegion for Complex Regions

Consider a more complex surface, taken for the Applications section of the ImplicitRegion documentation. If it is truncated by a cylinder,

r = ImplicitRegion[x^6 - 5 x^4 y z + 3 x^4 y^2 + 10 x^2 y^3 z + 3 x^2 y^4 - y^5 z + 
  y^6 + z^6 - 1 == 0 && x^2 + y^2 < 1 && 1.2 > z > .8, {x, y, z}];

then Area[r] returns unevaluated. However, DiscretizeRegion combined with NIntegrate works well.

dr = DiscretizeRegion[r]

enter image description here

NIntegrate[1, {x, y, z} ∈ dr]
(* 3.1817 *)

The just added function in the question can be handled similarly.

MyRegion = ImplicitRegion[
   f[x, y, z] == 5, {{x, -5.3, 5.3}, {y, -5.3, 5.3}, {z, 0, 1.67}}] ;
dmr = DiscretizeRegion[MyRegion]

enter image description here

NIntegrate[1, {x, y, z} ∈ dmr]
(* 25.1979 *)

By the way, sometimes decreasing MaxCellMeasure improves integration accuracy by more finely zoning the surface. For instance,

dr = DiscretizeRegion[r, MaxCellMeasure -> {"Area" -> .01}]

improves discretization of the first surface in this section, slightly correcting its area to 3.18411.

$\endgroup$
6
  • $\begingroup$ In reality, I need a more general method since I use complicated Implicit Regions rather than tetrahedrons. Also, I'm trying to understand how what you did works. I tried the following hoping to get 3.14, but it returned 0. Do you know why? Area[RegionIntersection[Polygon[{{3, 0, 0}, {-2, -2, 0}, {-2, 2, 0}}], Sphere[{0, 0, 0}, 1]]] $\endgroup$
    – BenP1192
    Jul 14, 2015 at 22:17
  • $\begingroup$ @BenP1192 A Sphere is hollow. Use Ball instead. $\endgroup$
    – bbgodfrey
    Jul 14, 2015 at 22:25
  • $\begingroup$ @BenP1192 I and others need to know more about your ImplicitRegions. Must they be volumes, or, can they be surfaces? In any case, please provide a sample in Mathematica format. $\endgroup$
    – bbgodfrey
    Jul 14, 2015 at 22:46
  • $\begingroup$ My problem with this solution is that I believe it still includes the area of the top portion of the region. I need to find the area only where f==5, but limited by a container. This means that the region of which I need the surface area is not necessarily a closed region. In this case, the upper bound would be left open. Does that make sense? It's a little difficult to describe. $\endgroup$
    – BenP1192
    Jul 15, 2015 at 14:02
  • $\begingroup$ Nevermind. I wasn't seeing the picture clearly. You're correct, thanks! $\endgroup$
    – BenP1192
    Jul 15, 2015 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.