Drawing an Ellipse Using Conjugate DiametersDate: 12/07/2005 at 12:31:52 From: Jason Subject: Drawing an ellipse using Conjugate Diameters I am currently working to implement a CAD-type file format for a computer program at work. In order to fully implement this format, I will need to be able to draw an ellipse or elliptical arc with the information provided in the file. There are a few problems with this situation, but the most important is pulling enough information from the supplied data to fully map the ellipse in terms that the drawing library can use. Here is what I am given with the CAD file: CenterX - The center X of the ellipse CenterY - The center Y of the ellipse End1X - X for the starting point End1Y - Y for the starting point End2X - X for the end point (clockwise) End2Y - Y for the end point (clockwise) In order to draw an ellipse, I have to pass the bounding rectangle, starting angle and the angle between the starting and ending points. I can rotate drawings by specifying a transformation matrix, provided I can determine the angle that the ellipse should be rotated. With only a center point and the starting and ending points, how can I extract the information needed to draw this ellipse in terms of bounding rectangle and starting and ending angles? The whitepapers for this file format mention using Conjugate Diameters to draw the ellipse, but I'm not sure how to approach this method with only the three supplied points. Date: 12/07/2005 at 14:32:31 From: Doctor George Subject: Re: Drawing an ellipse using Conjugate Diameters Hi Jason, Thanks for writing to Doctor Math. There is quite a bit to this problem. First we need to clarify your inputs. Conjugate diameters are related to bounding parallelograms. Do you have a bounding rectangle, or a bounding parallelogram? - Doctor George, The Math Forum http://mathforum.org/dr.math/ Date: 12/08/2005 at 09:27:18 From: Jason Subject: Drawing an ellipse using Conjugate Diameters I have enough information to create a bounding rectangle. All of the information pulled from an Elliptical Arc Input block in this file is as follows: CenterX, CenterY, End1X, End1X, End2X, End2Y, StartVectorX, StartVectorY, EndVectorX, EndVectorY This creates the three points Center, End1, and End2; and StartVector and EndVector (with "End1" and "End2" being the major and minor axes). It's the End1 and End2 points that I use to determine if the ellipse should be rotated. I appreciate the time you've taken to respond to my question. If you can help me solve this delima, then you will have saved me a huge headache. I must say that the Dr. Math forums have saved me on more than one occasion, but this is by far the most complex problem I've had to deal with since finding the site. Again, thank you for your help. Date: 12/09/2005 at 07:35:20 From: Doctor George Subject: Re: Drawing an ellipse using Conjugate Diameters As Jason wrote to Dr. Math On 12/08/2005 at 09:27:18 (Eastern Time), >I have enough information to create a bounding rectangle. All of the >information pulled from an Elliptical Arc Input block in this file is >as follows: > >CenterX, CenterY, End1X, End1X, End2X, End2Y, StartVectorX, >StartVectorY, EndVectorX, EndVectorY > >This creates the three points Center, End1, End2, StartVector, and >EndVector (with "End1" and "End2" being the major and minor axes). >It's the End1 and End2 points that I use to determine if the ellipse >should be rotated. > >I appreciate the time you've taken to respond to my question. If you >can help me solve this delima, then you will have saved me a huge >headache. I must say that the Dr. Math forums have saved me on more >than one occasion, but this is by far the most complex problem I've >had to deal with since finding the site. Again, thank you for your help. Hi Jason, If you translate your data so that the center point moves to the origin the equation of the ellipse can be written as ax^2 + bxy + cy^2 = 1 If you substitute one endpoint from each chord into this equation you will get two linear equations with variables a, b, and c. Now we need a third equation. Implicitly differentiate the equation of the ellipse. 2ax + b(y + x(dy/dx)) + 2cy(dy/dx) = 0 If you substitute one endpoint from a chord and the slope of its tangent line (slope = dy/dx) into this equation you will get a third linear equation with variables a, b, and c. Now you just need to solve the linear system. As a side note, this method would also work with conjugate diameter pairs rather than a bounding reactangle. Does that make sense? Write again if you need more help. - Doctor George, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/