HP Forums

Full Version: Colourful Polygon Explorer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Use the cursor to play with some polygons, feel free to improve this and play with it:

Code:
EXPORT pOLYcOL()
BEGIN
    LOCAL COORD:={};
    LOCAL COL:={};
  LOCAL J,K,S;

  S:=0;  
  COL(1):=RGB(255,0,0,0);
  COL(2):=RGB(255,255,0,0);
  COL(3):=RGB(0,255,0,0);
  COL(4):=RGB(0,255,255,0);
  COL(5):=RGB(0,0,255,0);
  COL(6):=RGB(255,0,255,0);
  COL(7):=RGB(0,0,0,0);
  J:=60;
  K:=0;
  L:=6;
   REPEAT

  J:=360/L;
RECT_P(0,0,320,240,0);
   FOR T FROM 0 TO 6 DO
      FOR A FROM 0 TO L DO
          COORD(A+1,1):=160-(120-16*T)*Cos(J*A+K);
          COORD(A+1,2):=120-(120-16*T)*Sin(J*A);
      END;
       FILLPOLY_P(G0,COORD,COL(T+1),0);
   END; 
 REPEAT

  IF ISKEYDOWN(7) THEN L:=L-1;S:=1; END;
  IF ISKEYDOWN(8) THEN L:=L+1;S:=1; END;
  IF ISKEYDOWN(2) THEN K:=K-1;S:=1; END;
  IF ISKEYDOWN(12) THEN K:=K+1;S:=1; END;
  IF L<3 THEN L:=3 END;
  IF ISKEYDOWN(4) THEN BREAK(3); END;
  UNTIL S=1;
  S:=0;
UNTIL 0;
END;
I was never able to get a square, just concentric circles.
(05-20-2021 01:52 PM)compsystems Wrote: [ -> ]I was never able to get a square, just concentric circles.

I think it may run too fast, if you push the left button, it will reduce the amount of sides down to a triangle.
Reference URL's