Post Reply 
Circle with interior arc segments
02-12-2015, 02:16 PM
Post: #7
RE: Circle with interior arc segments
I have pruned the routine still more. The arc segments are now "close" to meeting the circumference, as needed. I wonder why they don't meet the circumference exactly? I could still use a little help here (thanks!):

Code:

EXPORT Circ()
BEGIN
 LOCAL a;
 LOCAL red:=  RGB(255,0,0);
 LOCAL blue:= RGB(0,0,255);
 LOCAL grey:= RGB(210,210,210);
 LOCAL lgrey:=RGB(210,210,00);
 LOCAL cx:=156, cy:=109, r:=105;      // Center: (156,109), Radius: 105 (pixels)
 LOCAL x2, y2, r2, x3, y3, r3; 

 RECT_P(G0);
 
 //         G   x      y    r  w1  w2    Color
 ARC_P(G0, cx,   cy,  r, 0,     2*pi, red);        // Semicircle center: (156,109), radius: 105 pixels
 LINE_P(G0, cx-r, cy, cx+r, cy, red);         // Equator

 FOR a  FROM -pi TO pi STEP pi/12 DO
  
    x2:= cx+r*COS(a);
    y2:= cy-r2; 

    r2:= r*SIN(a); 
    r3:= (r*SIN(a))/COS(a);
   
    x3:= cx+r;
    y3:= cy-r3;   
   
    if abs(a) < ROUND(pi/2,7)  then  
      //        G    x      y            r      w1                 w2            Color
     ARC_P(G0, x3  , y3,         r3,     2*a+1/2*pi,  -pi/2,           blue);    //  north semicircle  
     ARC_P(G0, x3  , y3,        -r3,     pi/2,              2*a-1/2*pi, blue);    //  south semicircle    
    end;

 END;

 DRAWMENU("");
 FREEZE;

END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Circle with interior arc segments - DrD - 02-10-2015, 06:45 PM
RE: Circle with interior arc segments - DrD - 02-12-2015 02:16 PM



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