# How to make dashed lines automatic of a sphere when I rotate a sphere?

I copy this code from here

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}));


and try to compile at here http://asymptote.ualberta.ca/ I rotate output by hand, the result seems incorrect.

How can I get the result like this?

• If you mean interfacing with a mouse, you can't. Changing the image would require recompiling the code. You need to do the whole thing using Javascript. Commented Oct 16, 2021 at 17:21

As John Kormylo'comment, I think, you can not rotate the sphere with a mouse (if you use TikZ). We hope that, in future, Asymptote can do this (keep automatic dashed lines when we rotate sphere!). You can try this code. I hope, it helps you something.

\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)};