Saltar al contenido

Escribe un código para dibujar el icosaedro.

Este team de redactores ha pasado horas investigando para darle resolución a tus búsquedas, te regalamos la respuesta así que nuestro objetivo es que te sea de gran ayuda.

Solución:

Este código requiere la biblioteca experimental 3dtools.

documentclass[tikz,border=3mm]standalone
usepackagetikz-3dplot
usetikzlibrarybackgrounds,3dtools,shapes.geometric
tikzsetpics/isocahedron/.style=code=
path foreach Coord [count=X] in 
(0.,0.,-0.9510565162951536),
(0.,0.,0.9510565162951536),
(-0.85065080835204,0.,-0.42532540417601994),
(0.85065080835204,0.,0.42532540417601994),
(0.6881909602355868,-0.5,-0.42532540417601994),
(0.6881909602355868,0.5,-0.42532540417601994),
(-0.6881909602355868,-0.5,0.42532540417601994),
(-0.6881909602355868,0.5,0.42532540417601994),
(-0.2628655560595668,-0.8090169943749475,-0.42532540417601994),
(-0.2628655560595668,0.8090169943749475,-0.42532540417601994),
(0.2628655560595668,-0.8090169943749475,0.42532540417601994),
(0.2628655560595668,0.8090169943749475,0.42532540417601994)
  Coord coordinate (pX) pgfextraxdefNumVerticesX;
 %messagenumber of vertices is NumVertices^^J 
 % normal of screen 
 path[overlay] (sin(tdplotmaintheta)*sin(tdplotmainphi),
    -1*sin(tdplotmaintheta)*cos(tdplotmainphi),
    cos(tdplotmaintheta)) coordinate (n)
    (-sqrt(1/6),sqrt(3/6),sqrt(2/6))  coordinate (L); 
 edeflstPast0
 foreach poly in 
 2,12,8,2,8,7,2,7,11,2,11,4,2,4,12,5,9,1,6,5,1,
    10,6,1,3,10,1,9,3,1,12,10,8,8,3,7,7,9,11,11,5,4,4,6,12,
    5,11,9,6,4,5,10,12,6,3,8,10,9,7,3
 
  pgfmathtruncatemacroionepoly[0]
  pgfmathtruncatemacroitwopoly[1]
  pgfmathtruncatemacroithreepoly[2]
  path[overlay,3d coordinate=(dA)=(pitwo)-(pione),
   3d coordinate=(dB)=(pitwo)-(pithree),
   3d coordinate=(nA)=(dA)x(dB)] ;
  pgfmathtruncatemacrojtestsign(TD("(nA)o(pione)"))
  % make sure that the normal points outwards
  ifnumjtest<0
   path[overlay,3d coordinate=(nA)=(dB)x(dA)];
  fi
  % compute projection the normal of the polygon on the normal of screen    
  pgfmathsetmacromyprojTD("(nA)o(n)")
  pgfmathsetmacrolprojTD("(nA)o(L)")
  pgfmathtruncatemacroitestsign(myproj)
  ifnumitest>-1 
   draw[thick] [fill=white,fill opacity=0.2]
   plot[samples at=poly,variable=x](px) -- cycle; 
  else
   beginscope[on background layer] 
    draw[gray,ultra thin] 
    plot[samples at=poly,variable=x](px) -- cycle;  
   endscope
  fi
  
begindocument
tdplotsetmaincoords7065

