0

"Spikey" is the logo of Wolfram Research, makers of Mathematica and the Wolfram Language. I thought it would be a fun experiment, to draw the various versions of "Spikey" in Tex. enter image description here

7
  • 2
    *⠀⠀⠀⠀⠀⠀⠀⠀⠀:-) Nov 19, 2019 at 4:55
  • 2
    What have you tried? Nov 19, 2019 at 4:58
  • 1
    Well, you could get the data of the "TriakisIcosahedron", let Mathematica order its faces according to their distance to the observer, and draw them. Or use a patch plot that ships with pgfplots. So yes, it could be possible to draw something like this, but it will be large efforts.
    – user194703
    Nov 19, 2019 at 5:30
  • @HenriMenke Honestly, I didnt know where to begin, what I drew using tikz, was not worthy to be shared. Nov 19, 2019 at 7:53
  • 1
    From the version 6 of Mathematica the logo has been more red "because represent all the blood, sweat and long nights that my coworkers put into Version 6 over the years" see Michael Trott post
    – vi pa
    Nov 20, 2019 at 10:53

1 Answer 1

2

This is just for fun. One can indeed draw something going in that direction. If you want to run this, download the tikz-3dtools library from here, and put it somewhere where TeX can find it.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3dtools}
\begin{document}
\tikzset{closed polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi} -- cycle}},polygon/.style={insert path={foreach \Coord [count=\nCoord] in {#1}
 {\ifnum\nCoord=1
  \Coord
 \else
  -- \Coord
 \fi}}}}
\makeatletter


