Post Reply 
Circle with interior arc segments
02-11-2015, 02:12 PM
Post: #2
RE: Circle with interior arc segments
I did a little playing around with your code.
Don't know, if this helps.
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;
 LOCAL x2, y2, r2, x3, y3, r3; 

 DIMGROB(G1,320,240);
 RECT_P(G0);
 LINE_P(G0,cx+r+1,cy,cx+r+1,0,blue);
 //     G   x   y  r  w1  w2
 ARC_P(G0, cx, cy, r, 0,  pi, red);  // Semicircle center: (156,109), radius: 105 pixels
 LINE_P(G0, cx-r, cy, cx+r, cy, red);  // 

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

    LINE_P(G0, cx, cy, x2, y2, grey);  //  pi/6 segment indicator
    x3:= cx+r;
    r3:= (r*SIN(a))/COS(a);
    y3:= cy-r3;
    LINE_P(G0, x2, y2, x3, y3, lgrey); 
      //     G   x     y           r        w1    w2
      ARC_P(G0, x3  , y3,         r3,      1/2*pi, 3/2*pi, blue);  
    //ARC_P(G0, cx+r, r*SIN(a)/2, r*COS(a), pi, 3*pi/2,blue);  //  This approach isn't working ...
    WAIT(-1); 
 END;

 // BLIT_P(G0,G1);
 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 - Thomas_Sch - 02-11-2015 02:12 PM



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