begintikzpicture[line cap=round,line join=round,
    bullet/.style=circle,fill,inner sep=1.5pt]
 pic[tdplot_main_coords,scale=2,rotate=30]isocahedron;
 %foreach X in 1,...,NumVertices  path (pX) node[above]X;
 path (p12) node[above]$D$ -- 
  node[bullet,label=above:$N$](N)
  (p2) node[above]$A$
  (p7) node[left]$B$ -- 
  node[bullet,label=[xshift=3pt]above:$M$]
  (p11) node[below right]$C$;
 beginscope[xshift=5cm]
  path let p1=($(N)-(0,0)$) in
   node[regular polygon,regular polygon sides=6,draw,thick,minimum size=2*y1] 
  (6gon);
  path (6gon.corner 1) node[above] $D$
   -- node[bullet,label=above:$N$](N')
   (6gon.corner 2) node[above] $A$;
  draw[thick] (6gon.corner 3) node[left] $M$ 
   -- node[bullet,label=below right:$O$](O)
   (6gon.corner 6)
   (O) edge (N');
  draw ([xshift=-1em]O.center)  |- ([yshift=1em]O.center);
 endscope
endtikzpicture
enddocument

ingrese la descripción de la imagen aquí

El icosaedro es giratorio en 3d.

documentclass[tikz,border=3mm]standalone
usepackagetikz-3dplot
usetikzlibrarybackgrounds,3dtools,shapes.geometric
tikzsetpics/isocahedron/.style=code=
path foreach Coord [count=X] in 
(0.,0.,-0.9510565162951536),
(0.,0.,0.9510565162951536),
(-0.85065080835204,0.,-0.42532540417601994),
(0.85065080835204,0.,0.42532540417601994),
(0.6881909602355868,-0.5,-0.42532540417601994),
(0.6881909602355868,0.5,-0.42532540417601994),
(-0.6881909602355868,-0.5,0.42532540417601994),
(-0.6881909602355868,0.5,0.42532540417601994),
(-0.2628655560595668,-0.8090169943749475,-0.42532540417601994),
(-0.2628655560595668,0.8090169943749475,-0.42532540417601994),
(0.2628655560595668,-0.8090169943749475,0.42532540417601994),
(0.2628655560595668,0.8090169943749475,0.42532540417601994)
  Coord coordinate (pX) pgfextraxdefNumVerticesX;
 %messagenumber of vertices is NumVertices^^J 
 % normal of screen 
 path[overlay] (sin(tdplotmaintheta)*sin(tdplotmainphi),
    -1*sin(tdplotmaintheta)*cos(tdplotmainphi),
    cos(tdplotmaintheta)) coordinate (n)
    (-sqrt(1/6),sqrt(3/6),sqrt(2/6))  coordinate (L); 
 edeflstPast0
 foreach poly in 
 2,12,8,2,8,7,2,7,11,2,11,4,2,4,12,5,9,1,6,5,1,
    10,6,1,3,10,1,9,3,1,12,10,8,8,3,7,7,9,11,11,5,4,4,6,12,
    5,11,9,6,4,5,10,12,6,3,8,10,9,7,3
 
  pgfmathtruncatemacroionepoly[0]
  pgfmathtruncatemacroitwopoly[1]
  pgfmathtruncatemacroithreepoly[2]
  path[overlay,3d coordinate=(dA)=(pitwo)-(pione),
   3d coordinate=(dB)=(pitwo)-(pithree),
   3d coordinate=(nA)=(dA)x(dB)] ;
  pgfmathtruncatemacrojtestsign(TD("(nA)o(pione)"))
  % make sure that the normal points outwards
  ifnumjtest<0
   path[overlay,3d coordinate=(nA)=(dB)x(dA)];
  fi
  % compute projection the normal of the polygon on the normal of screen    
  pgfmathsetmacromyprojTD("(nA)o(n)")
  pgfmathsetmacrolprojTD("(nA)o(L)")
  pgfmathtruncatemacroitestsign(myproj)
  ifnumitest>-1 
   draw[thick] [fill=white,fill opacity=0.2]
   plot[samples at=poly,variable=x](px) -- cycle; 
  else
   beginscope[on background layer] 
    draw[gray,ultra thin] 
    plot[samples at=poly,variable=x](px) -- cycle;  
   endscope
  fi
  
begindocument
foreach XX in 0,10,...,350
begintikzpicture[line cap=round,line join=round,
    bullet/.style=circle,fill,inner sep=1.5pt]
 path (-3.5,-3.5) rectangle (3.5,3.5);
 tdplotsetmaincoords60+20*sin(XX)XX  
 pic[tdplot_main_coords,scale=3]isocahedron;
endtikzpicture
enddocument

ingrese la descripción de la imagen aquí

Por favor, vea si cumple con el requisito.

ingrese la descripción de la imagen aquí

documentclass[a4paper]amsart
usepackagegraphics, tkz-berge
begindocument
beginfigure
begintikzpicture
  beginscope[rotate=90]
    SetVertexNoLabel   % <--- This avoids that default $a_0$, .. $b_0$ labels show up
    grIcosahedral[form=1,RA=3,RB=1.5]

    % Following two lines assign labels to a-like and b-like nodes
    % change it as you prefer
    AssignVertexLabela$v_0$, $v_1$, $v_2$, $v_3$, $v_4$, $v_5$;
    AssignVertexLabelb$v_6$, $v_7$, $v_8$, $v_9$, $v_10$, $v_11$;

    % The remaining code is unchanged
    SetUpEdge[color=white,style=double=black,double distance=2pt]
    EdgeInGraphLoopa6
    EdgeFromOneToSelab01,5
    Edges(a2,b1,b3,b5,a4)
    Edge(a3)(b3)
    Edges(a1,b1,b5,a5)
    Edges(a2,b3,a4)
  endscope
endtikzpicture
endfigure
enddocument

Gracias a @JLDiaz que ha dado la solución: https://tex.stackexchange.com/a/183075/197451

Sección de Reseñas y Valoraciones

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)


Tags : /

Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *