POV-Ray : Newsgroups : povray.general : platonic solids as solids : platonic solids as solids Server Time
7 Sep 2024 16:42:11 EDT (-0400)
  platonic solids as solids  
From: Paul Bourke
Date: 10 Dec 2005 23:04:51
Message: <pdbNOSPAM-404A20.15044911122005@news.povray.org>
I've created the first three platonic solids as "solid" objects
in POVRay so I do CSG operations on them. Before I give myself a
headache doing the icosahedron and dodecahedron I though I would
ask if someome has already done it.....and would care to share them.

// Tetrahedron
#declare THETA = degrees(atan(2/sqrt(2)));
#declare TET1 = intersection {
   plane { <0,0,1>, 0 rotate <0, THETA,0> translate < 1,0,0> }
   plane { <0,0,1>, 0 rotate <0,-THETA,0> translate <-1,0,0> }
   plane { <0,0,1>, 0 rotate <0, THETA,0> rotate <0,0,90> translate <0, 1,0> scale
<1,1,-1> }
   plane { <0,0,1>, 0 rotate <0,-THETA,0> rotate <0,0,90> translate <0,-1,0> scale
<1,1,-1> }
   scale DIST/2
}

// Octahedron, made of an upper and lower half
#declare THETA = degrees(atan(sqrt(2)));
#declare DIST = 1 / (2 * sqrt(2));
#declare OCT0 = intersection {
   plane { <0,0,1>, 0 rotate <0, THETA,0> translate < DIST,0,0> }
   plane { <0,0,1>, 0 rotate <0,-THETA,0> translate <-DIST,0,0> }
   plane { <0,0,1>, 0 rotate < THETA,0,0> translate <0,-DIST,0> }
   plane { <0,0,1>, 0 rotate <-THETA,0,0> translate <0, DIST,0> }
   plane { <0,0,-1>, 0 }
}
#declare OCT1 = union {
   object { OCT0 }
   object { OCT0 scale <1,1,-1> translate <0,0,0.001> }
   scale 0.5/DIST
}

We already have "box" for the hexahedron.

-- 
Paul Bourke
pdb(NOSPAM)swin.edu.au


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.