1

I'm trying to draw an ellipsoid but I have trouble matching this dashed curve with the limit of the shading in the picture, as you can see in the image ... what am I forgetting?

\documentclass{standalone}

\usepackage{tikz,amsmath,amssymb}
\usepackage{tikz-3dplot}

\usetikzlibrary{calc,arrows, arrows.meta}

\begin{document}


\tdplotsetmaincoords{90}{0}

%define polar coordinates for some vector
%TODO: look into using 3d spherical coordinate system
\pgfmathsetmacro{\radius}{1}
\pgfmathsetmacro{\thetavec}{0}
\pgfmathsetmacro{\phivec}{0}

\begin{tikzpicture}[
thick, font = \scriptsize, >={[scale =1]Stealth},
fip/.style ={circle, fill = fcolor, draw = fcolor, inner sep = 1pt}
]


\def\OP{.4} % Deines the Opacity    
\def\Fi{70} % Deines the filling percentage in contrast to the drawing
\def \yaxis{2}
%start tikz picture, and use the tdplot_main_coords style to implement the    display 
%coordinate transformation provided by 3dplot
\begin{scope}[scale=2.5,tdplot_main_coords,yshift=.7cm,xshift=-1cm]
%draw the main coordinate system axes
 \draw[thick,->] (0,0,0) -- (2,0,0) node[anchor=south east]{$x$};
 \draw[thick,->] (0,0,0) -- (0,1.5,0) node[anchor=north west]{$y$};
 \draw[thick,->] (0,0,0) -- (0,0,1.5) node[anchor=south]{$z$};

 \tdplotsetthetaplanecoords{\phivec}

%draw some dashed arcs, demonstrating direct arc drawing ... 
%the problem is here
 \draw[dashed,tdplot_rotated_coords] (.75\radius,0,0) arc (0:75:\radius);

 \draw[dashed] (\radius,0,0) arc (0:360:\radius);
 \shade[ball color=blue!10!white,opacity=0.2] (1cm,0) arc (0:-180:1cm and 7.5mm) arc (180:0:1cm and .75cm);
% (-z x y)
 \draw (0, 1, 0) node [circle, fill=blue, inner sep=.02cm] () {};
 \draw (0, 0, 1) node [circle, fill=green, inner sep=.02cm] () {};
 \draw (-1, 0, 0) node [circle, fill=red, inner sep=.02cm] () {};
\end{scope}

\end{tikzpicture}




\end{document}

enter image description here

  • \tdplotsetmaincoords isn't the problem ... indeed, the problem is marked in the code with %the problem is here the problem is I can't match the dashed curve with the limit of the shading in the picture. Because that I put \tdplotsetmaincoords{90}{0} so that the problem is seen. – juanuni Jun 20 '18 at 4:22
1

I am not sure I understand the question but you can draw the arc as a plot.

\documentclass{standalone}

\usepackage{tikz,amsmath,amssymb}
\usepackage{tikz-3dplot}

\usetikzlibrary{calc,arrows, arrows.meta}

\begin{document}


\tdplotsetmaincoords{70}{110}

%define polar coordinates for some vector
%TODO: look into using 3d spherical coordinate system
\pgfmathsetmacro{\radius}{1}
\pgfmathsetmacro{\thetavec}{0}
\pgfmathsetmacro{\phivec}{0}

\begin{tikzpicture}[
thick, font = \scriptsize, >={[scale =1]Stealth},
fip/.style ={circle, fill = fcolor, draw = fcolor, inner sep = 1pt}
]


\def\OP{.4} % Deines the Opacity    
\def\Fi{70} % Deines the filling percentage in contrast to the drawing
\def \yaxis{2}
%start tikz picture, and use the tdplot_main_coords style to implement the    display 
%coordinate transformation provided by 3dplot
\begin{scope}[scale=2.5,tdplot_main_coords,yshift=.7cm,xshift=-1cm]
%draw the main coordinate system axes
 \draw[thick,->] (0,0,0) -- (2,0,0) node[anchor=south east]{$x$};
 \draw[thick,->] (0,0,0) -- (0,1.5,0) node[anchor=north west]{$y$};
 \draw[thick,->] (0,0,0) -- (0,0,1.5) node[anchor=south]{$z$};

\tdplotsetthetaplanecoords{\phivec}

%draw some dashed arcs, demonstrating direct arc drawing ... 
%the problem is here
 \draw[dashed,domain=0:90] 
 plot[variable=\x] ({\radius*cos(\x)*cos(\phivec)},
 {0.75*\radius*cos(\x)*sin(\phivec)},{0.75*\radius*sin(\x)});


 \draw[dashed] (\radius,0,0) arc (0:360:\radius);
%  plot[variable=\x,domain=-180:180] ({\radius*cos(0)*cos(\x)},
%  {0.75*\radius*cos(0)*sin(\x)},{0.75*\radius*sin(0)});
 \shade[ball color=blue!10!white,opacity=0.2] (1cm,0) arc (0:-180:1cm and 7.5mm) arc (180:0:1cm and .75cm);
% (-z x y)
 \draw (0, 1, 0) node [circle, fill=blue, inner sep=.02cm] () {};
 \draw (0, 0, 1) node [circle, fill=green, inner sep=.02cm] () {};
 \draw (-1, 0, 0) node [circle, fill=red, inner sep=.02cm] () {};
\end{scope}

\end{tikzpicture}

\end{document}

enter image description here

And with \tdplotsetmaincoords{90}{0}

enter image description here

  • Yes, you understand my question. Thank you. – juanuni Jun 20 '18 at 4:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.