www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/10/07:00:27

Message-ID: <32354842.65FD@pobox.oleane.com>
Date: Tue, 10 Sep 1996 12:51:46 +0200
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: Toby Ounsted <Toby AT viglen DOT co DOT uk>
CC: djgpp AT delorie DOT com
Subject: Re: Rotating a point (x,y).
References: <96Sep10 DOT 100028bst DOT 26499 AT spy DOT viglen DOT co DOT uk>

Toby Ounsted wrote:
> 
> Hi all,
> 
>      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...
> 

This is quite off-topic, but here is your formula anyway : 

let a be the angle you want to rotate, positive a going counterclockwise,
1/ if a is in degrees, convert it into radians (multiply it by PI/180),
2/ the coordinates of the rotated point are

(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a))

Francois

- Raw text -


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