Reputation: 380
I tried to plot a 3D surface using Maxima, which I did achieve using the following code
load(draw);
draw3d(xlabel="x", ylabel="y", zlabel="z",
proportional_axes=xyz,
enhanced3d=true, colorbox=false,
xtics=0.5, ytics=0.5, ztics=0.5,
implicit(x^2+y^2+z^2<=1,
x,-2,2,
y,-2,2,
z,0,1)
);
The above code plots a semi-sphere
Note: This is a hollow semi-sphere
My question is if it's possible to plot everything except the semi-sphere, fill all the area around it. Or even plot a filled semi-sphere instead of a hollow semi-sphere.
My goal is to plot the function y >= x^2; z >= 0
What I got until now is this
draw3d(
implicit(y=x^2,
x,-4,4,
y,0,2,
z,0,4)
);
Also, on 2D plane there is something that looks like what I want, in fact I couldn't make it work on 3D space
draw2d(
key="y >= x^2",
fill_color = blue,
filled_func = x^2,
explicit(0,x,-4,4),
user_preamble="set key at 0.5, 15"
)$
I accept sugestions of other softwares that can achieve what I want.
Upvotes: 1
Views: 246
Reputation: 15093
gnuplot version 5.4 (current)
set xyplane 0
set pm3d depthorder lighting spec 0.5
set angle degrees
set xrange [-1:1]
set yrange [-1:1]
set zrange [ 1:0]
set view equal xyz
set view 300, 24, 1.4
unset border
unset key
unset colorbox
set sample 100; set isosample 100
set palette cubehelix negative
set zlabel "Z"
set ztics 1; unset xtics; unset ytics
set walls x0 fillstyle solid 1.0 fillcolor "gray"
set walls x1 fillstyle solid 1.0 fillcolor "gray"
set walls y0 fillstyle solid 1.0 fillcolor "gray"
set walls y1 fillstyle solid 1.0 fillcolor "gray"
# First draw the surface of the hemisphere
# Then draw the part of the plane z=0 that is outside of it
# and finally the other sides of the box
splot sample [u=0:90:3][v=0:360:5] '++' \
using (cos($1)*cos($2)) : (cos($1)*sin($2)) : (sin($1)) with pm3d, \
[u=-1:1][v=-1:1] '++' \
using 1:2:($1*$1+$2*$2>=1 ? 0.0 : NaN) with pm3d fc "gray55", \
[u=-1:1][v=-1:1] '++' using 1:2:( 1.0 ) with pm3d fc "gray55", \
[u=-1:1][v=0:1] '++' using 1:(-1):2 with pm3d fc "gray55", \
[u=-1:1][v=0:1] '++' using 1:( 1):2 with pm3d fc "gray55", \
[u=-1:1][v=0:1] '++' using ( 1):1:2 with pm3d fc "gray55", \
[u=-1:1][v=0:1] '++' using (-1):1:2 with pm3d fc "gray55"
The lighting model was not designed to allow proper illumination from underneath, so flipping the viewpoint around to look "up" into the bowl does not work so well.
The imperfections at the four sides are because the surface of the bowl and the surface of the box sides touch. It would look nicer to expand the box to +/-(1+epsilon).
Upvotes: 1