www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/02/22:12:00

Date: Mon, 3 Feb 1997 06:40:32 +0000 ( )
From: Gurunandan R Bhat <grbhat AT unigoa DOT ernet DOT in>
To: Benjamin D Chambers <chambersb AT juno DOT com>, djgpp AT delorie DOT com
Subject: Re: ellipses at an angle (a correction)
In-Reply-To: <Pine.LNX.3.91.970202135028.202A-100000@aditya.unigoa.ernet.in>
Message-Id: <Pine.LNX.3.91.970203063741.1164A-100000@aditya.unigoa.ernet.in>
Mime-Version: 1.0


On Sun, 2 Feb 1997, Gurunandan R Bhat wrote:

> > On 1 Feb 1997 20:32:31 GMT hotpulp AT netidea DOT com writes:
> 
> > >I was wondering: how would I go about drawing an ellipse that has its
> > >major and minor axis at an angle? If you're having trouble 
> 
> 
> 
> its not very different from drawing a circle. for an ellipse, you do:
> 
> x = r1 * cos(t); y = r2 * sin (t)
> 
> if r1 is the same as r2 you get a circle. if you want a shifted ellipse, 
> by an angle a say, do this:
> 
> x = r1 * cos(t + a) ; y = r2 * sin(t + a)
> 
> for a whole set of values of t from 0 to 360. 

sorry the last point was a mistake.
the correct formula to turn an ellipse through angle a should read

x = r1 * cos(t) * cos(a) + r2 * sin(t) * sin(a)
y = -r1 * cos(t) * sin(a) + r2 * sin(t) * cos(a)

apologies for the slip.

gurunandan

- Raw text -


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