1 /* === S I N F 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 __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
25 #define __SINFG_STUDIO_DUCK_TRANSFORM_ROTATE_H
27 /* === H E A D E R S ======================================================= */
29 #include "duckmatic.h"
30 #include <sinfg/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 sinfg::Transform
49 Transform_Rotate(const sinfg::Angle& angle,const sinfg::Vector& origin=sinfg::Vector(0,0)):
52 sin_val(sinfg::Angle::sin(angle).get()),
53 cos_val(sinfg::Angle::cos(angle).get())
57 sinfg::Vector perform(const sinfg::Vector& x)const
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;
62 sinfg::Vector unperform(const sinfg::Vector& x)const
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;
71 /* === E N D =============================================================== */