ParametricPlot3D Question

When I graph:

ParametricPlot3D[
If[11*Cos[t] <= 5,
{9*Cos[s]*Sin[t], 10*Sin[s]*Sin[t],
11*Cos[t]}, Null],
{s, 0, 2*Pi}, {t, 0, Pi}]


I get

but I want to get:

Why does my code generate those spike and etches on top of the partially cut ellipsoid, instead of giving a smooth top like the second picture?

• Hi "user9197"! I edited your question a bit - if you want to see how, click on the "edit/edited" links above. Aug 23, 2013 at 16:48
• Thank You, I wasn't able to add pictures since I did not have enough reputation. Aug 23, 2013 at 16:52
• How did you get 2nd graph? Aug 23, 2013 at 16:53
• I used ContourPlot3D, but I want to make the graph using a parametric setting. Aug 23, 2013 at 16:54

Better solution

Actually, you don't need a different parametrization as I suggest below. I haven't really looked at your formula before which I should have done. The probably best solution is to transform your condition into explicit values for t like this:

Reduce[11*Cos[t] <= 5 && 0 <= t <= Pi, t]

(* ArcCos[5/11] <= t <= Pi *)


ParametricPlot3D[{9*Cos[s]*Sin[t], 10*Sin[s]*Sin[t], 11*Cos[t]},
{s, 0, 2*Pi}, {t, ArcCos[5/11], Pi}]


That's far easier.

Quick Hack

ParametricPlot3D expects 3d point for all input values of s and t. What you do by returning Null is kind of rude and most likely confuses the algorithm which tries to construct a polygon surface.

I would really recommend that you transform your expression into a better parameterization, but for a quick hack it seems sufficient to not return Null but the point on the ring at z=5.

expr = {9*Cos[s]*Sin[t], 10*Sin[s]*Sin[t], 11*Cos[t]};
sol = Last@Solve[11*Cos[t] == 5, t];
With[{surf = expr, ring = expr /. sol},
ParametricPlot3D[
If[11*Cos[t] <= 5, surf, ring], {s, 0, 2*Pi}, {t, 0, Pi}]
]


• THANKS. Can you please recommend how transform this into a better parametrization. Aug 23, 2013 at 17:31
• @user9197 Please see my update. Sorry, you parametrization is fine, but what you can do is, you can calculate explicit settings for your time interval which fulfill the if if condition you are using. Aug 23, 2013 at 17:46

You can also do this with RegionFunction:

ParametricPlot3D[{9*Cos[s]*Sin[t], 10*Sin[s]*Sin[t], 11*Cos[t]},
{s, 0, 2*Pi}, {t, 0, Pi}, RegionFunction -> (11 Cos[#5] <= 5 &)]


• What does #5 mean. Sep 14, 2013 at 22:27