(save-name "p-tetrahedron-2.scm")

(clear)

(hint-normal)

(define (pow a b) (exp (* (log a) b)))

(define (build-tetrahedron)
  (let ((ob (build-polygons 12 2))
        (L (pow (/ 1 3) (/ 1 3)))
        (-L (- 0 (pow (/ 1 3) (/ 1 3))))
       )
    (grab ob)

    (pdata-set "p"  0 (vector -0.5 -0.5 -0.5))
    (pdata-set "p"  1 (vector -0.5  0.5  0.5))
    (pdata-set "p"  2 (vector  0.5  0.5 -0.5))

    (pdata-set "p"  3 (vector -0.5 -0.5 -0.5))
    (pdata-set "p"  4 (vector  0.5 -0.5  0.5))
    (pdata-set "p"  5 (vector -0.5  0.5  0.5))

    (pdata-set "p"  6 (vector -0.5  0.5  0.5))
    (pdata-set "p"  7 (vector  0.5 -0.5  0.5))
    (pdata-set "p"  8 (vector  0.5  0.5 -0.5))

    (pdata-set "p"  9 (vector -0.5 -0.5 -0.5))
    (pdata-set "p" 10 (vector  0.5  0.5 -0.5))
    (pdata-set "p" 11 (vector  0.5 -0.5  0.5))

    (pdata-set "n"  0 (vector -L L -L))
    (pdata-set "n"  1 (vector -L L -L))
    (pdata-set "n"  2 (vector -L L -L))

    (pdata-set "n"  3 (vector -L -L L))
    (pdata-set "n"  4 (vector -L -L L))
    (pdata-set "n"  5 (vector -L -L L))

    (pdata-set "n"  6 (vector L L L))
    (pdata-set "n"  7 (vector L L L))
    (pdata-set "n"  8 (vector L L L))

    (pdata-set "n"  9 (vector L -L -L))
    (pdata-set "n" 10 (vector L -L -L))
    (pdata-set "n" 11 (vector L -L -L))

    (ungrab)
    ob
  )
)

(colour (vector 0.5 1 0))
(build-tetrahedron)

(translate (vector 3 0 0))
(colour (vector 0.5 1 0))
(build-cube)

