www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/10/06:44:13

Date: Tue, 10 Sep 1996 13:22:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Toby Ounsted <Toby AT viglen DOT co DOT uk>
Cc: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: Re: Rotating a point (x,y).
In-Reply-To: <96Sep10.100028bst.26499@spy.viglen.co.uk>
Message-Id: <Pine.SUN.3.91.960910131902.10696C-100000@is>
Mime-Version: 1.0

On Tue, 10 Sep 1996, Toby Ounsted wrote:

>      Not wishing to go too far off topic, but does anyone have any C code 
> (and/or formulae) for rotating a point (x,y) around the origin(0,0) by a 
> fixed number of degrees?? I'm sure I did this in Maths at school, but it was 
> a _LONG_ time ago...

	x' = x * cos(A) - y * sin(A)
	y' = y * cos(A) + x * sin(A)

where A is the rotation angle measured counter-clockwise from the old 
position to the new.  Remember to convert the angles into radians before 
feeding them to `sin' and `cos'.

- Raw text -


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