Looks like you're coding in VB? That means that the built in Sin and Cos functions take radians - a full circle is defined as 0 -> 2xPI.
Let's say you need a small amount of angles, say 1024 separate points round the circle, then you can define your arrays like this:
Dim Zin(1023) as single
Dim Coz(1023) as single
angle = 0.0f
for i as integer=0 to 1023
Zin(i) = Sin(angle)
Coz(i) = Cos(angle)
angle += 2.0f*3.1415f/1024.0f
next
Now you have the arrays, you need to be able to retrieve the angles. You have two choices, either you can work in '1024s' - rework your code to use 1024 degrees in a circle and use the arrays directly - or you can continue to work in radians and scale everything up.
You also need to make sure that once the number is scaled it will be in the range 0-1023.
function getSin(byval radians as single) as single
dim index as uinteger
index = radians * 1024.0f / (2.0f * 3.1415f) : rem you probably want to store this constant somewhere
index = index AND 1023
return Zin(index)
end function
Do the same for cos.
I chose 1024 because it is a power of 2, which means we can use the AND trick you asked about before to do the remainder. If you need more resolution, go to a bigger power of 2. If you used 65536 then you can even get the AND for 'free'
function getSin(byval radians as single) as single
dim index as ushort
index = radians * 65536.0f / (2.0f * 3.1415f) : rem you probably want to store this constant somewhere
return Zin(index)
end function
That's because 'ushort' can only fit in values of 0-65535
Jim