Graphics Programs Reference
In-Depth Information
Figure 9.13 Sample screen from Exercise 9.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// data for creating a general shape
// consisting of points and lines
// define the coordinates of the 3D shape
points = new Array();
points[0]= { x: 0, y: 100, z: 0 }
points[1]= { x: 0, y:-100, z: 0 }
points[2]= { x:-100, y: 0, z: 0 }
points[3]= { x:-50, y: 0, z: -87 }
points[4]= { x: 50, y: 0, z: -87 }
points[5]= { x: 100, y: 0, z: 0 }
points[6]= { x: 50, y: 0, z: 87 }
points[7]= { x: -50, y: 0, z: 87 }
// define the start and end point of each line
lines = new Array();
lines[0]= { sp:0, ep:2 }
lines[1]= { sp:0, ep:3 }
lines[2]= { sp:0, ep:4 }
lines[3]= { sp:0, ep:5 }
Search WWH ::




Custom Search