hello to you all,
There is a small problem in rotating a point using fixedpoint. The rotation
wont work and I don't know why.
If you could help me I would appriciate it.
Here's the source I compile. It's not much but it's all there is ;)
Ok, see what you do with it. Have a nice day.
thanx Richard van Berkum
int sintab[360];
int costab[360];
int *sinptr;
int *cosptr;
void main(void)
{
int sin;
int cos;
int x1, x2, y1, y2;
int offset;
signed int x= -20, y = 20; // x and y coordinates
setvga(0x13);
sinptr = sintab; // ptr to tabel
cosptr = costab; // ptr to tabel
sin = *(sinptr+4); //angle of rotation
cos = *(cosptr+4); //angle of rotation
for(int i = 0; i < 360; i++)
{
x1 = (cos*x);
y1 = (sin*y);
x2 = x1 - y1; // cos*x - sin*y
x1 = (sin*x);
y1 = (cos*y);
y1 = x1 + y1; // sin*x + cos*y
x2 /= 16384;
y1 /= 16384;
x = x2; // new x and y
y = y1;
offset = y * 320;
offset += x;
offset +=center;
pokeb(0xa000, offset, 2);
}
getch();
setvga(3);
}
___ Blue Wave/386 v2.30 [NR]
--- GEcho1.11+/Intermail
---------------
* Origin: C-System, +31-70-3670598/3080494, Points & QWK, (2:281/400)
|