rem C_2Pt.cdl rem Copy Right by International Technology Transfer Corp. rem revision 1.0-7/30/99 rem ******************************************************************** rem 1. Select 2 Points rem 2. Enter Radius rem 3. Draw Circle with the radius through 2 points rem ******************************************************************** clear defopt = 2 acc = 0.00001 rem If need higher accuracy, decrease acc value. rad = 1.0 :start getpos "Indicate First Point",defopt on (@key + 3) goto exit, start, defopt=@key wx1 = @xworld wy1 = @yworld wz1 = @zworld call xfwv, wx1, wy1, wz1, vx1, vy1, vz1 :second getpos "Indicate Second Point",defopt on (@key + 3) goto exit, start, second, defopt=@key wx2 = @xworld wy2 = @yworld wz2 = @zworld call xfwv, wx2, wy2, wz2, vx2, vy2, vz2 dist = sqrt( (vx1 - vx2)*(vx1 - vx2) + (vy1 - vy2)*(vy1 - vy2) ) if (distacc) goto two :one x = (vx1 + vx2) / 2 y = (vy1 + vy2) / 2 circle x, y, 0, rad redraw goto exit :two bunbo = (vy1-vy2)*(vy1-vy2) + (vx1-vx2)*(vx1-vx2) bunshi = rad*rad - (vx1-vx2)*(vx1-vx2)/4 - (vy1-vy2)*(vy1-vy2)/4 t = sqrt(bunshi / bunbo) x1 = (vx1+vx2)/2 + (vy1-vy2)*t y1 = (vy1+vy2)/2 - (vx1-vx2)*t x2 = (vx1+vx2)/2 - (vy1-vy2)*t y2 = (vy1+vy2)/2 + (vx1-vx2)*t circle x1, y1, 0, rad id1 = @lastid circle x2, y2, 0, rad id2 = @lastid getcur "Select Circle To Remain", 1, 0 if (@key>=0) goto select delent id1 delent id2 redraw goto exit :select dummyx = @xview dummyy = @yview r1 = sqrt((dummyx - x1)*(dummyx - x1) + (dummyy - y1)*(dummyy - y1)) r2 = sqrt((dummyx - x2)*(dummyx - x2) + (dummyy - y2)*(dummyy - y2)) if (r1-r2<=0) delent id2 if (r1-r2>0) delent id1 redraw :exit