Changed the "tagrelease" and "tagstable" make targets to use subversion. Also increme...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / ducktransform_rotate.h
1 /* === S I N F G =========================================================== */
2 /*!     \file template.h
3 **      \brief Template Header
4 **
5 **      $Id: ducktransform_rotate.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
25 #define __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include "duckmatic.h"
30 #include <sinfg/angle.h>
31
32 /* === M A C R O S ========================================================= */
33
34 /* === T Y P E D E F S ===================================================== */
35
36 /* === C L A S S E S & S T R U C T S ======================================= */
37
38 namespace studio {
39
40 class Transform_Rotate : public sinfg::Transform
41 {
42 private:
43         sinfg::Angle angle;
44         sinfg::Vector origin;
45         sinfg::Real sin_val;
46         sinfg::Real cos_val;
47
48 public:
49         Transform_Rotate(const sinfg::Angle& angle,const sinfg::Vector& origin=sinfg::Vector(0,0)):
50                 angle(angle),
51                 origin(origin),
52                 sin_val(sinfg::Angle::sin(angle).get()),
53                 cos_val(sinfg::Angle::cos(angle).get())
54         {
55         }
56         
57         sinfg::Vector perform(const sinfg::Vector& x)const
58         {
59                 sinfg::Point pos(x-origin);
60                 return sinfg::Point(cos_val*pos[0]-sin_val*pos[1],sin_val*pos[0]+cos_val*pos[1])+origin;
61         }
62         sinfg::Vector unperform(const sinfg::Vector& x)const
63         {
64                 sinfg::Point pos(x-origin);
65                 return sinfg::Point(cos_val*pos[0]+sin_val*pos[1],-sin_val*pos[0]+cos_val*pos[1])+origin;
66         }
67 };
68
69 };
70
71 /* === E N D =============================================================== */
72
73 #endif