1
$\begingroup$

I want to make a cotourplot given by

con = ContourPlot3D[
   Sin[x] Sin[y] + Sin[z] Sin[y] + Sin[x] Sin[z] + 1 == 
    0.000001, {x, -2 \[Pi], 2 \[Pi]}, {y, -2 \[Pi], 
    2 \[Pi]}, {z, -2 \[Pi], 2 \[Pi]}];

with in a region given by

a = 1; b = \[Pi]/4; p1 = {{\[Pi], -3 b, -5 b}, {\[Pi], -5 b, -3 b}, \
{0, -7 b, -b}, {-\[Pi], -5 b, -3 b}, {-\[Pi], -3 b, -5 b}, {0, -b, -7 \
b}};
p2 = {{\[Pi], 5 b, 3 b}, {\[Pi], 3 b, 5 b}, {0, b, 7 b}, {-\[Pi], 3 b,
     5 b}, {-\[Pi], 5 b, 3 b}, {0, 7 b, b}};
p3 = {{\[Pi], -3 b, -5 b}, {\[Pi], 5 b, 3 b}, {\[Pi], 3 b, 
    5 b}, {\[Pi], -5 b, -3 b}};
p4 = {{\[Pi], 3 b, 5 b}, {\[Pi], -5 b, -3 b}, {0, -7 b, -b}, {0, b, 
    7 b}};
p5 = {{0, -7 b, -b}, {0, b, 7 b}, {-\[Pi], 3 b, 
    5 b}, {-\[Pi], -5 b, -3 b}};
p6 = {{-\[Pi], 3 b, 
    5 b}, {-\[Pi], -5 b, -3 b}, {-\[Pi], -3 b, -5 b}, {-\[Pi], 5 b, 
    3 b}};
p7 = {{-\[Pi], -3 b, -5 b}, {-\[Pi], 5 b, 3 b}, {0, 7 b, 
    b}, {0, -b, -7 b}};
p8 = {{0, 7 b, b}, {0, -b, -7 b}, {\[Pi], -3 b, -5 b}, {\[Pi], 5 b, 
    3 b}};
R = DelaunayMesh[
   Partition[Flatten[{p1, p2, p3, p4, p5, p6, p7, p8}], 3]];

I tried with the following

Show[Graphics3D[{Purple, Opacity[0.2], 
   Polygon[{p1, p2, p3, p4, p5, p6, p7, p8}]}, Opacity[0.4]], con]

which does not work. Can anyone kindly help me in this regard? Thanks in advance.

$\endgroup$
2
  • $\begingroup$ Graphics3D[{{Purple, Opacity[0.2], Polygon[{p1, p2, p3, p4, p5, p6, p7, p8}]}, Opacity[0.4], con // First}] $\endgroup$
    – cvgmt
    Jun 2, 2023 at 2:51
  • $\begingroup$ Thanks for your respose. But wish to get the plot only inside the region R. Can you please help me to get that? $\endgroup$
    – atanu
    Jun 2, 2023 at 3:01

1 Answer 1

5
$\begingroup$
RegionFunction -> Function[{x, y, z}, {x, y, z} ∈ R]

Or

RegionFunction -> Function[{x, y, z}, RegionMember[R, {x, y, z}]]
Clear[con];
con = ContourPlot3D[
   Sin[x] Sin[y] + Sin[z] Sin[y] + Sin[x] Sin[z] + 1 == 
    0.000001, {x, -2 π, 2 π}, {y, -2 π, 
    2 π}, {z, -2 π, 2 π}, 
   RegionFunction -> Function[{x, y, z}, {x, y, z} ∈ R], 
   RegionBoundaryStyle -> None, BoundaryStyle -> None];
Graphics3D[{{Purple, Opacity[0.2], 
   Polygon[{p1, p2, p3, p4, p5, p6, p7, p8}]}, Opacity[0.4], 
  con // First}]

enter image description here

  • When we rewrite the equation to Sin[x] Sin[y] + Sin[z] Sin[y] + Sin[x] Sin[z] + .9 == 0.000001, we can see the surface.

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks a lot for your solution. This works very well. Is it possible to removes the black lines from the boundaries of the poligon surfaces ? I want just to keep the contour which satiesfies Sin[x] Sin[y] + Sin[z] Sin[y] + Sin[x] Sin[z] + 1 == 0.000001. $\endgroup$
    – atanu
    Jun 2, 2023 at 3:42
  • $\begingroup$ @atanu BoundaryStyle -> None. $\endgroup$
    – cvgmt
    Jun 2, 2023 at 4:43
  • $\begingroup$ Thanks for the help $\endgroup$
    – atanu
    Jun 2, 2023 at 4:45

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.