Graphics Programs Reference
In-Depth Information
91 sine values, from sin 0 =0tosin90 = 1, multiplies each by 2 14 =16 , 384, rounds
them, and stores them in a table as 16-bit integers ranging from 0 to 16,384.
d2r=Pi/180;
Table[Round[N[16384*Sin[i*d2r]]], {i,0,90}]
θ
sin θ
θ
sin θ
θ
sin θ
θ
sin θ
θ
sin θ
0
0
1
286
2
572
3
857
4
1143
5
1428
6
1713
7
1997
8
2280
9
2563
10
2845
11
3126
12
3406
13
3686
14
3964
15
4240
16
4516
17
4790
18
5063
19
5334
20
5604
21
5872
22
6138
23
6402
24
6664
25
6924
26
7182
27
7438
28
7692
29
7943
30
8192
31
8438
32
8682
33
8923
34
9162
35
9397
36
9630
37
9860
38 10087
39 10311
40 10531
41 10749
42 10963
43 11174
44 11381
45 11585
46 11786
47 11982
48 12176
49 12365
50 12551
51 12733
52 12911
53 13085
54 13255
55 13421
56 13583
57 13741
58 13894
59 14044
60 14189
61 14330
62 14466
63 14598
64 14726
65 14849
66 14968
67 15082
68 15191
69 15296
70 15396
71 15491
72 15582
73 15668
74 15749
75 15826
76 15897
77 15964
78 16026
79 16083
80 16135
81 16182
82 16225
83 16262
84 16294
85 16322
86 16344
87 16362
88 16374
89 16382
90 16384
Table 1.10: Sine Values as 16-Bit Integers.
The 91 values are listed in Table 1.10, but notice that they are only approximations
of the true sine values. (Even floating-point sine values are, in general, just approxi-
mations, but normally better than our integers.) This means that the use of this table
for many successive rotations of a point may place it farther and farther away from its
true position. When we perform many successive rotations of an object that consists
of many points, placing points away from where they should be generally results in a
deformation of the object.
We assume that the points are represented by coordinates that are 16-bit integers.
Calculating the rotated coordinates ( x ,y )ofapoint( x, y ) can now be done, for
example, by
x =rshift( x
Table( θ ) , 14) ,
y =rshift( x × Table( θ ) , 14) + rshift( y × Table(90 − θ ) , 14) .
×
Table(90
θ ) , 14)
rshift( y
×
Notice how the required cosine values are obtained from the end of the table. This
method works because the table has 91 entries. Multiplying a 16-bit integer coordinate
Search WWH ::




Custom Search