ARC_P() Unexpected results.
03-21-2022, 10:57 PM
Post: #1
 matalog Senior Member Posts: 349 Joined: May 2021
ARC_P() Unexpected results.
The following is drawing arcs using ARC_P(), and it works as expected most of the way, but at these values it displays an unexpected ARC. The same code works fine on ARCs over radius 15, but at a radius of 10, it jumps to this semicircle. You can see it in the video.

https://www.dropbox.com/s/s2moqdne4nryjl...7.avi?dl=0

Code:
EXPORT ANIM() BEGIN DIMGROB_P(G1,320,240);  RECT_P();  LOCAL A:=60; LOCAL B:=2*π/A;   WHILE ISKEYDOWN(4)=0 DO LOCAL COL:=RANDINT(16777216); LOCAL SIZE:=RANDINT(100);     FOR N FROM 1 TO 60 DO RECT_P(G1);  ARC_P(G1,160,120,10,B*N/2-0.0001,2*π-B*N/2,{#000000h,COL});    BLIT_P(G0,0,0,320,240,G1,0,0,320,240);    TEXTOUT_P(STRING(B*N/2-0.0001)+"  ,  "+STRING(2*π-B*N/2),100,20);    WAIT(.1) END;     WAIT(.2) ; FOR N FROM 1 TO 60 DO RECT_P(G1);  ARC_P(G1,160,120,10,B*(30-N/2),2*π-B*(30-N/2),{#000000h,COL});    BLIT_P(G0,0,0,320,240,G1,0,0,320,240);    TEXTOUT_P(STRING(B*(30-N/2))+"  ,  "+STRING(2*π-B*(30-N/2)),100,20);     WAIT(.1) END;     WAIT(.2) END;    END;

Is it a problem with ARC_P? Or is it a problem with the approximation of the equations involving PI?

If I did not add the: -0.0001 in the first ARC_P() command, then the ARCs would also show similar problems with bigger radiuses.

waka waka.
03-23-2022, 10:48 AM
Post: #2
 tgallo Junior Member Posts: 47 Joined: Dec 2013
RE: ARC_P() Unexpected results.
Does it behave the same way in both the virtual and actual calculators?
03-23-2022, 11:21 AM
Post: #3
 matalog Senior Member Posts: 349 Joined: May 2021
RE: ARC_P() Unexpected results.
(03-23-2022 10:48 AM)tgallo Wrote:  Does it behave the same way in both the virtual and actual calculators?

Yeah, it happens on both.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)