File size: 1,380 Bytes
c09a3f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Modified from PlotNeuralNet (MIT, H. Iqbal): internal macros renamed (\caption -> \pnncaption, \fill -> \pnnfill) so the styles do not clash with LaTeX figure captions.
\ProvidesPackage{Ball}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%This Block can draw small Ball
%Elementwise or reduction operations can be drawn with this
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\tikzset{Ball/.pic={\tikzset{/sphere/.cd,#1}	 	

\pgfmathsetmacro{\r}{\radius*\scale}

\shade[ball color=\pnnfill,opacity=\opacity] (0,0,0) circle (\r);
\draw (0,0,0) circle [radius=\r] node[scale=4*\r] {\logo};

\coordinate (\name-anchor) at ( 0 , 0  , 0) ;
\coordinate (\name-east)   at ( \r, 0  , 0) ;
\coordinate (\name-west)   at (-\r, 0  , 0) ;
\coordinate (\name-north)  at ( 0 , \r , 0) ;
\coordinate (\name-south)  at ( 0 , -\r, 0) ;

\path (\name-south) + (0,-20pt) coordinate (caption-node) 
edge ["\textcolor{black}{\bf \pnncaption}"'] (caption-node); %Ball caption

},
/sphere/.search also={/tikz},
/sphere/.cd,
radius/.store       in=\radius,
scale/.store        in=\scale,
caption/.store      in=\pnncaption,
name/.store         in=\name,
fill/.store         in=\pnnfill,
logo/.store         in=\logo,
opacity/.store      in=\opacity,
logo=$\Sigma$,
fill=green,
opacity=0.10,
scale=0.2,
radius=0.5,
caption=,
name=,
}