[Tex/LaTex] 3d axis and polyhedron with line segment towards origin

3dtikz-pgf

I would like to make a 3d plot containing the 3d axis and a convex polyhedron or better a Dodecahedron

screenshot

on the positive side for which one of its boundary edge points on its top is annotated e.g. \hat{x} "chosen" or "selected" and draw a line segment from that labeled point towards the origin. Then also highlight and annotate where this line segment intersects with the convex hull of the Dodecahedron. Would this be a nightmare to do using TikZ?

btw what's the best way to learn TikZ once and for all? are there good books? I always end up consuming TikZ one way or another 🙁

UPDATE: actually I need several plots around this same idea to illustrate in detail the behavior of an algorithm I need to document. I hope that by seeing how it is done for this case I will be able to generalize and do the others by myself … though knowing how difficult it TikZ … 🙁

Best Answer

\documentclass{article}
\usepackage[dvipsnames]{pstricks}
\usepackage{pst-solides3d}
\begin{document}

\begin{pspicture}[solidmemory,fontsize=20](-4,-4)(4,4)
\psset{Decran=30,viewpoint=20 40 30 rtp2xyz, lightsrc=viewpoint}
\psSolid[object=dodecahedron,a=2.5,action=draw*,name=my_dodecahedron,
         fillcolor=green!50!white]
\psSolid[object=point,definition=solidgetsommet,
  args=my_dodecahedron 0,linecolor=blue,text=A,pos=uc,name=A]
\psSolid[object=point,definition=solidgetsommet,
  args=my_dodecahedron 4,linecolor=blue,text=B,pos=uc,name=B]
\psSolid[object=line,args=A B,linecolor=blue]
\psSolid[object=vecteur,args=A,linecolor=blue]
\psSolid[object=vecteur,args=B,linecolor=blue]
\axesIIID(2.5,2.5,2.5)(3.5,3,3)
\end{pspicture}
%
\begin{pspicture}[solidmemory,fontsize=20](-4,-4)(4,4)
\psset{Decran=30,viewpoint=20 40 35 rtp2xyz, lightsrc=viewpoint}
\psSolid[object=dodecahedron,a=2.5,action=draw*,RotX=22.5,RotY=22.5,
  fillcolor=red!50!white,name=my_dodecahedron,action=draw**,
%  numfaces=all,num=all,
]
\psSolid[object=point,definition=solidcentreface,
   args=my_dodecahedron 2,linecolor=white,text=Centre face 2,pos=uc]
\psSolid[object=point,definition=solidgetsommet,
  args=my_dodecahedron 0,linecolor=white,text=A,pos=cl,name=A]
\psSolid[object=point,definition=solidgetsommet,
  args=my_dodecahedron 4,linecolor=white,text=B,pos=cl,name=B]
\psSolid[object=line,args=A B,linecolor=white]
\end{pspicture}

\end{document}

enter image description here