marmotghost / tikz-3dtools

Experimental library for 3d operations with TikZ
8 stars 0 forks source link

Is this a bug? #4

Closed minhthien2016 closed 3 years ago

minhthien2016 commented 3 years ago

I am trying to answer this question. In this code, I feel three segments ([xshift=-R*1cm]B) -- ([xshift=-R*1cm]T) (N) -- ([xshift=-R*1cm]T) and ([xshift=-R*1cm]T) -- ([xshift=R*1cm]B) do not cut at the point ([xshift=-R*1cm]T). This is my code

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{3dtools,calc,intersections}% https://github.com/marmotghost/tikz-3dtools

\begin{document}

    \begin{tikzpicture}[3d/install view={phi=90,theta=70},line cap=butt,
        line join=round,declare function={R=3; },c/.style={circle,fill,inner sep=1pt}] 
        \path
        (0,0,0) coordinate (O)
        (0,0,R)  coordinate (N)
        (0,0,-R)  coordinate (S)
        ;

        \path[save named
        path=sph,3d/screen coords] (O) circle[radius=R];
        \path pic{3d/circle on sphere={R=R,C={(O)}}};
        \path  pic{3d/circle on sphere={R=R,C={(O)},P={(O)}, n={(1,2,0)}}}; 
        \draw[3d/hidden] (S) -- (N) ;

        \begin{scope}[xshift=1cm,3d/install view={phi=0,theta=70}]
            \path (2.5*R,0,-R) coordinate (B)
            (2.5*R,0,R) coordinate (T)
            ;
            \draw[3d/visible] (T) circle[radius=R]
            ([xshift=-R*1cm]B) -- ([xshift=-R*1cm]T)
            ([xshift=R*1cm]B) -- ([xshift=R*1cm]T);
            \path   pic{3d/circle on sphere={R=R,C={(B)},P={(B)},n={(0,0,1)}}}; 
        \end{scope}
        \path foreach \p/\g in {O/180,S/150,N/180,T/90,B/-90}
        {(\p)node[c]{}+(\g:2.5mm) node{$\p$}};
        \draw[3d/visible]  (N) -- ([xshift=R*1cm]T)  ;
        \draw[3d/hidden] (T) -- (B) ([xshift=R*1cm]B) -- ([xshift=-R*1cm]B)
        ([xshift=-R*1cm]B) -- ([xshift=R*1cm]T)
        ([xshift=-R*1cm]T) -- ([xshift=R*1cm]B)
        ;
\path [save named path=d] (S) -- ([xshift=-R*1cm]B);
\tikzset{3d/draw ordered paths={d,sph}}
    \end{tikzpicture}
\end{document}  

ScreenHunter 319