Raytracing polyhedra



Convex polyhedra can easily be defined in POV by using the coordinates of the dual polyhedron to define a set of intersecting planes that define the original polyhedron. The idea is shown below in the illustration of the dodecahedron, which is defined by the vertices of the dual icosahedron.



Here is the POV code required to define the dodecahedron.




#declare phi = (1.0 + sqrt(5.0))/2.0; // golden mean
#declare rad = 1/sqrt(3); // normalization factor to make the radius = 1
#declare rad2 = 1.36/sqrt(2+phi); // scale so the icosahedron points just poke through
#declare dodecahedron =
intersection{
plane {< 1, 0, phi> rad2}
plane {< 1, 0, -phi> rad2}
plane {<-1, 0, phi> rad2}
plane {<-1, 0, -phi> rad2}
plane {<0, phi, 1> rad2}
plane {<0, -phi, 1> rad2}
plane {<0, phi, -1> rad2}
plane {<0, -phi, -1> rad2}
plane {< phi, 1, 0> rad2}
plane {< -phi, 1, 0> rad2}
plane {< phi, -1, 0> rad2}
plane {< -phi, -1, 0> rad2}
bounded_by{sphere{<0,0,0> 1}}
}





The center of each face of the dodecahedron is located at the vertex of the icosahedron, and the normal vector of the dodecahedron face is parallel to the vector defined by the icosahedron vertex and the center of the icosahedron (the origin). If you look at the clear yellow dodecahedron, you can see the points of the icosahedron poking through.

To define a general polyhedron, first find the coordinates of the dual polyhedron. Next, define the polyhedron as the intersection of planes with normal vectors described by the dual polyhedron vertices. However, if the vertex of the dual polyhedron is located a distance r from the origin, then the plane is located a distance 1/r from the origin. For example, here is the snub dodecahedron, which is defined by the vertices of the dual tricontahedron.



The snub dodecahedron has 60 vertices and is chiral. It provides the most efficient way of evenly spacing 60 points on a sphere with each point identical to every other point.
If you want to learn how to compute the vertices of a regular polyhedra, you may want to consult Zvi Har'El's paper Uniform Solution for Uniform Polyhedra which describes how to find the vertices of regular polyhedra. It also has programs that will find the vertices and plot simple computer images.




#declare RAD1=1/1.0096; // triangle
#declare RAD2=1/1.0586; // pentagon

