HP Forums
FILLPOLY_P() Question. - 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: FILLPOLY_P() Question. (/thread-17186.html)



FILLPOLY_P() Question. - matalog - 06-30-2021 11:11 AM

I have been trying to use FILLPOLY_P() to fill circles and other more complex shapes, and find that when I plot the points too close together, which obviously better defines the outer shape, then the fill is compromised, and can sometimes result in blank parts not actually filled, or lines outside of the shape, where a corner turns towards the centre.

Does anyone know what algorithm it follows, or how I might avoid badly filled shapes? I am being careful to ensure that the full outline is drawn, with no spaces, but you can take a look at the result and see what I mean.

Code:
EXPORT sham2()
BEGIN
    LOCAL COORD:={};
  LOCAL A,R;
A:=1;
RECT_P(0,0,320,240,0);
      FOR T FROM 0 TO 2*π STEP 0.009 DO
          COORD(A,1):=160+70*COS(T);
          COORD(A,2):=120-70*SIN(T);
//PIXON_P(160+R*COS(T),120+R*SIN(T));
  A:=A+1
      END;
       FILLPOLY_P(G0,COORD,RGB(0,255,0,0),0);
REPEAT 
WAIT (-1);
  IF ISKEYDOWN(4) THEN BREAK(3); END;
 
UNTIL 0;
END;

You can see the example of the code above in the attached screen shot.