// Persistence of Vision Ray Tracer Include File // File: platonic.inc // Vers: 0.9 // Desc: This file provides untextured versions of the five Platonic solids, // in three versions: // X_Faces [also just "X" with no suffix] // An object, centered at the origin, circumscribed by a unit // sphere. // X_Edges(R) // A macro, where R is the radius of the cylinders denoting the // edges of the solid. // X_Vertices(R) // A macro, where R is the radius of the spheres placed at each // vertex of the solid. // Where "X" is: // Tetrahedron // Cube // Octahedron // Dodecahedron // Icosahedron // As a side effect, the coordinates _X are provided for each // object (starting at _A and continuing through the Latin alphabet, // "Cube_A", "Tetra_D", "Dodeca_T", etc.), which are the coordinates // of each vertex of the object. The suffix "-hedron" is eliminated // when the "Shape_X" coordinates are named. // In addition, the object Platonic_Bounding_Sphere and the macro // Platonic_Center_Sphere(R) are provided. // Date: Jan 13 2002 // Auth: Deaken Wylie // // Bugs: The math is slightly off on both the Dodecahedron and the // Icosahedron. I am still tracking this down, I'm afraid. #macro Square ( P1, P2, P3, P4 ) object { mesh { triangle { P1, P2, P3 } triangle { P1, P3, P4 } } } #end #macro Pentagon ( P1, P2, P3, P4, P5 ) object { mesh { triangle { P1, P3, P4 } triangle { P1, P2, P3 } triangle { P1, P4, P5 } } } #end #declare Tetra_A = <0.0, 1.0, 0.0>; #declare Tetra_B = <2*sqrt(2)/3, -1/3, 0.0>; #declare Tetra_C = < -sqrt(2)/3, -1/3, sqrt(6)/3>; #declare Tetra_D = < -sqrt(2)/3, -1/3, -sqrt(6)/3>; #declare Tetrahedron = object { mesh { triangle {Tetra_A, Tetra_B, Tetra_C} triangle {Tetra_A, Tetra_B, Tetra_D} triangle {Tetra_A, Tetra_C, Tetra_D} triangle {Tetra_B, Tetra_C, Tetra_D} } } #declare Tetrahedron_Faces = object { Tetrahedron } #macro Tetrahedron_Vertices ( R ) object { union { sphere { Tetra_A, R } sphere { Tetra_B, R } sphere { Tetra_C, R } sphere { Tetra_D, R } } } #end #macro Tetrahedron_Edges ( R ) object { union { cylinder { Tetra_A, Tetra_B, R } cylinder { Tetra_A, Tetra_C, R } cylinder { Tetra_A, Tetra_D, R } cylinder { Tetra_B, Tetra_C, R } cylinder { Tetra_B, Tetra_D, R } cylinder { Tetra_C, Tetra_D, R } } } #end #declare Platonic_C = 1/sqrt(3); #declare Cube_A = < Platonic_C, Platonic_C, Platonic_C>; #declare Cube_B = < Platonic_C, Platonic_C, -Platonic_C>; #declare Cube_C = < Platonic_C, -Platonic_C, Platonic_C>; #declare Cube_D = < Platonic_C, -Platonic_C, -Platonic_C>; #declare Cube_E = <-Platonic_C, Platonic_C, Platonic_C>; #declare Cube_F = <-Platonic_C, Platonic_C, -Platonic_C>; #declare Cube_G = <-Platonic_C, -Platonic_C, Platonic_C>; #declare Cube_H = <-Platonic_C, -Platonic_C, -Platonic_C>; #declare Cube = object { union { Square(Cube_A,Cube_B,Cube_D,Cube_C) Square(Cube_A,Cube_B,Cube_F,Cube_E) Square(Cube_A,Cube_C,Cube_G,Cube_E) Square(Cube_B,Cube_D,Cube_H,Cube_F) Square(Cube_C,Cube_D,Cube_H,Cube_G) Square(Cube_E,Cube_F,Cube_H,Cube_G) } } #declare Cube_Faces = object { Cube } #macro Cube_Vertices ( R ) object { union { sphere { Cube_A, R } sphere { Cube_B, R } sphere { Cube_C, R } sphere { Cube_D, R } sphere { Cube_E, R } sphere { Cube_F, R } sphere { Cube_G, R } sphere { Cube_H, R } } } #end #macro Cube_Edges ( R ) object { union { cylinder { Cube_A, Cube_B, R } cylinder { Cube_A, Cube_C, R } cylinder { Cube_A, Cube_E, R } cylinder { Cube_B, Cube_D, R } cylinder { Cube_B, Cube_F, R } cylinder { Cube_C, Cube_D, R } cylinder { Cube_C, Cube_G, R } cylinder { Cube_D, Cube_H, R } cylinder { Cube_E, Cube_F, R } cylinder { Cube_E, Cube_G, R } cylinder { Cube_F, Cube_H, R } cylinder { Cube_G, Cube_H, R } } } #end #declare Octa_A = < 1.0, 0.0, 0.0>; #declare Octa_B = <-1.0, 0.0, 0.0>; #declare Octa_C = < 0.0, 1.0, 0.0>; #declare Octa_D = < 0.0, -1.0, 0.0>; #declare Octa_E = < 0.0, 0.0, 1.0>; #declare Octa_F = < 0.0, 0.0, -1.0>; #declare Octahedron = object { mesh { triangle {Octa_A, Octa_C, Octa_E} triangle {Octa_A, Octa_C, Octa_F} triangle {Octa_A, Octa_D, Octa_E} triangle {Octa_A, Octa_D, Octa_F} triangle {Octa_B, Octa_C, Octa_E} triangle {Octa_B, Octa_C, Octa_F} triangle {Octa_B, Octa_D, Octa_E} triangle {Octa_B, Octa_D, Octa_F} } } #declare Octahedron_Faces = object { Octahedron } #macro Octahedron_Vertices ( R ) object { union { sphere { Octa_A, R } sphere { Octa_B, R } sphere { Octa_C, R } sphere { Octa_D, R } sphere { Octa_E, R } sphere { Octa_F, R } } } #end #macro Octahedron_Edges ( R ) object { union { cylinder { Octa_A, Octa_C, R } cylinder { Octa_A, Octa_D, R } cylinder { Octa_A, Octa_E, R } cylinder { Octa_A, Octa_F, R } cylinder { Octa_B, Octa_C, R } cylinder { Octa_B, Octa_D, R } cylinder { Octa_B, Octa_E, R } cylinder { Octa_B, Octa_F, R } cylinder { Octa_C, Octa_E, R } cylinder { Octa_C, Octa_F, R } cylinder { Octa_D, Octa_E, R } cylinder { Octa_D, Octa_F, R } } } #end #declare Platonic_P = (sqrt(5)+1)/2; #declare Dodeca_A = < 0.0, Platonic_P, 1/Platonic_P>/2; #declare Dodeca_B = < 0.0, Platonic_P, -1/Platonic_P>/2; #declare Dodeca_C = < 0.0, -Platonic_P, 1/Platonic_P>/2; #declare Dodeca_D = < 0.0, -Platonic_P, -1/Platonic_P>/2; #declare Dodeca_E = < 1/Platonic_P, 0.0, Platonic_P>/2; #declare Dodeca_F = < 1/Platonic_P, 0.0, -Platonic_P>/2; #declare Dodeca_G = <-1/Platonic_P, 0.0, Platonic_P>/2; #declare Dodeca_H = <-1/Platonic_P, 0.0, -Platonic_P>/2; #declare Dodeca_I = < Platonic_P, 1/Platonic_P, 0.0>/2; #declare Dodeca_J = < Platonic_P, -1/Platonic_P, 0.0>/2; #declare Dodeca_K = < -Platonic_P, 1/Platonic_P, 0.0>/2; #declare Dodeca_L = < -Platonic_P, -1/Platonic_P, 0.0>/2; #declare Dodeca_M = < 1.0, 1.0, 1.0>/2; #declare Dodeca_N = < 1.0, 1.0, -1.0>/2; #declare Dodeca_O = < 1.0, -1.0, 1.0>/2; #declare Dodeca_P = < 1.0, -1.0, -1.0>/2; #declare Dodeca_Q = <-1.0, 1.0, 1.0>/2; #declare Dodeca_R = <-1.0, 1.0, -1.0>/2; #declare Dodeca_S = <-1.0, -1.0, 1.0>/2; #declare Dodeca_T = <-1.0, -1.0, -1.0>/2; #declare Dodecahedron = object { union { Pentagon(Dodeca_A,Dodeca_B,Dodeca_R,Dodeca_K,Dodeca_Q) Pentagon(Dodeca_A,Dodeca_M,Dodeca_E,Dodeca_G,Dodeca_Q) Pentagon(Dodeca_A,Dodeca_M,Dodeca_I,Dodeca_N,Dodeca_B) Pentagon(Dodeca_B,Dodeca_N,Dodeca_F,Dodeca_H,Dodeca_R) Pentagon(Dodeca_C,Dodeca_D,Dodeca_T,Dodeca_L,Dodeca_S) Pentagon(Dodeca_C,Dodeca_O,Dodeca_J,Dodeca_P,Dodeca_D) Pentagon(Dodeca_C,Dodeca_S,Dodeca_G,Dodeca_E,Dodeca_O) Pentagon(Dodeca_D,Dodeca_T,Dodeca_H,Dodeca_F,Dodeca_P) Pentagon(Dodeca_E,Dodeca_M,Dodeca_I,Dodeca_J,Dodeca_O) Pentagon(Dodeca_F,Dodeca_N,Dodeca_I,Dodeca_J,Dodeca_P) Pentagon(Dodeca_G,Dodeca_S,Dodeca_L,Dodeca_K,Dodeca_Q) Pentagon(Dodeca_H,Dodeca_T,Dodeca_L,Dodeca_K,Dodeca_R) } } #declare Dodecahedron_Faces = object { Dodecahedron } #macro Dodecahedron_Vertices ( R ) object { union { sphere { Dodeca_A, R } sphere { Dodeca_B, R } sphere { Dodeca_C, R } sphere { Dodeca_D, R } sphere { Dodeca_E, R } sphere { Dodeca_F, R } sphere { Dodeca_G, R } sphere { Dodeca_H, R } sphere { Dodeca_I, R } sphere { Dodeca_J, R } sphere { Dodeca_K, R } sphere { Dodeca_L, R } sphere { Dodeca_M, R } sphere { Dodeca_N, R } sphere { Dodeca_O, R } sphere { Dodeca_P, R } sphere { Dodeca_Q, R } sphere { Dodeca_R, R } sphere { Dodeca_S, R } sphere { Dodeca_T, R } } } #end #macro Dodecahedron_Edges ( R ) object { union { cylinder { Dodeca_A, Dodeca_B, R } cylinder { Dodeca_A, Dodeca_M, R } cylinder { Dodeca_A, Dodeca_Q, R } cylinder { Dodeca_B, Dodeca_N, R } cylinder { Dodeca_B, Dodeca_R, R } cylinder { Dodeca_C, Dodeca_D, R } cylinder { Dodeca_C, Dodeca_O, R } cylinder { Dodeca_C, Dodeca_S, R } cylinder { Dodeca_D, Dodeca_P, R } cylinder { Dodeca_D, Dodeca_T, R } cylinder { Dodeca_E, Dodeca_G, R } cylinder { Dodeca_E, Dodeca_M, R } cylinder { Dodeca_E, Dodeca_O, R } cylinder { Dodeca_F, Dodeca_H, R } cylinder { Dodeca_F, Dodeca_N, R } cylinder { Dodeca_F, Dodeca_P, R } cylinder { Dodeca_G, Dodeca_Q, R } cylinder { Dodeca_G, Dodeca_S, R } cylinder { Dodeca_H, Dodeca_R, R } cylinder { Dodeca_H, Dodeca_T, R } cylinder { Dodeca_I, Dodeca_J, R } cylinder { Dodeca_I, Dodeca_M, R } cylinder { Dodeca_I, Dodeca_N, R } cylinder { Dodeca_J, Dodeca_O, R } cylinder { Dodeca_J, Dodeca_P, R } cylinder { Dodeca_K, Dodeca_L, R } cylinder { Dodeca_K, Dodeca_Q, R } cylinder { Dodeca_K, Dodeca_R, R } cylinder { Dodeca_L, Dodeca_S, R } cylinder { Dodeca_L, Dodeca_T, R } } } #end #declare Icosa_A = < 0.0, 1.0, Platonic_P>/2; #declare Icosa_B = < 0.0, 1.0, -Platonic_P>/2; #declare Icosa_C = < 0.0, -1.0, Platonic_P>/2; #declare Icosa_D = < 0.0, -1.0, -Platonic_P>/2; #declare Icosa_E = < 1.0, Platonic_P, 0.0>/2; #declare Icosa_F = < 1.0, -Platonic_P, 0.0>/2; #declare Icosa_G = <-1.0, Platonic_P, 0.0>/2; #declare Icosa_H = <-1.0, -Platonic_P, 0.0>/2; #declare Icosa_I = < Platonic_P, 0.0, 1.0>/2; #declare Icosa_J = < Platonic_P, 0.0, -1.0>/2; #declare Icosa_K = <-Platonic_P, 0.0, 1.0>/2; #declare Icosa_L = <-Platonic_P, 0.0, -1.0>/2; #declare Icosahedron = object { mesh { triangle{Icosa_A,Icosa_C,Icosa_I} triangle{Icosa_A,Icosa_C,Icosa_K} triangle{Icosa_A,Icosa_E,Icosa_G} triangle{Icosa_A,Icosa_E,Icosa_I} triangle{Icosa_A,Icosa_G,Icosa_K} triangle{Icosa_B,Icosa_D,Icosa_J} triangle{Icosa_B,Icosa_D,Icosa_L} triangle{Icosa_B,Icosa_E,Icosa_G} triangle{Icosa_B,Icosa_E,Icosa_J} triangle{Icosa_B,Icosa_G,Icosa_L} triangle{Icosa_C,Icosa_F,Icosa_H} triangle{Icosa_C,Icosa_F,Icosa_I} triangle{Icosa_C,Icosa_H,Icosa_K} triangle{Icosa_D,Icosa_F,Icosa_H} triangle{Icosa_D,Icosa_F,Icosa_J} triangle{Icosa_D,Icosa_H,Icosa_L} triangle{Icosa_E,Icosa_I,Icosa_J} triangle{Icosa_F,Icosa_I,Icosa_J} triangle{Icosa_G,Icosa_K,Icosa_L} triangle{Icosa_H,Icosa_K,Icosa_L} } } #declare Icosahedron_Faces = object { Icosahedron } #macro Icosahedron_Vertices ( R ) object { union { sphere { Icosa_A, R } sphere { Icosa_B, R } sphere { Icosa_C, R } sphere { Icosa_D, R } sphere { Icosa_E, R } sphere { Icosa_F, R } sphere { Icosa_G, R } sphere { Icosa_H, R } sphere { Icosa_I, R } sphere { Icosa_J, R } sphere { Icosa_K, R } sphere { Icosa_L, R } } } #end #macro Icosahedron_Edges ( R ) object { union { cylinder { Icosa_A, Icosa_C, R } cylinder { Icosa_A, Icosa_E, R } cylinder { Icosa_A, Icosa_G, R } cylinder { Icosa_A, Icosa_I, R } cylinder { Icosa_A, Icosa_K, R } cylinder { Icosa_B, Icosa_D, R } cylinder { Icosa_B, Icosa_E, R } cylinder { Icosa_B, Icosa_G, R } cylinder { Icosa_B, Icosa_J, R } cylinder { Icosa_B, Icosa_L, R } cylinder { Icosa_C, Icosa_F, R } cylinder { Icosa_C, Icosa_H, R } cylinder { Icosa_C, Icosa_I, R } cylinder { Icosa_C, Icosa_K, R } cylinder { Icosa_D, Icosa_F, R } cylinder { Icosa_D, Icosa_H, R } cylinder { Icosa_D, Icosa_J, R } cylinder { Icosa_D, Icosa_L, R } cylinder { Icosa_E, Icosa_G, R } cylinder { Icosa_E, Icosa_I, R } cylinder { Icosa_E, Icosa_J, R } cylinder { Icosa_F, Icosa_H, R } cylinder { Icosa_F, Icosa_I, R } cylinder { Icosa_F, Icosa_J, R } cylinder { Icosa_G, Icosa_K, R } cylinder { Icosa_G, Icosa_L, R } cylinder { Icosa_H, Icosa_K, R } cylinder { Icosa_H, Icosa_L, R } cylinder { Icosa_I, Icosa_J, R } cylinder { Icosa_K, Icosa_L, R } } } #end #declare Platonic_Bounding_Sphere = sphere { <0, 0, 0>, 1.0 } #macro Platonic_Center_Sphere ( R ) object { sphere { <0, 0, 0>, R } } #end