我正在尝试绘制一个椭圆体,但我无法将这条虚线与图片中阴影的极限匹配,正如您在图片中所看到的那样......我忘记了什么?
\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}
答案1
我不确定我是否理解了这个问题,但你可以把弧线画成一个情节。
\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}
与\tdplotsetmaincoords{90}{0}