Debian Codegraph @

texmf-dist/tex/latex/blochsphere/blochsphere.sty

raw
1 %%
2 %% This is file `blochsphere.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% blochsphere.dtx (with options: `package')
8 %%
9 %% This generated file is part of the blochsphere package.
10 %%
11 %% Copyright (C) 2015 by Matthew Wardrop <[email protected]>
12 %%
13 %% This work may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either version 1.3
15 %% of this license or (at your option) any later version.
16 %% The latest version of this license is in
17 %% http://www.latex-project.org/lppl.txt
18 %% and version 1.3 or later is part of all distributions of LaTeX
19 %% version 2005/12/01 or later.
20 %%
21 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
22 \ProvidesPackage{blochsphere}
23 [2015/09/15 v1.1 blochsphere drawing package]
24 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
25 \ProvidesPackage{blochsphere}[2015/08/17]
26 %% \usepackage{trace}
27 %%\tracingall
28 \usepackage{tikz,etoolbox,environ,ifthen,kvsetkeys,kvoptions}
29 \usetikzlibrary{decorations.pathreplacing, decorations.markings, calc, fadings}
30 \define@key{blochsphere}{radius}{%
31 \def\blochsphere@radius{#1}%
32 }
33 \providecommand{\blochsphere@radius}{1cm}
34 \define@key{blochsphere}{tilt}{%
35 \def\blochsphere@tilt{#1}%
36 }
37 \providecommand{\blochsphere@tilt}{15}
38 \define@key{blochsphere}{rotation}{%
39 \def\blochsphere@rotation{#1}%
40 }
41 \providecommand{\blochsphere@rotation}{-20}
42 \define@key{blochsphere}{color}{%
43 \def\blochsphere@color{#1}%
44 }
45 \providecommand{\blochsphere@color}{white}
46 \define@key{blochsphere}{opacity}{%
47 \def\blochsphere@opacity{#1}%
48 }
49 \providecommand{\blochsphere@opacity}{0.7}
50 \define@key{blochsphere}{style}{%
51 \def\blochsphere@style{#1}%
52 }
53 \providecommand{\blochsphere@style}{}
54 \define@key{blochsphere}{scale}{%
55 \def\blochsphere@scale{#1}%
56 }
57 \providecommand{\blochsphere@scale}{1}
58 \define@key{blochsphere}{plane}{%
59 \def\blochsphere@plane{#1}%
60 }
61 \providecommand{\blochsphere@plane}{current plane}
62 \define@key{blochsphere}{shift}{%
63 \def\blochsphere@shift{{#1}}%
64 }
65 \providecommand{\blochsphere@shift}{{0,0,0}}
66 \define@key{blochsphere}{ball}{%
67 \def\blochsphere@ball{#1}%
68 }
69 \providecommand{\blochsphere@ball}{3d}
70 \define@key{blochsphere}{statecolor}{%
71 \def\blochsphere@statecolor{#1}%
72 }
73 \providecommand{\blochsphere@statecolor}{black}
74 \define@key{blochsphere}{statewidth}{%
75 \def\blochsphere@statewidth{#1}%
76 }
77 \providecommand{\blochsphere@statewidth}{0.4pt}
78 \define@key{blochsphere}{axisarrow}{%
79 \def\blochsphere@axisarrow{#1}%
80 }
81 \providecommand{\blochsphere@axisarrow}{}
82 \define@key{blochsphere}{labelmark}{%
83 \setboolean{blochsphere@labelmark}{#1}%
84 }
85 \newboolean{blochsphere@labelmark}
86 \setboolean{blochsphere@labelmark}{false}
87 \define@key{blochsphere}{nested}{%
88 \setboolean{blochsphere@nested}{#1}%
89 }
90 \newboolean{blochsphere@nested}
91 \setboolean{blochsphere@nested}{false}
92 \ProcessKeyvalOptions{blochsphere}\relax
93 \newenvironment{blochsphere}[1][]{
94 \begingroup
95 \makeatletter
96 \ignorespaces\setkeys{blochsphere}{#1}\unskip%
97 \pgfdeclarelayer{back}%
98 \pgfdeclarelayer{front}%
99 \pgfsetlayers{back,main,front}%
100 \pgfkeys{%
101 /tikz/on layer/.code={%
102 \pgfonlayer{##1}\begingroup%
103 \aftergroup\endpgfonlayer%
104 \aftergroup\endgroup%
105 },%
106 /tikz/node on layer/.code={%
107 \gdef\node@@on@layer{%
108 \setbox\tikz@tempbox=\hbox\bgroup\pgfonlayer{##1}\unhbox\tikz@tempbox\endpgfonlayer\egroup}%
109 \aftergroup\node@on@layer%
110 },%
111 /tikz/end node on layer/.code={%
112 \endpgfonlayer\endgroup\endgroup%
113 }%
114 }%
115 \def\node@on@layer{\aftergroup\node@@on@layer}%
116 \newcommand\drawBall[1][]{
117 \begingroup
118 \setkeys{blochsphere}{##1}
119 \expandafter\ifstrequal\expandafter{\blochsphere@ball}{3d}{
120 \fill[on layer=main,ball color=\blochsphere@color,opacity=\blochsphere@opacity] (0,0) circle (\blochsphere@radius); % 3D lighting effect
121 }{}
122 \expandafter\ifstrequal\expandafter{\blochsphere@ball}{circle}{
123 \draw[on layer=main,color=\blochsphere@color] (0,0) circle (\blochsphere@radius); % 3D lighting effect
124 }{}
125 \endgroup
126 }%
127 \newcommand\drawBallGrid[3][]{
128 \begingroup
129 \setkeys{blochsphere}{##1}
130 \foreach \phi in {0,##2,...,89} {
131 \drawLatitudeCircle{\phi}
132 \drawLatitudeCircle{-\phi}
133 }
134 \foreach \theta in {0,##3,...,179} {
135 \drawLongitudeCircle{\theta}
136 }
137 \endgroup
138 }%
139 \newcommand\setDrawingPlane[3][]{%
140 \setkeys{blochsphere}{##1}
141 \pgfmathsetmacro\aphi{##2}
142 \pgfmathsetmacro\atheta{##3}
143 \pgfmathsetmacro\dot{cos(\aphi)}
144 \ifdim\dot pt<0.7 pt\relax%
145 \pgfmathsetmacro\norm{cos(asin(\dot))}
146 \pgfmathsetmacro\xx{-sin(\aphi)*sin(\blochsphere@rotation - \atheta)}
147 \pgfmathsetmacro\xy{sin(\aphi)*sin(\blochsphere@tilt)*cos(\blochsphere@rotation - \atheta)}
148 \pgfmathsetmacro\yx{-sin(2*\aphi - \blochsphere@rotation + \atheta)/4 - sin(2*\aphi + \blochsphere@rotation - \atheta)/4}
149 \pgfmathsetmacro\yy{(sin(\aphi)*cos(\blochsphere@tilt) - sin(\blochsphere@tilt)*sin(\blochsphere@rotation - \atheta)*cos(\aphi))*sin(\aphi)}
150 \else
151 \pgfmathsetmacro\norm{sqrt(abs(sin(\blochsphere@rotation - \atheta)*cos(\aphi))^2 + abs(sin(\blochsphere@tilt)*cos(\aphi)*cos(\blochsphere@rotation - \atheta))^2 + abs(cos(\aphi)*cos(\blochsphere@tilt)*cos(\blochsphere@rotation - \atheta))^2)}
152 \pgfmathsetmacro\xx{-sin(\blochsphere@rotation - \atheta)*cos(\aphi)}
153 \pgfmathsetmacro\xy{sin(\blochsphere@tilt)*cos(\aphi)*cos(\blochsphere@rotation - \atheta)}
154 \pgfmathsetmacro\yx{-cos(\aphi)^2*cos(\blochsphere@rotation - \atheta)}
155 \pgfmathsetmacro\yy{(sin(\aphi)*cos(\blochsphere@tilt) - sin(\blochsphere@tilt)*sin(\blochsphere@rotation - \atheta)*cos(\aphi))*cos(\aphi)}
156 \fi
157 \computeOffset{shift}
158 \begingroup\newcommand\tmp[1]{\endgroup\noexpand\relax%
159 \tikzset{\blochsphere@plane/.style={cm={\xx/\norm, \xy/\norm, \yx/\norm, \yy/\norm, \unexpanded\expandafter{####1} }}}%
160 } \tmp{\shift}
161 }%
162 \newcommand\setLatitudinalDrawingPlane[2][]{%
163 \pgfmathsetmacro\yshift{sin(##2)*\the\blochsphere@radius}
164 \setDrawingPlane[##1,shift={{0,0,\yshift}}]{0}{0}
165 }%
166 \newcommand\setLongitudinalDrawingPlane[2][]{%
167 \setDrawingPlane[##1]{90}{##2}
168 }%
169 \newcommand\drawCircle[3][]{
170 \begingroup
171 \setkeys{blochsphere}{##1}
172 \setDrawingPlane{##2}{##3}
173 \computeVisibility{##2}{##3}{agamma}{abeta}
174 \begingroup\edef\tmp{\endgroup%
175 \noexpand\draw[current plane,on layer=back,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma-\abeta-0.2:\blochsphere@radius+\the\pgflinewidth*0.5) arc (\agamma-\abeta-0.2:\agamma+\abeta+0.2:\blochsphere@radius+\the\pgflinewidth*0.5)};
176 \noexpand\draw[current plane,on layer=front,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma+\abeta:\blochsphere@radius+\the\pgflinewidth*0.5) arc (\agamma+\abeta:\agamma-\abeta+360:\blochsphere@radius+\the\pgflinewidth*0.5)};
177 } \tmp
178 \endgroup
179 }%
180 \newcommand\drawGreatCircle[3][]{
181 \drawCircle[##1]{##2}{##3}
182 }
183 \newcommand\drawSmallCircle[4][]{
184 \begingroup
185 \pgfmathsetmacro\xshift{sin(##2)*cos(##3)*\blochsphere@radius*sin(##4)}
186 \pgfmathsetmacro\yshift{sin(##2)*sin(##3)*\blochsphere@radius*sin(##4)}
187 \pgfmathsetmacro\zshift{cos(##2)*\blochsphere@radius*sin(##4)}
188 \pgfmathsetmacro\radius{\blochsphere@radius*cos(##4)}
189 \drawCircle[##1,shift={{\xshift,\yshift,\zshift}},radius=\radius]{##2}{##3}
190 \endgroup
191 }%
192 \newcommand\drawLatitudeCircle[2][]{
193 \begingroup
194 \pgfmathsetmacro\yshift{sin(##2)*\blochsphere@radius}
195 \pgfmathsetmacro\radius{\blochsphere@radius*cos(##2)}
196 \drawCircle[##1,shift={{0,0,\yshift}},radius=\radius]{0}{0}
197 \endgroup
198 }%
199 \newcommand\drawLongitudeCircle[2][]{
200 \begingroup
201 \drawCircle[##1]{90}{##2+90}
202 \endgroup
203 }%
204 \newcommand\drawRotationLeft[5][]{
205 \begingroup
206 \setkeys{blochsphere}{##1}
207 \pgfmathsetmacro\xshift{sin(##2)*cos(##3)*##4}
208 \pgfmathsetmacro\yshift{sin(##2)*sin(##3)*##4}
209 \pgfmathsetmacro\zshift{cos(##2)*##4}
210 \setDrawingPlane[shift={\xshift,\yshift,\zshift}]{##2}{##3}
211 \computeVisibility{##2}{##3}{agamma}{abeta}
212 \begingroup\edef\tmp{\endgroup%
213 \noexpand\draw[current plane,on layer=back,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma-\abeta-0.2:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5) arc (\agamma-\abeta-0.2:\agamma+\abeta+0.2:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5)};
214 \noexpand\draw[<-,current plane,on layer=front,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma+\abeta+##5:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5) arc (\agamma+\abeta+##5:\agamma-\abeta+360:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5)};
215 } \tmp
216 \endgroup
217 }%
218 \newcommand\drawRotationRight[5][]{
219 \begingroup
220 \setkeys{blochsphere}{##1}
221 \pgfmathsetmacro\xshift{sin(##2)*cos(##3)*##4}
222 \pgfmathsetmacro\yshift{sin(##2)*sin(##3)*##4}
223 \pgfmathsetmacro\zshift{cos(##2)*##4}
224 \setDrawingPlane[shift={\xshift,\yshift,\zshift}]{##2}{##3}
225 \computeVisibility{##2}{##3}{agamma}{abeta}
226 \begingroup\edef\tmp{\endgroup%
227 \noexpand\draw[current plane,on layer=back,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma-\abeta-0.2:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5) arc (\agamma-\abeta-0.2:\agamma+\abeta+0.2:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5)};
228 \noexpand\draw[->,current plane,on layer=front,\unexpanded\expandafter{\blochsphere@style}] \unexpanded\expandafter{(\agamma+\abeta:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5) arc (\agamma+\abeta:\agamma-\abeta+360-##5:\blochsphere@radius*\blochsphere@scale+\the\pgflinewidth*0.5)};
229 } \tmp
230 \endgroup
231 }%
232 \newcommand\drawAxis[3][] {
233 \begingroup
234 \setkeys{blochsphere}{##1}
235 \pgfmathsetmacro\behind{ifthenelse(-sin(##2)*sin(\blochsphere@rotation - ##3)*cos(\blochsphere@tilt) + sin(\blochsphere@tilt)*cos(##2)<0, 1, 0)}
236 \pgfmathsetmacro\newphi{180-##2}
237 \pgfmathsetmacro\newtheta{##3+180}
238 \ifnum\behind=0\relax
239 \labelPolar[scale=1]{blochspheretmpp}{##2}{##3}
240 \labelPolar{blochspheretmps}{##2}{##3}
241 \labelPolar{blochspheretmpe}{\newphi}{\newtheta}
242 \else
243 \labelPolar[scale=1]{blochspheretmpp}{\newphi}{\newtheta}
244 \labelPolar{blochspheretmpe}{##2}{##3}
245 \labelPolar{blochspheretmps}{\newphi}{\newtheta}
246 \fi
247 \begingroup\edef\tmp{\endgroup%
248 \ifnum\behind=0\relax
249 \noexpand\draw[on layer=front,\unexpanded\expandafter{\blochsphere@style},\blochsphere@axisarrow] (blochspheretmpp) -- (blochspheretmps);
250 \noexpand\draw[on layer=back,\unexpanded\expandafter{\blochsphere@style}] (blochspheretmpe) -- (blochspheretmpp);
251 \else
252 \noexpand\draw[on layer=front,\unexpanded\expandafter{\blochsphere@style},\blochsphere@axisarrow] (blochspheretmpp) -- (blochspheretmpe);
253 \noexpand\draw[on layer=back,\unexpanded\expandafter{\blochsphere@style}] (blochspheretmps) -- (blochspheretmpp);
254 \fi
255 } \tmp
256 \endgroup
257 }%
258 \newcommand\labelPolar[4][]{%
259 \begingroup
260 \setkeys{blochsphere}{##1}
261 \setLongitudinalDrawingPlane{##4+90}
262 \pgfmathsetmacro\behind{ifthenelse(-sin(##3)*sin(\blochsphere@rotation - ##4)*cos(\blochsphere@tilt) + sin(\blochsphere@tilt)*cos(##3)<0, 1, 0)}
263 \ifthenelse{\boolean{blochsphere@labelmark}}
264 {
265 \ifnum\behind=1\relax
266 \path[current plane,on layer=back] (90-##3:\blochsphere@radius*\blochsphere@scale) coordinate[mark coordinate] (##2); %
267 \else
268 \path[current plane,on layer=front] (90-##3:\blochsphere@radius*\blochsphere@scale) coordinate[mark coordinate] (##2); %
269 \fi
270 }
271 {
272 \ifnum\behind=1\relax
273 \path[current plane,on layer=back] (90-##3:\blochsphere@radius*\blochsphere@scale) coordinate (##2); %
274 \else
275 \path[current plane,on layer=front] (90-##3:\blochsphere@radius*\blochsphere@scale) coordinate (##2); %
276 \fi
277 }
278 \endgroup
279 }%
280 \newcommand\labelLatLon[4][]{%
281 \begingroup
282 \pgfmathsetmacro\newphi{90-##3}
283 \labelPolar[##1]{##2}{\newphi}{##4}
284 \endgroup
285 }%
286 \newcommand\drawStateLatLon[4][]{
287 \begingroup
288 \pgfmathsetmacro\newphi{90-##3}
289 \drawStatePolar[##1]{##2}{\newphi}{##4}
290 \endgroup
291 }%
292 \newcommand\drawStatePolar[4][]{
293 \begingroup
294 \setkeys{blochsphere}{##1}
295 \labelPolar{##2}{##3}{##4}
296 \pgfmathsetmacro\behind{ifthenelse(-sin(##3)*sin(\blochsphere@rotation - ##4)*cos(\blochsphere@tilt) + sin(\blochsphere@tilt)*cos(##3)<0, 1, 0)}
297 \ifnum\behind=1\relax
298 \tikzset{test/.style={
299 postaction={
300 decorate,
301 decoration={
302 markings,
303 mark=at position \pgfdecoratedpathlength-0.5pt with {\arrow[\blochsphere@statecolor,line width=\blochsphere@statewidth,opacity=0.2] {>}; },
304 mark=between positions 0 and \pgfdecoratedpathlength-5pt step 0.5pt with {
305 \pgfmathsetmacro\myval{multiply(divide(
306 \pgfkeysvalueof{/pgf/decoration/mark info/distance from start}, \pgfdecoratedpathlength),100)};
307 \pgfsetfillcolor{\blochsphere@statecolor};
308 \pgfsetfillopacity{0.4-\myval/100*0.2}
309 \pgfpathcircle{\pgfpointorigin}{\blochsphere@statewidth};
310 \pgfusepath{fill};}
311 }}}}
312 \else
313 \tikzset{test/.style={
314 postaction={
315 decorate,
316 decoration={
317 markings,
318 mark=at position \pgfdecoratedpathlength-0.5pt with {\arrow[\blochsphere@statecolor,line width=\blochsphere@statewidth] {>}; },
319 mark=between positions 0 and \pgfdecoratedpathlength-5pt step 0.5pt with {
320 \pgfmathsetmacro\myval{multiply(divide(
321 \pgfkeysvalueof{/pgf/decoration/mark info/distance from start}, \pgfdecoratedpathlength),100)};
322 \pgfsetfillcolor{\blochsphere@statecolor};
323 \pgfsetfillopacity{0.4+\myval/100*0.6}
324 \pgfpathcircle{\pgfpointorigin}{\blochsphere@statewidth};
325 \pgfusepath{fill};}
326 }}}}
327 \fi
328 \path [test,on layer=main] (0,0) -- (##2);
329 \endgroup
330 }%
331 \newcommand\computeOffset[2][]{%
332 \setkeys{blochsphere}{##1}%
333 \pgfmathsetmacro{\x}{\blochsphere@shift[0]*cos(\blochsphere@rotation) + \blochsphere@shift[1]*sin(\blochsphere@rotation)}%
334 \pgfmathsetmacro\y{\blochsphere@shift[0]*sin(\blochsphere@rotation)*sin(\blochsphere@tilt) - \blochsphere@shift[1]*sin(\blochsphere@tilt)*cos(\blochsphere@rotation) + \blochsphere@shift[2]*cos(\blochsphere@tilt)}
335 \expandafter\def\csname ##2\endcsname{(\x pt,\y pt)}%
336 }%
337 \newcommand\computeVisibility[5][]{
338 \setkeys{blochsphere}{##1}
339 \pgfmathsetmacro\aphi{##2}
340 \pgfmathsetmacro\atheta{##3}
341 \pgfmathsetmacro\d{sqrt(\blochsphere@shift[0]^2+\blochsphere@shift[1]^2+\blochsphere@shift[2]^2)}%% distance from origin of shift
342 \pgfmathsetmacro\tatheta{\atheta+\blochsphere@rotation}
343 \pgfmathsetmacro\dot{cos(\aphi)}
344 \ifdim\dot pt<0.7 pt\relax%
345 \pgfmathsetmacro\domaintest{ifthenelse(and(\blochsphere@rotation - \atheta==0,or(\aphi==0,sin(\blochsphere@tilt==0))),0,1)}
346 \ifdim\domaintest pt=0 pt\relax
347 \pgfmathsetmacro\agamma{0}
348 \else
349 \pgfmathsetmacro\agamma{-90+atan(cos(\blochsphere@tilt)*cos(\blochsphere@rotation - \atheta)/(sin(\aphi)*sin(\blochsphere@tilt) + sin(\blochsphere@rotation - \atheta)*cos(\aphi)*cos(\blochsphere@tilt)))}
350 \fi
351 \else
352 \pgfmathsetmacro\domaintest{ifthenelse(and(Mod(\blochsphere@rotation-\atheta,180)==90,Mod(\blochsphere@tilt,180)==90),0,1)}
353 \pgfmathsetmacro\domaintesttwo{ifthenelse(Mod(\blochsphere@rotation-\atheta,180)==90,0,1)}
354 \pgfmathsetmacro\domaintestthree{ifthenelse(Mod(\blochsphere@tilt,180)==90,0,1)}
355 \ifdim\domaintest pt=0 pt\relax
356 \pgfmathsetmacro\agamma{360-90*\blochsphere@tilt/abs(\blochsphere@tilt)}
357 \else
358 \ifdim\domaintesttwo pt=0 pt\relax
359 \pgfmathsetmacro\agamma{360-90*(sin(\aphi)*tan(\blochsphere@tilt)+cos(\aphi)*sin(\blochsphere@rotation-\atheta))/abs(sin(\aphi)*tan(\blochsphere@tilt)+cos(\aphi)*sin(\blochsphere@rotation-\atheta))}
360 \else
361 \ifdim\domaintestthree pt=0 pt\relax
362 \pgfmathsetmacro\agamma{360-90*\blochsphere@tilt/abs(\blochsphere@tilt)*cos(\blochsphere@rotation-\atheta)/abs(cos(\blochsphere@rotation-\atheta))}
363 \else
364 \pgfmathsetmacro\agamma{360-atan( (sin(\aphi)*tan(\blochsphere@tilt)+cos(\aphi)*sin(\blochsphere@rotation-\atheta))/cos(\blochsphere@rotation-\atheta) )}
365 \fi
366 \fi
367 \fi
368 \fi
369 \pgfmathsetmacro\aalpha{acos(-sin(\aphi)*sin(\blochsphere@rotation)*cos(\atheta)*cos(\blochsphere@tilt) + sin(\aphi)*sin(\atheta)*cos(\blochsphere@rotation)*cos(\blochsphere@tilt) + sin(\blochsphere@tilt)*cos(\aphi))}
370 \pgfmathsetmacro\aalphatest{atan(\d/\blochsphere@radius)}
371 \ifdim\aalpha pt<\aalphatest pt\relax
372 \pgfmathsetmacro\abeta{0}
373 \else
374 \pgfmathsetmacro\abeta{acos(\d*cot(\aalpha)/\blochsphere@radius)}
375 \fi
376 \pgfmathsetmacro\abeta{ifthenelse(\blochsphere@shift[2]<0,\abeta+2*(90-\abeta),\abeta)}
377 \expandafter\pgfmathsetmacro\csname ##4\endcsname{\agamma}
378 \expandafter\pgfmathsetmacro\csname ##5\endcsname{\abeta}
379 }%
380 \tikzset{%
381 >=latex, % option for nice arrows
382 inner sep=0pt,%
383 outer sep=2pt,%
384 mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
385 fill=black,circle}%
386 }%
387 \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{%
388 color(0bp)=(tikz@ball!30!white);
389 color(9bp)=(tikz@ball!75!white);
390 color(18bp)=(tikz@ball!90!black);
391 color(25bp)=(tikz@ball!70!black);
392 color(50bp)=(black)
393 }%
394 \ifthenelse{\boolean{blochsphere@nested}}{}{%
395 \begin{tikzpicture}
396 \drawBall
397 }%
398 }
399 {
400 \ifthenelse{\boolean{blochsphere@nested}}{}{
401 \end{tikzpicture}%
402 }%
403 \endgroup%
404 }
405 \endinput
406 %%
407 %% End of file `blochsphere.sty'.