Thursday, December 26, 2019

Exercises with 3D Graphics


{x0,y0,z0,s}={.15,-.38,.15,.1};
head=Graphics3D[{LightRed,Sphere[{0,0,0},5*s]}];
nose=Graphics3D[{LightRed,Sphere[{0,y0-.1,-z0+.05},s]}];
mouth=Graphics3D[{Red,Sphere[{0,y0+.075,-2z0},s]}];
eyes=Graphics3D[Table[{Style[Sphere[{i*x0,y0-.06,z0+.02},
s/2],Black],Style[Sphere[{i*x0,y0,z0},s],White]},
{i,{-1,1}}]];
CF=Function[{x,y,z},
ColorData["CandyColors"][Sin[64x]+Cos[y]/8]];
hat=ContourPlot3D[4x^2+4y^2==(z-1.3)^2,
{x,-1,1},{y,-1,1},{z,0.3,1.5},
Mesh->False,ColorFunction->CF,PlotPoints->50];
Show[head,nose,mouth,eyes,hat,Axes->False,
Boxed->False,PlotRange->All,ViewPoint->{-2,-2,.3}]


No comments:

Post a Comment