当我旋转球体时,如何自动生成球体的虚线?

当我旋转球体时,如何自动生成球体的虚线?

我从这里复制了这段代码这里

settings.render=8;
import solids;
size(5cm);

currentprojection=orthographic(1,0.3,0.3);

revolution b=sphere(O,1);
draw(surface(b),white+opacity(.5));

skeleton s;
b.transverse(s,reltime(b.g,0.5),P=currentprojection);

draw(s.transverse.back,dashed);
draw(s.transverse.front);
draw(rotate(90,X)*s.transverse.back,dashed);
draw(rotate(90,X)*s.transverse.front);

real rayon=0.8, phi=90, theta=45;
triple pM=dir(phi,theta);

draw((O--pM),dashed+green+0.7bp,Arrow3(size=7));
label(Label("$\psi$",yellow),pM,0.5dir(-90));

xaxis3("$x$",1,1.5,Arrow3);
xaxis3(-1.3,1,linetype(new real[] {8,8}));
yaxis3("$y$",1,1.5,Arrow3);
yaxis3(-1.3,1,linetype(new real[] {8,8}));
zaxis3("$z$",1,1.5,Arrow3);
zaxis3(0,1,linetype(new real[] {8,8}));

并尝试在这里编译http://asymptote.ualberta.ca/ 我手动旋转输出,结果似乎不正确。 在此处输入图片描述

我怎样才能得到结果像这样

在此处输入图片描述

答案1

正如 John Kormylo 的评论,我认为您不能用鼠标旋转球体(如果您使用 TikZ)。我们希望,将来 Asymptote 可以做到这一点(旋转球体时保留自动虚线!)。您可以尝试此代码。我希望它对您有所帮助。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
    \pgfdeclarelayer{background}
    \pgfdeclarelayer{foreground}
    \pgfsetlayers{background,main,foreground}
\foreach \Angle in {5,15,...,360}
{\begin{tikzpicture}[3d/install view={phi=\Angle,theta=70},line cap=butt,
        line join=round,visible/.style={draw,solid},
        hidden/.style={draw,very thin,cheating dash},declare function={R=5;}]
        \path (0,0,0) coordinate (I)
        foreach \Z in {-75,-60,...,75}
        {(0,0,{R*sin(\Z)}) coordinate (I\Z)}
        foreach \Z in {-75,-60,...,90}
        {({cos(\Z)},{sin(\Z)},0) coordinate (n\Z)};
        \shade[ball color=white,3d/screen coords,opacity=0.8] (I) circle[radius=R];
        %
        \path foreach \Z in {-75,-60,...,90}
        {pic{3d/circle on sphere={R=R,C={(I)},P={(I)},n={(n\Z)},
                    fore layer=foreground,back layer=background}}};
        %
        \path foreach \Z in {-75,-60,...,75}
        {pic{3d/circle on sphere={R=R,C={(I)}, P={(I\Z)},fore layer=foreground,back layer=background}}};
    \end{tikzpicture}}
\end{document}

输出的文件很大,我无法在这里上传。我把它放在这里或者这里

相关内容