HP Forums
Colourful Polygon Explorer - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Colourful Polygon Explorer (/thread-16979.html)



Colourful Polygon Explorer - matalog - 05-20-2021 01:59 AM

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;



RE: Colourful Polygon Explorer - compsystems - 05-20-2021 01:52 PM

I was never able to get a square, just concentric circles.


RE: Colourful Polygon Explorer - matalog - 05-20-2021 03:24 PM

(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.