% main code
\foreach \X in {5,15,...,355}
{\tdplotsetmaincoords{90+30*sin(\X)}{\X}
\begin{tikzpicture}[tdplot_main_coords,font=\sffamily,fill opacity=1,line
join=round,scale=pi]
  \path[tdplot_screen_coords,use as bounding box] (-2,-2) rectangle (2,2);
  % define the vertices (there are certainly superior naming conventions)
  \path   (0., 0., 1.63925) coordinate (p1)  
 (0.262866, -0.809017, 1.11352) coordinate (p2)  
 (0.262866, 0.809017, 1.11352) coordinate (p3)  
 (0.850651, 0., 1.11352) coordinate (p4)  
 (0., 0., -1.63925) coordinate (p5)   
 (-0.262866, -0.809017, -1.11352) coordinate (p6)  
 (-0.262866, 0.809017, -1.11352) coordinate (p7) 
 (0.688191, -0.5, -1.11352) coordinate (p8)  
 (0.688191, 0.5, -1.11352) coordinate (p9)  
 (-0.850651, 0., -1.11352) coordinate (p10)  
 (-0.688191, -0.5, 1.11352) coordinate (p11)  
 (-0.688191, 0.5, 1.11352) coordinate (p12)  
 (-1.37638, 0., -0.262866) coordinate (p13)  
 (1.11352, -0.809017, -0.262866) coordinate (p14)  
 (1.11352, 0.809017, -0.262866) coordinate (p15) 
 (-0.425325, -1.30902, -0.262866) coordinate (p16)  
 (-0.425325, 1.30902, -0.262866) coordinate (p17) 
 (1.37638, 0., 0.262866) coordinate (p18)  
 (0.425325, -1.30902, 0.262866) coordinate (p19) 
 (0.425325, 1.30902, 0.262866) coordinate (p20)  
 (-1.11352, -0.809017, 0.262866) coordinate (p21)  
 (-1.11352, 0.809017, 0.262866) coordinate (p22) 
 (1.18617, -0.861803, 0.733094) coordinate (p23) 
 (1.18617, 0.861803, 0.733094) coordinate (p24)  
 (-1.46619, 0., 0.733094) coordinate (p25)  
 (-0.453077, -1.39443, 0.733094) coordinate (p26) 
 (-0.453077, 1.39443, 0.733094) coordinate (p27) 
 (1.46619, 0., -0.733094) coordinate (p28)  
 (-1.18617, -0.861803, -0.733094) coordinate (p29)  
 (-1.18617, 0.861803, -0.733094) coordinate (p30) 
 (0.453077, -1.39443, -0.733094) coordinate (p31) 
 (0.453077, 1.39443, -0.733094) coordinate (p32); 
  % define the plane data as a list of <drawing options>/<shape>/<vertices> 
  \def\PlaneData{%
  {draw,fill=randomcolor}/closed polygon/{(p1),(p26),(p2)},% 
 {draw,fill=randomcolor}/closed polygon/{(p5),(p31),(p6)},% 
 {draw,fill=randomcolor}/closed polygon/{(p3),(p27),(p1)},% 
 {draw,fill=randomcolor}/closed polygon/{(p7),(p32),(p5)},% 
 {draw,fill=randomcolor}/closed polygon/{(p19),(p26),(p31)},% 
 {draw,fill=randomcolor}/closed polygon/{(p32),(p27),(p20)},% 
 {draw,fill=randomcolor}/closed polygon/{(p26),(p23),(p2)},% 
 {draw,fill=randomcolor}/closed polygon/{(p3),(p24),(p27)},% 
 {draw,fill=randomcolor}/closed polygon/{(p30),(p29),(p13)},% 
 {draw,fill=randomcolor}/closed polygon/{(p29),(p26),(p21)},% 
 {draw,fill=randomcolor}/closed polygon/{(p22),(p27),(p30)},% 
 {draw,fill=randomcolor}/closed polygon/{(p16),(p26),(p29)},% 
 {draw,fill=randomcolor}/closed polygon/{(p30),(p27),(p17)},% 
 {draw,fill=randomcolor}/closed polygon/{(p31),(p29),(p6)},% 
 {draw,fill=randomcolor}/closed polygon/{(p7),(p30),(p32)},% 
 {draw,fill=randomcolor}/closed polygon/{(p31),(p23),(p19)},% 
 {draw,fill=randomcolor}/closed polygon/{(p20),(p24),(p32)},% 
 {draw,fill=randomcolor}/closed polygon/{(p18),(p24),(p23)},% 
 {draw,fill=randomcolor}/closed polygon/{(p8),(p28),(p31)},% 
 {draw,fill=randomcolor}/closed polygon/{(p9),(p32),(p28)},% 
 {draw,fill=randomcolor}/closed polygon/{(p14),(p23),(p31)},% 
 {draw,fill=randomcolor}/closed polygon/{(p32),(p24),(p15)},% 
 {draw,fill=randomcolor}/closed polygon/{(p23),(p24),(p4)},% 
 {draw,fill=randomcolor}/closed polygon/{(p31),(p28),(p14)},% 
 {draw,fill=randomcolor}/closed polygon/{(p28),(p32),(p15)},% 
 {draw,fill=randomcolor}/closed polygon/{(p21),(p25),(p29)},% 
 {draw,fill=randomcolor}/closed polygon/{(p30),(p25),(p22)},% 
 {draw,fill=randomcolor}/closed polygon/{(p28),(p23),(p14)},% 
 {draw,fill=randomcolor}/closed polygon/{(p15),(p24),(p28)},% 
 {draw,fill=randomcolor}/closed polygon/{(p18),(p23),(p28)},% 
 {draw,fill=randomcolor}/closed polygon/{(p28),(p24),(p18)},% 
 {draw,fill=randomcolor}/closed polygon/{(p29),(p25),(p13)},% 
 {draw,fill=randomcolor}/closed polygon/{(p13),(p25),(p30)},% 
 {draw,fill=randomcolor}/closed polygon/{(p2),(p23),(p1)},% 
 {draw,fill=randomcolor}/closed polygon/{(p8),(p31),(p5)},% 
 {draw,fill=randomcolor}/closed polygon/{(p1),(p24),(p3)},% 
 {draw,fill=randomcolor}/closed polygon/{(p5),(p32),(p9)},% 
 {draw,fill=randomcolor}/closed polygon/{(p19),(p23),(p26)},% 
 {draw,fill=randomcolor}/closed polygon/{(p27),(p24),(p20)},% 
 {draw,fill=randomcolor}/closed polygon/{(p11),(p26),(p1)},% 
 {draw,fill=randomcolor}/closed polygon/{(p6),(p29),(p5)},% 
 {draw,fill=randomcolor}/closed polygon/{(p1),(p27),(p12)},% 
 {draw,fill=randomcolor}/closed polygon/{(p5),(p30),(p7)},% 
 {draw,fill=randomcolor}/closed polygon/{(p1),(p25),(p11)},% 
 {draw,fill=randomcolor}/closed polygon/{(p5),(p29),(p10)},% 
 {draw,fill=randomcolor}/closed polygon/{(p12),(p25),(p1)},% 
 {draw,fill=randomcolor}/closed polygon/{(p10),(p30),(p5)},% 
 {draw,fill=randomcolor}/closed polygon/{(p1),(p23),(p4)},% 
 {draw,fill=randomcolor}/closed polygon/{(p5),(p28),(p8)},% 
 {draw,fill=randomcolor}/closed polygon/{(p4),(p24),(p1)},% 
 {draw,fill=randomcolor}/closed polygon/{(p9),(p28),(p5)},% 
 {draw,fill=randomcolor}/closed polygon/{(p10),(p29),(p30)},% 
 {draw,fill=randomcolor}/closed polygon/{(p21),(p26),(p25)},% 
 {draw,fill=randomcolor}/closed polygon/{(p22),(p25),(p27)},% 
 {draw,fill=randomcolor}/closed polygon/{(p16),(p29),(p31)},% 
 {draw,fill=randomcolor}/closed polygon/{(p32),(p30),(p17)},% 
 {draw,fill=randomcolor}/closed polygon/{(p25),(p26),(p11)},% 
 {draw,fill=randomcolor}/closed polygon/{(p27),(p25),(p12)},% 
 {draw,fill=randomcolor}/closed polygon/{(p31),(p26),(p16)},% 
 {draw,fill=randomcolor}/closed polygon/{(p17),(p27),(p32)}}
  % normal of screen (last row of the rotation matrix)
  \path[overlay] ({sin(\tdplotmaintheta)*sin(\tdplotmainphi)},
       {-1*sin(\tdplotmaintheta)*cos(\tdplotmainphi)},
       {cos(\tdplotmaintheta)}) coordinate (n); 
  % build up the list of projections  
  \foreach \Style/\Poly/\CoordLst [count=\nC] in \PlaneData
  {%
   \pgfmathsetmacro{\mybarycenter}{barycenter("\CoordLst")}
   \pgfmathsetmacro{\currproj}{TD("(n)o(\mybarycenter)")}
   \foreach \Coord [count=\nP] in \CoordLst
   {\expandafter\xdef\csname td@vertex@\romannumeral\nP\endcsname{\Coord}}
   \pgfmathsetmacro{\mynormal}{TD("\td@vertex@i-\td@vertex@ii x\td@vertex@iii-\td@vertex@ii")}
   \pgfmathtruncatemacro{\mysign}{ifthenelse(TD("(\mynormal)o(0,0,1)")<0,-1,1)}
   \pgfmathtruncatemacro{\mylightproj}{60+\mysign*40*TD("(\mynormal)o(0.3,0.1,1)")}
   %\pgfmathtruncatemacro{\mylightproj}{20+\nC}
   \expandafter\xdef\csname tikz@td@saturation\romannumeral\nC\endcsname{\mylightproj}
   \ifnum\nC=1
    \xdef\LstProj{\currproj}
  \else
    \xdef\LstProj{\LstProj,\currproj}
  \fi
  \expandafter\gdef\csname tikz@td@layer\romannumeral\nC\endcsname{}%
  \expandafter\xdef\csname tikz@td@poly\romannumeral\nC\endcsname{%
  \noexpand\path[\Style,\Poly={\CoordLst}];}
  \xdef\tikz@td@planes{\nC}%
  }
 \foreach \X [count=\nC] in \LstProj
 {\pgfmathtruncatemacro{\mypos}{pos(\X,"\LstProj")}
  \expandafter\edef\expandafter\tempa{\csname tikz@td@layer\romannumeral\mypos\endcsname}%
  \edef\tempb{}%
  \ifx\tempb\tempa\relax
    \expandafter\xdef\csname tikz@td@layer\romannumeral\mypos\endcsname{\nC}%
  \else 
    \expandafter\xdef\csname tikz@td@layer\romannumeral\mypos\endcsname{\tempa,\nC}%
  \fi
 }
 \foreach \X in {1,...,\tikz@td@planes}
 {\expandafter\edef\expandafter\tempa{\csname tikz@td@layer\romannumeral\X\endcsname}%
  \edef\tempb{}%
  \ifx\tempb\tempa\relax
  \else 
    \foreach \Y in \tempa
    {
      \edef\mysaturation{\csname tikz@td@saturation\romannumeral\Y\endcsname}
      \colorlet{randomcolor}{red!\mysaturation}
      \csname tikz@td@poly\romannumeral\Y\endcsname
    }
  \fi}
\end{tikzpicture}}
\makeatother  
\end{document}

enter image description here

It is nowhere near as fancy as Mathematica's version. Absolutely. It was just an exercise for me to see how well some 3d ordering routine works. As of now I think it does.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .