# How can I get full line of circle of this picture?

Based on my question at here How to draw dashed arc of a circle behind pyramid?

I tried

\documentclass[border=2 mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetikzlibrary{intersections,calc,backgrounds}
\usepackage{fouriernc}

\tikzset{reverseclip/.style={insert path={(current bounding box.south west)rectangle
(current bounding box.north east)} }}
\begin{document}

\tdplotsetmaincoords{70}{290}
\begin{tikzpicture}[tdplot_main_coords,line join = round, line cap = round]
\pgfmathsetmacro\a{4*sqrt(2)/2}
\pgfmathsetmacro\h{2*\a*sqrt(2)/2}
% definitions
\path
coordinate (O) at  (0,0,0)
coordinate(A) at (\a,0,0)
coordinate (B) at (0,\a,0)
coordinate (C) at (-\a,0,0)
coordinate (D) at (0,-\a,0)
coordinate (S) at (0,0,\h)

;
\draw [thick] (S) -- (B) -- (C) -- cycle;
\draw [thick] (S) -- (C) -- (D) -- cycle;
\draw[dashed,thick]
(A) -- (B)  (A) -- (C)  (B) -- (D) (S)--(A) (A)--(D) (S)--(O);
\begin{scope}

\path (O) circle ({\a});
\clip (S) --   (B) -- (C)   --  (D) -- cycle [reverseclip];
\draw[very thick] (O) circle ({\a});
\end{scope}
\begin{scope}
\clip (S) --   (B) -- (C)   --  (D) --  cycle;
\draw[dashed] (O) circle ({\a});
\end{scope}

\foreach \point/\position in {A/above,B/left,C/below,D/right,O/below,S/above}
{
\fill (\point) circle (1.8pt);
\node[\position=1.5pt] at (\point) {$\point$};
}

\end{tikzpicture}
\end{document}


How can I get full line of circle of this picture?

• what do you mean? you want the dashed circle line behind the pyramid to be a solid line, but thinner and possibly grayed out? – thymaro Mar 16 '19 at 8:36
• @thymaro I guess it is meant that the clipped segment between C and D should not be clipped… – TeXnician Mar 16 '19 at 8:37
• @TeXnician ah yes. Didn't see that. Rather peculiar, as the circle is clipped, but the 'C' still appears, so not the whole picture is clipped, but only the circle. Huh... one up for the question, then. – thymaro Mar 16 '19 at 8:51

This happens because at the moment you are using reverseclip the current bounding box is not large enough to fit a circle with the line width you are going to draw. In your picture the perhaps simplest fix is to draw the labels before drawing the circle.

\documentclass[border=2 mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{tkz-euclide}
\usetikzlibrary{intersections,calc,backgrounds}
\usepackage{fouriernc}

\tikzset{reverseclip/.style={insert path={(current bounding box.south west)rectangle
(current bounding box.north east)} }}
\begin{document}

\tdplotsetmaincoords{70}{290}
\begin{tikzpicture}[tdplot_main_coords,line join = round, line cap = round]
\pgfmathsetmacro\a{4*sqrt(2)/2}
\pgfmathsetmacro\h{2*\a*sqrt(2)/2}
% definitions
\path
coordinate (O) at  (0,0,0)
coordinate(A) at (\a,0,0)
coordinate (B) at (0,\a,0)
coordinate (C) at (-\a,0,0)
coordinate (D) at (0,-\a,0)
coordinate (S) at (0,0,\h)

;
\draw [thick] (S) -- (B) -- (C) -- cycle;
\draw [thick] (S) -- (C) -- (D) -- cycle;
\draw[dashed,thick]
(A) -- (B)  (A) -- (C)  (B) -- (D) (S)--(A) (A)--(D) (S)--(O);
\foreach \point/\position in {A/above,B/left,C/below,D/right,O/below,S/above}
{
\fill (\point) circle (1.8pt);
\node[\position=1.5pt] at (\point) {$\point$};
}

\begin{scope}
\path(O) circle ({\a});
\clip (S) --   (B) -- (C)   --  (D) -- cycle [reverseclip];
\draw[very thick] (O) circle ({\a});
\end{scope}
\begin{scope}
\clip (S) --   (B) -- (C)   --  (D) --  cycle;
\draw[dashed] (O) circle ({\a});
\end{scope}

\end{tikzpicture}
\end{document}


Run with xelatex:

\documentclass[pstricks,border=15pt]{standalone}
\usepackage{pst-3dplot}%
\begin{document}
\begin{pspicture}[showgrid=false](-4,-2)(4,6)
\psset{Alpha=30,Beta=15}
\pstThreeDLine[arrows=*-*,linestyle=dashed](-2,-2,0)(0,0,5)
\pstThreeDLine[arrows=*-*](2,-2,0)(0,0,5)
\pstThreeDLine[arrows=*-*](-2,2,0)(0,0,5)
\pstThreeDLine[arrows=*-*](2,2,0)(0,0,5)
\pstThreeDLine(2,-2,0)(2,2,0)(-2,2,0)
\pstThreeDLine[linestyle=dashed](2,-2,0)(-2,-2,0)(-2,2,0)(2,-2,0)
\pstThreeDLine[linestyle=dashed](-2,-2,0)(2,2,0)
\pstThreeDLine[linestyle=dashed,arrows=*-](0,0,0)(0,0,5)
\pstThreeDEllipse[linestyle=dashed](0,0,0)(2,2,0)(-2,2,0)
\pstThreeDEllipse[beginAngle=-90,endAngle=140,linewidth=1.5pt](0,0,0)(2,2,0)(-2,2,0)
\pstThreeDPut(-2.4,-2.2,0.2){\large$A$}
\pstThreeDPut(2.2,-2.2,0.2){\large$B$}
\pstThreeDPut(2.4,2.2,-0.2){\large$C$}
\pstThreeDPut(-2.4,2.2,0.2){\large$D$}
\pstThreeDPut(-0.2,0,-0.2){\large$O$}
\pstThreeDPut(0,0,5.3){\large$S$}
\end{pspicture}
\end{document}


• On the right side the thick arc overshoots, i.e. enters the hidden realm. – user121799 Mar 16 '19 at 14:30