#declare snubdodecahedron =
intersection{
plane{<-0.9820, 0.1298, -0.1952> RAD1}
plane{<-0.9796, -0.0959, 0.2249> RAD1}
plane{<-0.7658, 0.3127, -0.5789> RAD1}
plane{<-0.7481, 0.0528, -0.6759> RAD1}
plane{<-0.7342, -0.5109, 0.4683> RAD1}
plane{<-0.6928, -0.7328, 0.0482> RAD1}
plane{<-0.5620, 0.7496, 0.3762> RAD1}
plane{<-0.5193, -0.6644, 0.5551> RAD1}
plane{<-0.5174, 0.7112, -0.4958> RAD1}
plane{<-0.4863, -0.8008, -0.3762> RAD1}
plane{<-0.4222, -0.3127, 0.8621> RAD1}
plane{<-0.4222, -0.6783, -0.6173> RAD1}
plane{<-0.3588, -0.5624, 0.7578> RAD1}
plane{<-0.3171, 0.9567, -0.0584> RAD1}
plane{<-0.3128, 0.8679, 0.4101> RAD1}
plane{<-0.2655, 0.8272, -0.5144> RAD1}
plane{<-0.1867, 0.9745, 0.1864> RAD1}
plane{<-0.1624, 0.9535, -0.2893> RAD1}
plane{<-0.0940, -0.6461, 0.7700> RAD1}
plane{<-0.0865, 0.7227, -0.6996> RAD1}
plane{<-0.0321, -0.9445, -0.3552> RAD1}
plane{<-0.0049, -0.8272, 0.5789> RAD1}
plane{<0.0909, 0.9881, 0.1864> RAD1}
plane{<0.1854, 0.7506, -0.6493> RAD1}
plane{<0.1867, -0.9745, -0.1864> RAD1}
plane{<0.2267, 0.8943, 0.4101> RAD1}
plane{<0.2504, 0.3570, -0.9106> RAD1}
plane{<0.2655, -0.8272, 0.5144> RAD1}
plane{<0.3588, 0.5624, -0.7578> RAD1}
plane{<0.3891, 0.1166, -0.9243> RAD1}
plane{<0.4119, 0.5248, 0.7578> RAD1}
plane{<0.4434, -0.7455, -0.5167> RAD1}
plane{<0.4863, 0.8008, 0.3762> RAD1}
plane{<0.5816, 0.6107, 0.5551> RAD1}
plane{<0.5953, 0.8065, 0.1206> RAD1}
plane{<0.5998, 0.5156, -0.6275> RAD1}
plane{<0.6328, -0.1609, 0.7700> RAD1}
plane{<0.6537, 0.6597, -0.3960> RAD1}
plane{<0.6570, 0.1157, 0.7578> RAD1}
plane{<0.6621, -0.5624, 0.5144> RAD1}
plane{<0.7658, -0.3127, 0.5789> RAD1}
plane{<0.7934, 0.6216, 0.0584> RAD1}
plane{<0.8102, -0.4944, -0.3442> RAD1}
plane{<0.9154, -0.1792, 0.3864> RAD1}
plane{<0.9228, -0.2406, -0.3315> RAD1}
plane{<0.9528, -0.3030, 0.1403> RAD1}
plane{<0.9997, 0.1335, -0.0459> RAD1}
plane{<-0.9962, 0.1421, 0.0821> RAD1}
plane{<-0.9497, -0.3325, 0.0821> RAD1}
plane{<-0.9137, 0.3761, 0.2074> RAD1}
plane{<-0.8862, 0.3523, -0.3315> RAD1}
plane{<-0.8234, -0.5461, 0.2074> RAD1}
plane{<-0.8193, 0.3589, 0.4683> RAD1}
plane{<-0.6959, -0.6953, -0.2272> RAD1}
plane{<-0.6383, 0.5511, 0.5551> RAD1}
plane{<-0.5760, 0.4974, -0.6634> RAD1}
plane{<-0.5713, -0.4572, -0.6957> RAD1}
plane{<-0.5417, -0.0076, -0.8520> RAD1}
plane{<-0.4748, 0.2249, 0.8621> RAD1}
plane{<-0.4610, 0.4822, 0.7578> RAD1}
plane{<-0.4507, -0.2701, -0.8621> RAD1}
plane{<-0.2855, -0.9378, -0.2413> RAD1}
plane{<-0.2444, 0.1157, 0.9727> RAD1}
plane{<-0.2173, -0.1609, 0.9727> RAD1}
plane{<-0.1878, -0.3147, -0.9407> RAD1}
plane{<-0.0309, -0.0943, -1.0047> RAD1}
plane{<-0.0132, 0.2701, 0.9727> RAD1}
plane{<0.1396, -0.9961, 0.0866> RAD1}
plane{<0.2319, 0.1390, 0.9727> RAD1}
plane{<0.2444, -0.1157, -0.9727> RAD1}
plane{<0.3399, -0.9141, 0.2611> RAD1}
plane{<0.3471, -0.3562, -0.8786> RAD1}
plane{<0.4314, -0.6461, 0.6448> RAD1}
plane{<0.4314, -0.8721, -0.2696> RAD1}
plane{<0.4507, 0.2701, 0.8621> RAD1}
plane{<0.5888, -0.3508, -0.7414> RAD1}
plane{<0.6383, -0.5511, -0.5551> RAD1}
plane{<0.8234, 0.5461, -0.2074> RAD1}
plane{<0.9296, 0.2949, -0.2611> RAD1}
plane{<0.9962, -0.1421, -0.0821> RAD1}
plane{<-0.3210, -0.9793, 0.2420> RAD2}
plane{<-0.0349, 0.7158, 0.7792> RAD2}
plane{<0.0349, -0.7158, -0.7792> RAD2}
plane{<0.3210, 0.9793, -0.2420> RAD2}
plane{<-0.9296, -0.3067, -0.4031> RAD2}
plane{<-0.7528, 0.7409, -0.0711> RAD2}
plane{<0.7528, -0.7409, 0.0711> RAD2}
plane{<0.9296, 0.3067, 0.4031> RAD2}
plane{<-0.8078, -0.0791, 0.6796> RAD2}
plane{<-0.2319, 0.3474, -0.9727> RAD2}
plane{<0.2319, -0.3474, 0.9727> RAD2}
plane{<0.8078, 0.0791, -0.6796> RAD2}

bounded_by{sphere{<0,0,0> 1.1}}
}





Here is the snub dodecahedron rendered as a diamond. This takes a while to render.