jdb@reef.cis.ufl.edu (Brian K. W. Hook) (03/18/91)
I am working on a Windows 3.0 version of XEYES and need a very fast and not necessarily accurate algorithm for determining the following: Given an ellipse and a point, determine where a line from the center of the ellipse to the point will intersect the ellipse. You are give: The center of the ellipse The width of ellipse The height of the ellipse The X and Y coordinate of the point I need efficiency mostly, since I will be running this on Windows (which is strapped for resources as is) and I am doing this calculation 10 times per second. Brian PS Please email replies if possible.
gwyn@smoke.brl.mil (Doug Gwyn) (03/19/91)
In article <27497@uflorida.cis.ufl.EDU> jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes: >I am working on a Windows 3.0 version of XEYES and need a very fast and not >necessarily accurate algorithm for determining the following: ... Why don't you instead adapt my public-domain code for the Blit (DMD/MTG) "eyes"? It works very nicely, better than "xeyes", and the code is much simpler due to the Blit being cleaner than X11. Send me email to request a copy of the "eyes" source.
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (03/20/91)
In article <27497@uflorida.cis.ufl.EDU> jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes: > Given an ellipse and a point, determine where a line from the center of the > ellipse to the point will intersect the ellipse. > You are give: > The center of the ellipse > The width of ellipse > The height of the ellipse > The X and Y coordinate of the point What is the ellipse's orientation? If it is not rotated, then a point (x,y) is on the edge of the ellipse only if ((x - c)/w)^2 + ((y - d)/h)^2 = 1, where (c,d) is the center and (h,w) are half of height and width. So to scale a point (x,y) to the edge you should subtract (c,d), then divide by sqrt((x/w)^2 + (y/h)^2), then add (c,d) back in. Now what does this have to do with the C language? ---Dan