Java Reference

In-Depth Information

Figure 16. Third code segment of DiamondTriangleArray.java

78. private Geometry Tri7Geometry()

79. {

80.

//Triangle 7

81.

TriangleArray Tri7 = new TriangleArray (vertex, TriangleArray.COORDINATES);

82.

Tri7.setCoordinate(0, new Point3f(0.0f,-0.8f,0.0f));

83.

Tri7.setCoordinate(1, new Point3f(-0.5f,0.0f,0.0f));

84.

Tri7.setCoordinate(2, new Point3f(0.0f,0.0f,-0.5f));

85.

return Tri7;

86. }

87.

88. private Geometry Tri8Geometry()

89. {

90.

//Triangle 8

91.

TriangleArray Tri8 = new TriangleArray (vertex, TriangleArray.COORDINATES);

92.

Tri8.setCoordinate(0, new Point3f(0.0f,-0.8f,0.0f));

93.

Tri8.setCoordinate(1, new Point3f(0.0f,0.0f,0.5f));

94.

Tri8.setCoordinate(2, new Point3f(-0.5f,0.0f,0.0f));

95.

return Tri8;

96. }

97. }

98.

Figure 17. Basic shapes from using LineStripArray (top left), TriangleStripArray (top right)

and TriangleFanArray (bottom)

Vertex 2

Vertex 2

Vertex 4

Vertex 0

Vertex 4

Vertex 0

Vertex 1

Vertex 5

Vertex 1

Vertex 5

Vertex 3

Vertex 3

Vertex 4

Vertex 0

Vertex 3

Vertex 1

Vertex 2

Search WWH ::

Custom Search