26 #ifndef __SYNFIG_VECTOR_H
27 #define __SYNFIG_VECTOR_H
39 #if defined(__APPLE__) && !defined(SYNFIG_ISNAN_FIX)
43 inline bool isnan(
double x) {
return x != x; }
44 inline bool isnan(
float x) {
return x != x; }
45 #define SYNFIG_ISNAN_FIX 1
51 #define SYNFIG_ISINF_FIX 1
54 #define isnan(x) (std::isnan)(x)
57 #define isinf(x) (std::isinf)(x)
83 _x(radius*
Angle::cos(angle).get()),
84 _y(radius*
Angle::sin(angle).get())
133 {
return Vector(*
this)+=rhs; }
137 {
return Vector(*
this)-=rhs; }
141 {
return Vector(*
this)*=rhs; }
145 {
return Vector(*
this)/=rhs; }
149 {
return Vector(-_x,-_y); }
153 {
return _x*rhs._x+_y*rhs._y; }
157 {
return _x==rhs._x && _y==rhs._y; }
161 {
return _y!=rhs._y || _x!=rhs._x; }
165 {
return _x*_x+_y*_y; }
181 {
return Vector(_y,-_x); }
184 {
return Angle::rad(atan2(_y, _x)); }
190 return (*
this-rhs).mag_squared()<=
epsilon;
196 {
return Vector(_x*rhs._x, _y*rhs._y); }
198 {
return Vector(_x/rhs._x, _y/rhs._y); }
200 {
return Vector(1.0/_x, 1.0/_y); }
205 return Vector(c*_x - s*_y, s*_x + c*_y);
212 typedef Vector
Point;
222 {
return rhs.
mag(); }
226 #include <ETL/bezier>
231 class bezier_base<synfig::Vector,float> :
public std::unary_function<float,synfig::Vector>
238 bezier_base<synfig::Vector::value_type,time_type> bezier_x,bezier_y;
250 a(a),b(b),c(c),d(d) { set_rs(r,s); sync(); }
254 bezier_x[0]=a[0],bezier_y[0]=a[1];
255 bezier_x[1]=b[0],bezier_y[1]=b[1];
256 bezier_x[2]=c[0],bezier_y[2]=c[1];
257 bezier_x[3]=d[0],bezier_y[3]=d[1];
270 t=(t-get_r())/get_dt();
281 f = affine_func(p1,p2,t);
297 operator[](
int i)
const