-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsin.bas
More file actions
29 lines (20 loc) · 667 Bytes
/
sin.bas
File metadata and controls
29 lines (20 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
static shared as integer sintable(360-1)
static shared as integer costable(360-1)
sub BuildSinTable()
for c as integer = 0 to (360-1)
sintable(c) = int(sin(c*M_PI/180)*256)
costable(c) = int(cos(c*M_PI/180)*256)
next c
end sub
function CalcSin (angle as integer, factor as integer) as integer
dim ival as integer
if (angle > 359) then angle mod= 360
ival = (sintable(angle)*factor) shr 8
return ival
end function
function CalcCos (angle as integer, factor as integer) as integer
dim ival as integer
if (angle > 359) then angle = angle mod 360
ival = (costable(angle)*factor) shr 8
return ival
end function