1

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:

\documentclass{minimal}

\usepackage{verbatim}

\usepackage{tikz}
\usepackage{3dplot}

\usepackage[active,tightpage]{preview}      %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}

\begin{document}
        \tdplotsetmaincoords{70}{135}
        \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=.7]
                \tdplotsphericalsurfaceplot[parametricfill]{40}{20}%
                {1/sqrt(%
                        sin(\tdplottheta)^2*( (cos(\tdplotphi)/2)^2 + (sin(\tdplotphi)/1)^2 )%
                        + (cos(\tdplottheta)/1)^2
                )}{black}%
                {%
                                sin(\tdplotphi)
                        % 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$};}%
        \end{tikzpicture}
\end{document}

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

1

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 ...

 \tdplotsetmaincoords{40}{0}
  \begin{tikzpicture}[line join=bevel,tdplot_main_coords, fill opacity=1]
      \tdplotsphericalsurfaceplot[parametricfill]{72}{36}%
         {1/sqrt(%
        sin(\tdplottheta)^2*( (cos(\tdplotphi)/2)^2 + (sin(\tdplotphi)/1)^2 )%
                + (cos(\tdplottheta)/1)^2)}{black}%
                 {100*abs(2*(5-3*sin(\tdplottheta)^2*cos(\tdplotphi)^2)/%
        sqrt((4-3*sin(\tdplottheta)^2*cos(\tdplotphi)^2)^3))}% 
        {}{}{}    

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 – Alain Matthes 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