I used 3dplot for tikz-pgf to draw an ellipsoid. Now I'd like to color the surface in dependence of it's mean curvature (I have calcuated this function.) But 3dplot does not seem to support sin and cos arguments as it's parameter to the parametric fill option. Is that right? I'm going to provide a testcase here:




\usepackage[active,tightpage]{preview}      %generates a tightly fitting border around the work

        \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=.7]
                        sin(\tdplottheta)^2*( (cos(\tdplotphi)/2)^2 + (sin(\tdplotphi)/1)^2 )%
                        + (cos(\tdplottheta)/1)^2
                        % 2*(5-3*sin(\tdplottheta)^2*cos(\tdplotphi)^2)/%
                                % sqrt((4-3*sin(\tdplottheta)^2*cos(\tdplotphi)^2)^3)
                {}%{\draw[color=black,thick,->] (0,0,0) -- (2,0,0) node[anchor=north east]{$x$};}%
                {}%{\draw[color=black,thick,->] (0,0,0) -- (0,2,0) node[anchor=north west]{$y$};}%
                {}%{\draw[color=black,thick,->] (0,0,0) -- (0,0,2) node[anchor=south]{$z$};}%

Would like to know if I'm doing something wrong, or if that feature is not supported. In that case: Do you know a tool I could use to achieve my goal?

Kind regards Konstantin


I think now, you need to use \usepackage{tikz-3dplot} and not 3dplot. Your example works well for me . Sometimes the viewer is not very happy ...

  \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=1]
        sin(\tdplottheta)^2*( (cos(\tdplotphi)/2)^2 + (sin(\tdplotphi)/1)^2 )%
                + (cos(\tdplottheta)/1)^2)}{black}%

enter image description here

  • Hi, I'm very happy you anwsered me. But your image is also just "red". The surface is not colored according its mean curvature. Kind reagards
    – user4578
    Apr 2 '11 at 20:25
  • @kostja I did not understand the question, sorry . I think you need to use an math expression positive and you need to increase the values. See my new example Apr 2 '11 at 21:55
  • Hey, wow, it works! This is really great! Thank you very much. Do you know what range it expects the value to be in? Many greetings Konstantin
    – user4578
    Apr 5 '11 at 10:27
  • @kostja: Rather than "answering" your question, you should comment Altermundus' answer (you may have to register to do so), edit your original question or ask a follow-up question.
    – lockstep
    Apr 5 '11 at 10:42
  • kostja,@lockstep: I converted the answer post to a comment now.
    – Martin Scharrer
    Apr 5 '11 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy