Define pyramid and cylinder by functions f(x,y,z) >= 0

233 Views Asked by At

Need help for this question!

My thought process:

  1. Define the shapes individually

For cylinder with radius 0.5 I got the function $(0.5^2-x^2-z^2, 2-y, 0.5-x, 0.5-z, y-0)$

Cylinder $r=0.25$
$0.25^2-x^2-z^2, 2-y, 0.25-x, 0.25-z, y-0$

Not sure how to continue from here. May I know how do I define the pyramid in $f(x,y,z) >= 0$ functions and combine the 3 shapes into the final solid object?

Thank you!

1

There are 1 best solutions below

0
On

Calling

$$ \cases{ p=(x,y,z)\\ p_0=(0,0,1)\\ p_1=(0,-2,0)\\ p_2=(2,0,0)\\ p_3=(0,2,0)\\ } $$

we can define the planes

$$ \cases{ \Pi_1\to ((p_2-p_1)\times (p_1-p_0))\cdot(p-p_0)=0\\ \Pi_2\to ((p_3-p_2)\times (p_2-p_0))\cdot(p-p_0)=0\\ \Pi_3\to (1,0,0)\cdot(p-p_0)=0\\ \Pi_4\to (0,0,1)\cdot p = 0 } $$

and then we can model two solids to be added giving the needed result. Follows a MATHEMATICA script showing the procedure.

p = {x, y, z};
p0 = {0, 0, 1};
p1 = {0, -2, 0};
p2 = {2, 0, 0};
p3 = {0, 2, 0};
P1 = Cross[p2 - p1, p1 - p0].(p - p0)
P2 = Cross[p3 - p2, p2 - p0].(p - p0)
P3 = {1, 0, 0}.(p - p0)
P4 = {0, 0, 1}.p
gr1 = RegionPlot3D[0.25`^2 < x^2 + y^2 && x^2 + y^2 < 0.5`^2 && 0 < z && z < 2 && x > 0, {x, -2, 2}, {y, -2, 2}, {z, 0, 2}, PlotPoints -> 150, Mesh -> None];
gr2 = RegionPlot3D[x^2 + y^2 > 0.5`^2 && P4 > 0 && P3 > 0 && P1 > 0 && P2 > 0, {x, -2, 2}, {y, -2, 2}, {z, 0, 2}, PlotPoints -> 150, Mesh -> None];
Show[gr1,gr2]

enter image description here