Created
January 21, 2025 12:13
-
-
Save fredrik-johansson/7c7a15bc100aeccc3f2c3ba9954ab82b to your computer and use it in GitHub Desktop.
ball bearing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[tikz,border=0.3mm]{standalone} | |
\usepackage{tikz,ifthen} | |
\usepackage{contour} | |
\usepackage{arrayjob} | |
\begin{document} | |
\begin{tikzpicture}[scale=2.5, every node/.style={transform shape}, every draw/.style={transform shape}] | |
\definecolor{gray55} {HTML}{555555} | |
\definecolor{gray44} {HTML}{444444} | |
\definecolor{gray33} {HTML}{333333} | |
\definecolor{gray22} {HTML}{222222} | |
\definecolor{gray66} {HTML}{666666} | |
\definecolor{gray88} {HTML}{888888} | |
\definecolor{grayee} {HTML}{eeeeee} | |
\definecolor{graycc} {HTML}{cccccc} | |
\definecolor{graydd} {HTML}{dddddd} | |
\definecolor{grayff} {HTML}{ffffff} | |
\newarray\names | |
\readarray{names}{$+$&$-$&$\times$&$/$} | |
% modified from | |
% https://tex.stackexchange.com/questions/54193/how-to-draw-a-shaded-sphere | |
\makeatletter | |
\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-20bp}{20bp}}{% | |
color(0bp)=(tikz@ball!0!white); | |
color(9bp)=(tikz@ball!0!white); | |
color(21bp)=(tikz@ball!55!black); | |
color(25bp)=(black!30); | |
color(30bp)=(black!20)} | |
\makeatother | |
\def\shinyballs{1} | |
\def\nBalls{7} | |
\def\rradius{0.015} | |
\def\raceOuter{3*0.28} | |
\def\raceInner{1.75*0.28} | |
\def\raceOuterb{3.25*0.28} | |
\def\raceInnerb{1.5*0.28} | |
\def\nGuides{7} | |
% background | |
\fill [gray44,even odd rule] (0,0) circle[radius=\raceInner] circle[radius=\raceOuter]; | |
\foreach \i in {1,...,\nGuides} { | |
\draw [gray33] (0,0) circle ({\raceInner + (\raceOuter - \raceInner) * (\i / (\nGuides+1))}); | |
} | |
% Draw the balls, equally spaced | |
\foreach \i in {1,...,\nBalls} { | |
\ifthenelse{\shinyballs = 1}{ | |
% shaded balls | |
\shade [ball color=white] ({(\raceInner + \raceOuter)/2 * cos(360*\i/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*\i/\nBalls)}) circle (0.625*0.256); | |
\fill[even odd rule,shading = axis,rectangle, left color=gray66, right color=gray88, shading angle=225, anchor=north] | |
({(\raceInner + \raceOuter)/2 * cos(360*\i/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*\i/\nBalls)}) circle[radius=0.15] circle[radius=0.16]; | |
}{ | |
% flat balls | |
\fill[even odd rule,shading = axis,rectangle, left color=grayee, right color=grayff, shading angle=225, anchor=north] | |
({(\raceInner + \raceOuter)/2 * cos(360*\i/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*\i/\nBalls)}) circle (0.625*0.25); | |
\fill[even odd rule,shading = axis,rectangle, left color=gray88, right color=grayee, shading angle=225, anchor=north] | |
({(\raceInner + \raceOuter)/2 * cos(360*\i/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*\i/\nBalls)}) circle[radius=0.15] circle[radius=0.16]; | |
} | |
} | |
% races | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=graycc, right color=grayff, shading angle=225, anchor=north] (0,0) circle[radius=\raceInner] circle[radius=\raceInnerb]; | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=graycc, right color=grayff, shading angle=225, anchor=north] (0,0) circle[radius=\raceOuter] circle[radius=\raceOuterb]; | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=grayee, right color=gray88, shading angle=225, anchor=north] (0,0) circle[radius={\raceInnerb-\rradius}] circle[radius=\raceInnerb]; | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=gray88, right color=grayee, shading angle=225, anchor=north] (0,0) circle[radius={\raceInner+\rradius}] circle[radius=\raceInner]; | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=grayee, right color=gray88, shading angle=225, anchor=north] (0,0) circle[radius={\raceOuter-\rradius}] circle[radius=\raceOuter]; | |
\fill [lightgray,even odd rule,shading = axis,rectangle, left color=gray88, right color=grayee, shading angle=225, anchor=north] (0,0) circle[radius={\raceOuterb+\rradius}] circle[radius=\raceOuterb]; | |
\draw ({(\raceInner + \raceOuter)/2 * cos(360*0/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*0/\nBalls)}) node {\tiny \contour{graycc}{$+$}}; | |
\draw ({(\raceInner + \raceOuter)/2 * cos(360*1/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*1/\nBalls)}) node {\tiny \contour{graycc}{$-$}}; | |
\draw ({(\raceInner + \raceOuter)/2 * cos(360*2/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*2/\nBalls)}) node {\tiny \contour{graycc}{$\times$}}; | |
\draw ({(\raceInner + \raceOuter)/2 * cos(360*3/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*3/\nBalls)}) node {\tiny \contour{graycc}{$/$}}; | |
\draw ({(\raceInner + \raceOuter)/2 * cos(360*4/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*4/\nBalls)}) node[scale=0.9] {\tiny \contour{graycc}{$\!\sqrt{}$}}; | |
\ifthenelse{\nBalls > 5}{\draw ({(\raceInner + \raceOuter)/2 * cos(360*5/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*5/\nBalls)}) node[scale=0.9] {\tiny \contour{graycc}{$\pi$}}}{}; | |
\ifthenelse{\nBalls > 6}{\draw ({(\raceInner + \raceOuter)/2 * cos(360*6/\nBalls)}, {(\raceInner + \raceOuter)/2 * sin(360*6/\nBalls)}) node[scale=0.9] {\tiny \contour{graycc}{$\zeta$}}}{}; | |
\contourlength{0.12mm} | |
\draw[color=black] (0,-1.30) node[] {\LARGE \contour{grayee}{\textbf{FLINT}}}; | |
%\draw[color=black] (0,-1.30) node[] {\LARGE \textbf{FLINT}}; | |
\draw[color=black] (0,-1.65) node[scale=0.8] {\tiny \textit{Fast Library for Number Theory}}; | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment