Re: Coordinates for circle
- To: mathgroup at smc.vnet.net
- Subject: [mg14598] Re: [mg14579] Coordinates for circle
- From: Ranko Bojanic <bojanic at math.ohio-state.edu>
- Date: Mon, 2 Nov 1998 01:51:06 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Manuel wrote: >Hi Everyone >Maybe I can restate my problem of two days ago since I didn't get any >replies. Given two coordinates on a circle, for example,{0,0},{2,2}, >and the radius of the >circle, i.e.,2 Sqrt[5], to get a third set of coordinates. With this >third set, using the standard Quadric form for a circle,i.e., a x^2 + a >y^2 + b x + c y + d ==0, using the Conics from mathematica I can get >the equation of the circle- which is what I'm looking for. Thanks for >whatever. >Manuel The point closest to {(x1+x2)/2, (y1+y2)/2} is on the line bisecting the segment {x1,y1}, {x2,y2} at the distance r - Sqrt(r^2 - (1/4)d^2) where d is the length of the segment {x1,y1}, {x2,y2}. Using similarity of triangles and some trigonometry one finds In[1]:= circlePt[{x1_, y1_}, {x2_, y2_}, r_] := Module[{u, v, d = Sqrt[(x2 - x1)^2 + (y2 - y1)^2], h}, h = r - Sqrt[r^2 - (1/4) d^2]; u = (x1 + x2)/2 - h Abs[y2 - y1]/d; v = (y1 + y2)/2 + h (Abs[x2 - x1]/d)*Sign[(y2 - y1)/(x2 - x1)]; Return[{u, v}]] The points {1,1} and {0,4} are on the circle (x-2)^2 + (y-3)^2 = 5 If these points are given and the radius is Sqrt[5],the formula gives a point on that circle. In[2]:= pt=N[circlePt[{1,1},{0,4},Sqrt[5]],16] Out[3]= {-0.1213203435596428,2.292893218813453} In[3]:= (First[pt]-2)^2+(Last[pt]-3)^2 Out[4]= 5 A similar formula can be written for the other point where the circle intersect the bisector of the segment {x1,y1}, {x2,y2}. The center of the circle is clearly the midpoint of that segment. Ranko Bojanic bojanic at math.ohio-state.edu