Post Reply 
ARC_P() Unexpected results.
03-21-2022, 10:57 PM
Post: #1
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.

[Image: ARCw1.jpg?raw=1]

[Image: ARCw2.jpg?raw=1]

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.
Find all posts by this user
Quote this message in a reply
03-23-2022, 10:48 AM
Post: #2
RE: ARC_P() Unexpected results.
Does it behave the same way in both the virtual and actual calculators?
Find all posts by this user
Quote this message in a reply
03-23-2022, 11:21 AM
Post: #3
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




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