Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!usc!ucsd!ucbvax!hplabs!otter.hpl.hp.com!otter!mjw From: mjw@otter.hpl.hp.com (Mike Wray) Newsgroups: comp.graphics Subject: Re: Ellipse formulae wanted Message-ID: <1710005@otter.hpl.hp.com> Date: 28 Nov 90 16:43:25 GMT References: <1990Nov20.181757.456@vixvax.mgi.com> Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 74 ======================================================================== 1) To find the centre,c, of a circle of radius 1, given distinct points x and y lying on the circle. We have 2 2 |x - c| = |y - c| = 1 The centre c lies on the perpendicular bisector of the line through x and y. The equation of this line is x + y w = -------- - l u 2 Where w lies on the line, l is real number, and u is a unit vector perpendicular to x-y. [ Given x =(r,s), a perpendicular vector is (-s, r), and we can divide by the length of x to obtain a unit vector.] [ In the following x.y is dot product, i.e. (a,b).(u,v) = au+bv. ] From 2 |x - w| = 1 and 2 2 2 2 |x - w| = |(y-x)/2| + l(y-x)/2 . u + l |u| 2 2 = |x-y| /4 + l so 2 l = sqrt( 1 - |x-y| ) ----- 4 We thus have c = x+y - l u --- 2 With l as above. We have 2 solutions depending on the sign of sqrt we choose. ========================================================================= 2) To find the centre, c, of an ellipse of semi-major axis a, semi-minor axis b, given distinct points x and y on the ellipse. -1 Let S = ( a 0 ) and T = S ( 0 b ) The x and y lie on the ellipse if and only if u=Tx and v=Ty lie on the circle radius 1 centre z = Tc. Solve for z from u and v using problem 1), then c = Sz. ========================================================================= 3) Solving for the centre of an ellipse rotated by angle t is similar to 2): let -1 S = (cos t -sin t)(a 0) and T = S (sin t con t)(0 b) and solve as before. ========================================================================= Mike