Ok.
float magnitude(int x1,int y1,int x2,int y2)
{
return(sqrt(pow(x2-x1,2) + pow(y2-y1,2)));
}
struct floatpoint
{
float X;
float Y;
};
byte Data[];
byte Line;
byte offset;
//LocationType poly[] = {{10,10},{
//LocationType sp[]={{10,10},{10,30},{5,27},{10,30},{15,27},{10,30},{10,25},{5,22},{10,25},{15,22},{10,25},{10,20},{5,17},{10,20},{15,17},{10,20}};
floatpoint spf[];
byte __ips_masks[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
byte isPixelSet(byte Xx, byte Yy)
{
Line = (63-Yy & 0xF8) / 8;
offset = Yy % 8;
GetDisplayNormal(Xx, Line, 1, Data);
return Data[0] & __ips_masks[offset];
}
task main()
{
float x,y;
int xc,yc;
// int dis;
//x=0;
//y=50;
xc= 40;
yc=40;
float deg;
int d;
//float dis[];
float c,s;
int xt1,yt1,xt2,yt2;
int l;
//int arrs = ArrayLen(sp);
int bul = 0;
// ArrayInit(dis,0,arrs);
// ArrayInit(spf,0,arrs);
//RectOut(50,50,3,3);
GraphicOut(50,40,"squirt.ric");
for(int c=0; c < 100; c++)
{
for(int d=0; d < 64; d++)
{
if(isPixelSet(c,d))
{
l++;
}
}
}
ArrayInit(spf,0,l);
for(int c=0; c < 100; c++)
{
for(int d=0; d < 64; d++)
{
if(isPixelSet(c,d))
{
spf[bul].X = c;
spf[bul].Y = d;
bul++;
}
}
}
PlayToneEx(600,30,1,0);
/* for(int c=0; c < l; c++)
{
// dis[c] = magnitude(xc,yc,sp[c].X,sp[c].Y);
//sp[c].X += 30;
//sp[c].Y += 30;
if(
spf[c].X = sp[c].X;
spf[c].Y = sp[c].Y;
}*/
while(1)
{
// x=x*(cosd(30))-y*(sind(30));
//y=x*(sind(30))+y*(cosd(30));
// x = cosd(deg--)*magnitude(0,0,x,y);
// y = sind(deg)*magnitude(0,0,x,y);
// x -= xc;
//y -= yc;
c = cosd(d);
s = sind(d);
for(int c=0; c < l; c++)
{
// deg = atan2d((sp[c].Y-yc),(sp[c].X-xc));
// xt1 = ((spf[c].X - xc) * c);
//yt1 = ((spf[c].Y - yc) * s);
//xt2 = ((spf[c].X - xc) * s);
//yt2 = ((spf[c].Y - yc) * c);
//x = (xt1 - yt1) + xc;
//y = (xt2 + yt2) + yc;
// x = sqrt(pow((spf[c].X - xc),2) + pow((spf[c].Y - yc),2))*cosd(atand(spf[c].X - xc)/(spf[c].Y - yc)+ 5)+ xc;
// y = sqrt(pow((spf[c].X - xc),2) + pow((spf[c].Y - yc),2))*sind(atand(spf[c].X - xc)/(spf[c].Y - yc)+ 5)+ yc;
//y = dis[c]*sind(deg + 3)+yc;
x = ((spf[c].X-xc)*c) - ((spf[c].Y-yc)*s) + xc;
y = ((spf[c].Y-yc)*c) + ((spf[c].X-xc)*s) + yc;
spf[c].X = x;
spf[c].Y = y;
//sp[c].X=spf[c].X;
//sp[c].Y=spf[c].Y;
}
if(ButtonPressed(BTNRIGHT,0))
d = -5;
else
d = 0;
// sp[0].X=1;
//CircleOut(x,y,10);
// PolyOut(sp);
SetDisplayFlags( DISPLAY_REFRESH_DISABLED);
ClearScreen();
for(int c=0; c < l; c++)
{
PointOut(spf[c].X,spf[c].Y);
}
//PolyOut(sp);
SetDisplayFlags( DISPLAY_ON | DISPLAY_REFRESH);
Wait(17);
}
}