Post Reply 
Circle with interior arc segments
02-11-2015, 05:17 PM (This post was last modified: 02-11-2015 05:52 PM by Thomas_Sch.)
Post: #6
RE: Circle with interior arc segments
(02-11-2015 04:28 PM)DrD Wrote:  ...
Would you have any insight on how to constrain the segments to within the semi-circle, as a function of the 'a' angle in the loop? One way might be to test for the semi-circle radius (x,y) endpoint, but it seems like the arc segment length (w1,w2) should also be a trig function of the step angle, I just haven't quite figured out how that would work. ..
Hello Dale,

I thought about that, like I did the trial-and-error-steps before (with help of some plain old-style paper scribbles), but till now I'm missing the solution.

Looking for help & posible suggestions, I found this documents, maybe it's helpful:
http://www.ittc.ku.edu/~jstiles/723/hand...ackage.pdf (very long, and impressive),
http://whites.sdsmt.edu/classes/ee382/no...ture22.pdf, and http://www.siart.de/lehre/smishort.pdf (see pages 12..14, it's in german).

HTH Thomas

edit: I tested some triangle calculations. (again with paper).
The missing arc seems to be 2 * (pi/2) - a, see variable b.
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, b; 

 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);
    b:= 2*(pi/2 - a);
    
   //     G   x     y           r        w1      w2
    ARC_P(G0, x3  , y3,         r3,      3/2*pi-b, 3/2*pi, blue);  
 // 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 05:17 PM



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