First, we create the diamond with the faces. We create a Separator called
FaceDiamond which contains a Coordinate3 node and an IndexedFaceSet node. The Coordinate3
node is used to specify points in the scene. Consider each point in the Coordinate3 node
to have an index, starting at 0. We specify 6 points in space; the indices range from 0-5
The second node in the separator, the IndexedFaceSet node, specifies which of the coordinates to connect. The first points connected are 0, 1, and 2. The -1 indicates that the current face has ended and that the next one begins.
Now look at the LineDiamond Separator. Since we gave the Coordinate3 node
a name, DiamondCoords, we may use those coordinates again with the USE DiamondCoords
line. With the IndexedLineSet node, the points are connected with lines between the
vertices. While using the same coordinates, we use a Translation node to push the line
diamond up 75 units from its initial location.
.... DEF FaceDiamond Separator { DEF DiamondCoords Coordinate3 { point [ 0 75 25, #0 12.5 62.5 12.5, #1 12.5 62.5 37.5, #2 -12.5 62.5 37.5, #3 -12.5 62.5 12.5, #4 0 50 25, #5 ] } #DiamondCoords Coordinate3 IndexedFaceSet { coordIndex [ 0, 1, 2, -1, 0, 1, 4, -1, 0, 4, 3, -1, 0, 3, 2, -1, 5, 1, 2, -1, 5, 1, 4, -1, 5, 4, 3, -1, 5, 3, 2, -1, ] } #IndexedFaceSet } #FaceDiamond Separator DEF LineDiamond Separator { Translation { translation 0 75 0 } #Translation USE DiamondCoords IndexedLineSet { coordIndex [ 0, 1, 2, 0, -1, # 0-1-2-0 haromszog 0, 4, 3, 0, -1, 5, 2, 3, 5, -1, 5, 1, 4, 5, -1, ] } #IndexedLineSet } #DiamondLine Separator } #Separator
+ Diamonds
Next
Table of contents