cone[heiht_, base_, {x_, y_, z_}, {ax_, ay_, az_}] :=
Module[{c1, c2, c3, c4, c5},
c1 = RevolutionPlot3D[{t, -heiht *t*2}, {t, 0, base}, Mesh -> None];
c2 = Rotate[c1[[1]], ax, {1, 0, 0}];
c3 = Rotate[c2, ay, {0, 1, 0}];
c4 = Rotate[c3, az, {0, 0, 1}];
c5 = Translate[c4, {x, y, z + heiht*base}];
c5
]
torus := {};
snowman3D[bodyRadius_] := Module[
{bodyCenter = {0, 0, 0},
torsoRadius = bodyRadius/GoldenRatio,
headRadius = bodyRadius/GoldenRatio^2,
torsoCenter,
headCenter,
leftShoulder,
rightShoulder,
buttonSize = bodyRadius/10,
buttonStp = bodyRadius/3.3,
leftHand,
rightHand,
mouthCenter,
leftEyeCenter,
rightEyeCenter},
(*************************************************)
(*************************************************)
torsoCenter = {
bodyCenter[[1]],
bodyCenter[[2]],
bodyRadius + torsoRadius};
headCenter = {bodyCenter[[1]], bodyCenter[[2]],
bodyRadius + 2 torsoRadius + headRadius};
leftShoulder =
torsoCenter + {torsoRadius*Sin[-Pi/3], 0, torsoRadius*Cos[-Pi/3]};
leftHand =
torsoCenter + {2.5 torsoRadius*Sin[-Pi/3], 0,
3 torsoRadius*Cos[-Pi/3]};
rightShoulder =
torsoCenter + {torsoRadius*Sin[Pi/3], 0, torsoRadius*Cos[Pi/3]};
rightHand =
torsoCenter + {2.5 torsoRadius*Sin[Pi/3], 0,
3 torsoRadius*Cos[Pi/3]};
leftEyeCenter =
headCenter + {0.5 headRadius*Sin[-Pi/4], -0.8 headRadius,
0.5 headRadius*Cos[-Pi/4]};
rightEyeCenter =
headCenter + {0.5 headRadius*Sin[Pi/4], -0.8 headRadius,
0.5 headRadius*Cos[Pi/4]};
mouthCenter =
headCenter + {0.75 headRadius*Sin[Pi], -25,
0.75 headRadius*Cos[Pi]};
(*************************************************)
(*************************************************)
Graphics3D[{
Sphere[bodyCenter, bodyRadius],
Sphere[torsoCenter, torsoRadius],
Sphere[headCenter, headRadius],
Cylinder[{leftShoulder, leftHand}, 1.5],
Cylinder[{rightShoulder, rightHand}, 1.5],
Sphere[leftEyeCenter, headRadius/4],
Sphere[rightEyeCenter, headRadius/4],
cone[headRadius/4, headRadius/4,
headCenter - {headRadius/8, 2 headRadius,
0.75 headRadius}, {90 Degree, 180 Degree, -5 Degree}]},
Axes -> True, AxesLabel -> {"x", "y", "z"}
]
];
snowman3D[30]
效果图: