1 /*
2 * x_rotate.h
3 * AYM 1998-11-22
4 */
5
6
7 /*
8 This file is part of Yadex.
9
10 Yadex incorporates code from DEU 5.21 that was put in the public domain in
11 1994 by Rapha�l Quinet and Brendon Wyber.
12
13 The rest of Yadex is Copyright � 1997-2003 Andr� Majorel and others.
14
15 This program is free software; you can redistribute it and/or modify it under
16 the terms of the GNU General Public License as published by the Free Software
17 Foundation; either version 2 of the License, or (at your option) any later
18 version.
19
20 This program is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License along with
25 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
26 Place, Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29
30 #include <math.h>
31
32
RotateAndScaleCoords(int * x,int * y,double angle,double scale)33 inline void RotateAndScaleCoords (int *x, int *y, double angle, double scale)
34 {
35 double r, theta;
36
37 r = hypot ((double) *x, (double) *y);
38 theta = atan2 ((double) *y, (double) *x);
39 *x = (int) (r * scale * cos (theta + angle) + 0.5);
40 *y = (int) (r * scale * sin (theta + angle) + 0.5);
41 }
42
43 void RotateAndScaleObjects (int, SelPtr, double, double);
44
45