triangle [surface-desc] x1 y1 z1 x2 y2 z2 x3 y3 z3
Create a (flat) triangle. The order of the vertices is important when using triangle to construct a solid object (that can be used for CSG).
In this example a "curving" form is created using flat triangles. The shape has five planes
(each made up of three triangles), giving a total of fifteen triangles.
Figure 2-21
/*
tri-flat.ray
curving mesh (flat triangles)
sp mon 24 feb 92
*/
eyep 14 14 24
lookp 2.5 1.5 2.75
screen 300 200
background .9 .9 .9
light 1 point -10 10 10
surface green ambient 0 .2 0 diffuse 0 .6 0
specular .3 .3 .3 reflect .4
name mesh list
triangle -1.0 -2.0 2.7
3.0 0.0 2.8
-1.0 2.0 2.7
triangle 3.0 0.0 2.8
-1.0 -2.0 2.7
3.0 -4.0 2.8
triangle 3.0 -4.0 2.8
-1.0 -2.0 2.7
-1.0 -6.0 2.7
triangle 3.0 -4.0 2.8
6.0 -6.0 2.0
6.0 -2.0 2.0
triangle 3.0 -4.0 2.8
6.0 -2.0 2.0
3.0 0.0 2.8
triangle 6.0 -2.0 2.0
6.0 2.0 2.0
3.0 0.0 2.8
triangle 6.0 2.0 2.0
6.0 -2.0 2.0
9.0 0.0 0.0
triangle 6.0 -2.0 2.0
9.0 -4.0 0.0
9.0 0.0 0.0
triangle 6.0 -2.0 2.0
6.0 -6.0 2.0
9.0 -4.0 0.0
triangle -1.0 -6.0 2.7
-1.0 -2.0 2.7
-5.0 -4.0 1.5
triangle -1.0 -2.0 2.7
-5.0 0.0 1.5
-5.0 -4.0 1.5
triangle -1.0 -2.0 2.7
-1.0 2.0 2.7
-5.0 0.0 1.5
triangle -5.0 0.0 1.5
-8.0 2.0 0.0
-8.0 -2.0 0.0
triangle -5.0 0.0 1.5
-8.0 -2.0 0.0
-5.0 -4.0 1.5
triangle -5.0 -4.0 1.5
-8.0 -2.0 0.0
-8.0 -6.0 0.0
end
object green mesh
Go to next primitive: triangle.
Return to Contents.
THE END - Notes on Rayshade - 2 - Rayshade Primitives - Triangle