TeX - LaTeX Asked by Let Me Be Your Lost Disciple on July 24, 2021
First emergency attempt is given as follows. I want the hidden lines get automatically rendered with dashed lines whenever I change the camera in animation. How to do so?
documentclass[border=dimexpr355pt/113relax]{standalone}
usepackage{filecontents}
usepackage{asymptote}
begin{filecontents*}{testfile.asy}
import three;
settings.render=0;
currentprojection=perspective(3,-4,4,center=true);
draw((0,0,0)--(0,2,0));
draw((0,0,0)--(2,0,0));
draw((2,2,0)--(0,2,0));
draw((2,2,0)--(2,0,0));
draw((0,0,0)--(0,0,2));
draw((0,2,0)--(0,2,2));
draw((2,0,0)--(2,0,2));
draw((2,2,0)--(2,2,2));
draw((0,0,2)--(0,2,2));
draw((0,0,2)--(2,0,2));
draw((2,2,2)--(0,2,2));
draw((2,2,2)--(2,0,2));
end{filecontents*}
begin{document}
asyinclude[height=25mm,inline=true,attach=false,viewportwidth=4cm,viewportheight=25mm]{testfile.asy}
end{document}
This is Tikz version.
documentclass[tikz,border=3mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3dtools}
begin{document}
pgfdeclarelayer{background}
pgfdeclarelayer{foreground}
pgfsetlayers{background,main,foreground}
foreach Angle in {5,15,...,355}
{begin{tikzpicture}[same bounding box=A,line cap=round,line join=round,visible/.style={draw,solid}, hidden/.style={draw, dashed}, 3d/install view={phi=Angle,psi=0,theta=70},declare function={a=2;} ]
path
(a,-a,-a) coordinate (A)
(a,a,-a) coordinate (B)
(-a,a,-a) coordinate (C)
(-a,-a,-a) coordinate (D)
(a,-a,a) coordinate (E)
(a,a,a) coordinate (F)
(-a,a,a) coordinate (G)
(-a,-a,a) coordinate (H)
[3d coordinate={(O)=0.5*(A)+0.5*(G)}];
foreach p in {A,B,C,D,E,F,G,H,O}
{draw[fill=black] (p) circle (1.2 pt);}
foreach p/g in {A/-90,B/-90,C/-90,D/90,E/90,F/90,G/90,H/90,O/-90}
{path (p)+(g:3mm) node{$p$};}
tikzset{3d/polyhedron/.cd,O={(O)},
fore layer=foreground,back layer=background,
back/.style={3d/polyhedron/complete dashes,fill=none},
fore/.style={3d/visible,fill=none},%3d/polyhedron/edges have complete dashes=false
draw face with corners={{(A)},{(B)},{(C)},{(D)}},
draw face with corners={{(A)},{(B)},{(F)},{(E)}},
draw face with corners={{(E)},{(F)},{(G)},{(H)}},
draw face with corners={{(C)},{(D)},{(H)},{(G)}},
draw face with corners={{(A)},{(E)},{(H)},{(D)}},
draw face with corners={{(B)},{(C)},{(G)},{(F)}}}
end{tikzpicture}}
end{document}
Answered by minhthien_2016 on July 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP