c0de paint 0.2.0Diese Seite auf Deutsch

Platonic solids ​

DRAW_TETRAHEDRON, DRAW_OCTAHEDRON, DRAW_DODECAHEDRON and DRAW_ICOSAHEDRON draw the Platonic solid around center, with all corners at the distance r from it. The lines are their edges. Each has a fixed orientation: the tetrahedron has its corners in alternate corners of a cube, the octahedron on the axes, the icosahedron and the dodecahedron are aligned with the axes by the golden ratio. Other orientations come from CANVAS_ROTATE. The cube is DRAW_BOX. Because all corners lie at the distance r, the solids don't stand on center: the lowest corner of the tetrahedron lies r/√3 (0.58 r) below the center, the others r below it; move the canvas with CANVAS_MOVE or use CANVAS_MIN to put a solid on the ground. The edges of small solids keep to their surface.

Parameters and results

  • canvas TYPE c0de_paint/cpaint/CANVAS: the canvas (a variable)
  • center STRUCT c0de_paint/cpaint/POINT: the center
  • r INTEGER: the distance of the corners
  • line_style, side_style, fill_style TYPE c0de_paint/cpaint/STYLE: the styles (optional)

Example

c0de
CALL c0de_paint/cpaint/DRAW_ICOSAHEDRON
    PARAMETER canvas c ;
    PARAMETER center middle ;
    PARAMETER r 12 ;
    PARAMETER line_style gold ;

Used in the tutorials ​