Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-wolff committed Jul 26, 2018
1 parent 4c67253 commit 275bb7b
Show file tree
Hide file tree
Showing 11 changed files with 1,085 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tikz-3dplot-circleofsphere</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>net.sourceforge.texlipse.builder.TexlipseBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sourceforge.texlipse.builder.TexlipseNature</nature>
</natures>
</projectDescription>
14 changes: 14 additions & 0 deletions .texlipse
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#TeXlipse project settings
#Thu Jul 26 13:19:27 CEST 2018
markTmpDer=true
builderNum=2
outputDir=
makeIndSty=
bibrefDir=
outputFormat=pdf
tempDir=
mainTexFile=tikz-3dplot-circleofsphere.tex
outputFile=tikz-3dplot-circleofsphere.pdf
langSpell=en
markDer=true
srcDir=
37 changes: 37 additions & 0 deletions _tester.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\documentclass{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz-3dplot-circleofsphere}

\begin{document}

\def\elev{ 30} \pgfmathsetmacro{\tdpTheta}{90-\elev}
\def\azim{ 35} \pgfmathsetmacro{\tdpPhi}{90+\azim}
\def\R{3}
\tdplotsetmaincoords{\tdpTheta}{\tdpPhi}
\begin{tikzpicture}[scale=1,tdplot_main_coords]
\begin{scope}[black!30,name=auxiliary]
\draw[tdplot_screen_coords] (0,0,0) circle (\R);
\draw[->] (-1.3*\R,0,0) -- (1.3*\R,0,0) node[anchor=north east]{$x$};
\draw[->] (0,-1.3*\R,0) -- (0,1.3*\R,0) node[anchor=north west]{$y$};
\draw[->] (0,0,-1.3*\R) -- (0,0,1.3*\R) node[anchor=south]{$z$};
\tdplotCsDrawCircleOfSphere{\R}{0}{0}{0};
\end{scope}
\begin{scope}
% \tdplotCsDrawLatCircle[tdplotCsDrawAux]{\R}{-30}
% --
% Bug: Front and back side arcs swapped!
\tdplotCsDrawCircleOfSphere[tdplotCsDrawAux]{\R}{0}{30}{30}
% --
% \tdplotCsDrawCircleOfSphere[tdplotCsDrawAux]{\R}{-45}{45}{30}
% --
% \foreach \a in {0,15,...,345}
% { \tdplotCsDrawCircleOfSphere[very thin,gray]{\R}{\a}{90}{0} }
% \foreach \a in {-75,-60,...,75}
% { \tdplotCsDrawCircleOfSphere[very thin,gray]{\R}{0}{0}{\a} }
% -- Pathologic cases -->
% \tdplotCsDrawCircleOfSphere{\R}{35}{60}{0}
% <--
\end{scope}
\end{tikzpicture}

