1 /* === S Y N F I G ========================================================= */
3 ** \brief Template Header
5 ** $Id: ducktransform_rotate.h,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
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.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
25 #define __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
27 /* === H E A D E R S ======================================================= */
29 #include "duckmatic.h"
30 #include <synfig/angle.h>
32 /* === M A C R O S ========================================================= */
34 /* === T Y P E D E F S ===================================================== */
36 /* === C L A S S E S & S T R U C T S ======================================= */
40 class Transform_Rotate : public synfig::Transform
44 synfig::Vector origin;
49 Transform_Rotate(const synfig::Angle& angle,const synfig::Vector& origin=synfig::Vector(0,0)):
52 sin_val(synfig::Angle::sin(angle).get()),
53 cos_val(synfig::Angle::cos(angle).get())
57 synfig::Vector perform(const synfig::Vector& x)const
59 synfig::Point pos(x-origin);
60 return synfig::Point(cos_val*pos[0]-sin_val*pos[1],sin_val*pos[0]+cos_val*pos[1])+origin;
62 synfig::Vector unperform(const synfig::Vector& x)const
64 synfig::Point pos(x-origin);
65 return synfig::Point(cos_val*pos[0]+sin_val*pos[1],-sin_val*pos[0]+cos_val*pos[1])+origin;
71 /* === E N D =============================================================== */