www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/06/00:45:51

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fwd: Re: ellipses at an angle
Date: Wed, 05 Feb 1997 21:30:03 GMT
Organization: Oxford University
Lines: 40
Message-ID: <32f8ec5f.17580554@news.ox.ac.uk>
References: <199702050239 DOT UAA05461 AT mail DOT texoma DOT net>
NNTP-Posting-Host: mc31.merton.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Wed, 5 Feb 1997 02:41:50 GMT, "Mark S. Teel" <mteel AT texoma DOT net>
wrote:

>If I say the area of a square is 1, is that the definition of the area of a
>square?  Or just the
>definition of 1 of infinitely many different squares?  He defined 1
>ellipse, not all ellipses (or
>is it ellipsi?).  And actually, even replacing it with a constant is not
>exact since there are
>no exact measures in our world... but don't get me started.

I'll try not to... I give below an answer to the question asked, but
first I'd like to correct your comment.

I believe what you are saying is that x^2/a^2 + y^2/b^2 = 1 is not
general, and that the 1 should be replaced by a constant, say n. Then
we would have x^2/a^2 + y^2/b^2 = n, which amounts to x^2/na^2 +
y^2/nb^2 = 1, and by replacing a with a.sqrt(n) and b with b.sqrt(n)
we get the equation above. x^2/a^2 + y^2/b^2 = 1 is as general as this
can get. It is also completely irrelevant for "ellipses at an angle"
as the subject says.

IMHO, the simplest way to draw an ellipse at an angle is to use the
polar representation, for which the origin is one of the foci, r is
the radius and T is the angle away from the other focus. Then

r=k/(1-e.cos(T))

where e is the eccentricity and k is the semi-latus rectum.

Given the coordinates of the two foci and the eccentricity, then, we
can draw the ellipse using polars. k can be calculated as

k = (2.(1-e^2).d)/e

We then cycle T (theta) from 0 to 2.pi, and add the (constant)
rotation angle before taking its cosine each time. This could be
optimised in many ways.

George Foot

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019