25 #ifndef __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
26 #define __SYNFIG_STUDIO_DUCK_TRANSFORM_ROTATE_H
31 #include <synfig/angle.h>
45 synfig::Vector origin;
50 Transform_Rotate(
const synfig::GUID& guid,
const synfig::Angle& angle,
const synfig::Vector& origin=synfig::Vector(0,0)):
54 sin_val(synfig::Angle::sin(angle).get()),
55 cos_val(synfig::Angle::cos(angle).get())
59 synfig::Vector
perform(
const synfig::Vector& x)
const
61 synfig::Point pos(x-origin);
62 return synfig::Point(cos_val*pos[0]-sin_val*pos[1],sin_val*pos[0]+cos_val*pos[1])+origin;
64 synfig::Vector
unperform(
const synfig::Vector& x)
const
66 synfig::Point pos(x-origin);
67 return synfig::Point(cos_val*pos[0]+sin_val*pos[1],-sin_val*pos[0]+cos_val*pos[1])+origin;