The code works by first creating an array of points along with an array of normals and then referencing them later to create the figure. The four calls to setCoordinate()
sets the position of the each vertex.
The int[] coords
store the positions of the vertices for the 4 triangles that make up the 4 faces (each triangle has three vertices for a total of 12 vertices). The first triangle is made up of the 0th , 1st, and 2nd vertices, the next triangle the 0th, 3rd and 1st vertex etc.
The code for the normals works in a similar fashion to that that of the vertices
1
solved How does this java3d code work? [closed]