\end{document}
18 changes: 18 additions & 0 deletions examples/frontpage1.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\documentclass{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document}
\centering
\def\R{3}
\tdplotsetmaincoords{60}{125}
\begin{tikzpicture}[tdplot_main_coords]
\draw[tdplot_screen_coords,very thin,gray] (0,0,0) circle (\R);
\tdplotCsDrawLatCircle%
[thick,tdplotCsFill/.style={opacity=0.05}]{\R}{0}
\tdplotCsDrawGreatCircle%
[red,thick,tdplotCsFill/.style={opacity=0.1}]{\R}{105}{-23.5}
\foreach \a in {-75,-60,...,75}
{\tdplotCsDrawLatCircle[very thin,gray]{\R}{\a}}
\foreach \a in {0,15,...,165}
{\tdplotCsDrawLonCircle[very thin,gray]{\R}{\a}}
\end{tikzpicture}
\end{document}
16 changes: 16 additions & 0 deletions examples/frontpage2.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\documentclass{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document}
\centering
\def\R{3}
\tdplotsetmaincoords{60}{125}
\begin{tikzpicture}[tdplot_main_coords]
\def\e{80};
\draw[tdplot_screen_coords,very thin] (0,0,0) circle (\R);
\foreach \a in {0,5,...,175} {
\tdplotCsDrawGreatCircle%
[very thin, tdplotCsBack/.style={very thin,blue!40}]%
{\R}{\a}{90*sin(\a)*sin(\e)}
}
\end{tikzpicture}
\end{document}
51 changes: 51 additions & 0 deletions examples/minimalistcode.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
\documentclass{standalone}
\usepackage{tikz,tikz-3dplot}
%% >> MINIMALIST CIRCLE OF SHPERE DRAWING CODE _______________________________________________________________________
\newcommand\scircle[4]{%
\tdplotsetrotatedcoords{#2}{#3}{0} % Rotate coordinate system
\let\a\tdplotalpha % alpha (rotated coord. system)
\let\b\tdplotbeta % beta (rotated coord. system)
\let\p\tdplotmainphi % phi (main coord. system)
\let\t\tdplotmaintheta % theta (main coord. system)
\pgfmathsetmacro\azx{cos(\a)*cos(\b)*sin(\p)*sin(\t) - sin(\b)*cos(\t) - cos(\b)*cos(\p)*sin(\a)*sin(\t)}
\pgfmathsetmacro\azy{-cos(\a)*cos(\p)*sin(\t) - sin(\a)*sin(\p)*sin(\t)}
\pgfmathsetmacro\azz{cos(\b)*cos(\t) + cos(\a)*sin(\b)*sin(\p)*sin(\t) - cos(\p)*sin(\a)*sin(\b)*sin(\t)}
\pgfmathsetmacro\Re {#1*cos(#4)} % Radius of circle
\pgfmathsetmacro\ze {#1*sin(#4)} % z-coordinate of drawing plane
\pgfmathsetmacro\coX{\ze*cos(#2)*sin(#3)} % x-coordinate offset for ze
\pgfmathsetmacro\coY{\ze*sin(#2)*sin(#3)} % y-coordinate offset for ze
\pgfmathsetmacro\coZ{\ze*cos(#3)} % z-coordinate offset for ze
\coordinate (coffs) at (\coX,\coY,\coZ); % Offset as coordinate value
\tdplotsetrotatedcoordsorigin{(coffs)} % Offset coordinate system
\begin{scope}[tdplot_rotated_coords] % Drawing scope >>
\pgfmathsetmacro\tanEps{tan(#4)} % Tangent of elevation angle
\pgfmathsetmacro\bOneside{((\tanEps)^2)>=(((\azx)^2+(\azy)^2)/(\azz)^2)} % Circle entirely on one side?
\ifthenelse{\bOneside=1}{% % Circle on one side of sphere >>
\pgfmathsetmacro\bFrontside{(\azx*\Re+\azz*\ze)>=0} % Circle entirely on front side?
\ifthenelse{\bFrontside=1} % |
{\draw (0,0) circle (\Re);} % Draw on front side
{\draw[dashed] (0,0) circle (\Re);} % Draw on back side
}{% % << Circle on both sides >>
\pgfmathsetmacro\u{\azy} % Substitution u=...
\pgfmathsetmacro\v{sqrt( (\azx)^2 + (\azy)^2 - (\azz)^2*(\tanEps)^2 )} % Substitution v=...
\pgfmathsetmacro\w{\azx - \azz*\tanEps} % Substitution w=...
\pgfmathsetmacro\aPhiBf{2*atan2(\u-\v,\w)} % Back->front crossing angle
\pgfmathsetmacro\aPhiFb{2*atan2(\u+\v,\w)} % Front->back crossing angle
\pgfmathsetmacro\bUnwrap{(\aPhiFb-\aPhiBf)>360} % Unwrap front->back angle?
\ifthenelse{\bUnwrap=1}{\pgfmathsetmacro\aPhiBf{\aPhiBf+360}}{} % Unwrap front->back angle
\draw[dashed] (\aPhiFb:\Re) arc (\aPhiFb:{\aPhiBf+360}:\Re); % Draw back side arc
\draw (\aPhiBf:\Re) arc (\aPhiBf:\aPhiFb:\Re); % Draw back side arc
} % <<
\end{scope} % << (Drawing scope)
}
%% << ________________________________________________________________________________________________________________
\begin{document}
\tdplotsetmaincoords{60}{125} % Set main coordintate system
\begin{tikzpicture}[tdplot_main_coords] % TikZ picture >>
\begin{scope}[black!30] % Draw in gray >>
\draw[tdplot_screen_coords] (0,0,0) circle (3); % Sphere outline
\scircle{3}{0}{0}{0} % Equator
\end{scope} % <<
\scircle{3}{0}{40}{30} % Draw another sphere circle
\end{tikzpicture} % <<
\end{document}
13 changes: 13 additions & 0 deletions tikz-3dplot-circleofsphere.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@Misc{Hei12,
author = {Jeff Hein},
title = {The \texttt{tikz-3dplot} Package},
howpublished = {Online: \url{https://mirror.hmc.edu/ctan/graphics/pgf/contrib/tikz-3dplot/tikz-3dplot_documentation.pdf}. Retrieved July 20, 2018},
year = {2012}
}
@Misc{Tan15,
author = {Till Tantau},
title = {TikZ \& PGF - Manual for Version 3.0.1a},
howpublished = {Online: \url{https://mirror.reismil.ch/CTAN/graphics/pgf/base/doc/pgfmanual.pdf}. Retrieved July 22, 2018},
year = {2015}
}
Binary file added tikz-3dplot-circleofsphere.pdf
Binary file not shown.
Loading

0 comments on commit 275bb7b

Please sign in to comment.