Nordstrand[x_, y_,
z_] := (2 (4/3 x)^2 + 2 y^2 + z^2 - 1)^3 - (4/3 x)^2 z^3/10 -
y^2 z^3;
Kuska[x_, y_, z_] := (2*x^2 + y^2 + z^2 - 1)^3 - (1/10)*x^2*z^3 -
y^2*z^3;
Taubin[x_, y_, z_] := (x^2 + (3/2)^2 y^2 + z^2 - 1)^3 -
x^2 z^3 - (3/2)^2/20 y^2 z^3;
Trott[x_, y_, z_] :=
320 *((x^2 + (3/2)^2 y^2 + z^2 - 1)^3 - (x^2) z^3 - (3/2)^2/
20 y^2 z^3)
Manipulate[
Switch[type,
"Nordstrand",
ContourPlot3D[
Nordstrand[x, y, z] == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
Boxed -> False, PlotPoints -> points, MaxRecursion -> max,
PlotRange -> All, ViewPoint -> {2, .1, .5}, BoxRatios -> {1, 1, 1},
Axes -> False, Mesh -> mesh,
ContourStyle -> Directive[col, Specularity[White, 10]],
Epilog ->
Inset[Framed[Style[TraditionalForm[Nordstrand[x, y, z] == 0], 13],
Background -> LightYellow], {Center, Bottom}, {Center,
Bottom}], ImageSize -> {400, 350}]
, "Kuska",
ContourPlot3D[
Kuska[x, y, z] == 0, {x, -0.9, 0.9}, {y, -1.2, 1.2}, {z, -1.2,
1.4}, Boxed -> False, PlotPoints -> points, MaxRecursion -> max,
ViewPoint -> {2, .1, .5}, Axes -> False,
ContourStyle -> Directive[col, Specularity[White, 10]],
Mesh -> mesh,
Epilog ->
Inset[Framed[Style[TraditionalForm[Kuska[x, y, z] == 0], 13],
Background -> LightYellow], {Center, Bottom}, {Center, Bottom}],
ImageSize -> {400, 350}]
, "Taubin",
ContourPlot3D[
Taubin[x, y, z] == 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
Boxed -> False, Axes -> False, PlotPoints -> points,
ContourStyle -> Directive[col, Specularity[White, 10]],
PlotRange -> All, ViewPoint -> {1, 1, .2}
, Epilog ->
Inset[Framed[Style[TraditionalForm[Taubin[x, y, z] == 0], 13],
Background -> LightYellow], {Center, Bottom}, {Center, Bottom}],
ImageSize -> {400, 350}, Mesh -> mesh]
, "Trott",
ContourPlot3D[
Trott[x, y, z] == 0, {x, -3/2, 3/2}, {y, -1, 1}, {z, -3/2, 3/2},
Boxed -> False, PlotPoints -> points, MaxRecursion -> max,
ViewPoint -> {0.26, 3, 0.22}, Axes -> False, Mesh -> mesh,
ContourStyle -> Directive[col, Specularity[White, 10]]
, Epilog ->
Inset[Framed[Style[TraditionalForm[Trott[x, y, z] == 0], 13],
Background -> LightYellow], {Center, Bottom}, {Center, Bottom}],
ImageSize -> {400, 350}]
]
, {{type, "Trott", "heart equation"}, {"Kuska", "Nordstrand",
"Taubin", "Trott"}}
, {{col, Red, "colour"}, Red}
, {{points, 5, "number of sample points"}, 2, 12, 1,
Appearance -> "Labeled"}
, {{max, 1, "max recursion"}, {0, 1, 2, 3, 4, 5},
ControlType -> SetterBar}
, {{mesh, True, "mesh"}, {True, False}}
, ContinuousAction -> False, SaveDefinitions -> True,
TrackedSymbols -> Manipulate
]
图像如下
