00001 #ifndef IIS_AUX_H
00002 #define IIS_AUX_H
00003 #include "image.h"
00004 #include "math.h"
00005
00009 double dist(double x0, double y0, double x1, double y1);
00010
00014 inline double dist(DirectPoint& a, DirectPoint& b)
00015 {
00016 return dist(a.x,a.y,b.x,b.y);
00017 }
00018
00022 inline int pos(long A, long B, long P, long T)
00023 {
00024 return A+(B-A)*P/T;
00025 }
00026
00031 inline void rotate(double x, double y, double cx, double cy, int &a, int&b, double angle)
00032 {
00033 double dx = x-cx;
00034 double dy = y-cy;
00035 double d = sqrt(dx*dx+dy*dy);
00036 double alfa = atan2(dy,dx);
00037 alfa+=angle;
00038 a=(int)(cos(alfa)*d);
00039 b=(int)(sin(alfa)*d);
00040 }
00041
00042 inline void rotate(double x, double y, double cx, double cy, double &a, double&b, double angle)
00043 {
00044 double dx = x-cx;
00045 double dy = y-cy;
00046 double d = sqrt(dx*dx+dy*dy);
00047 double alfa = atan2(dy,dx);
00048 alfa+=angle;
00049 a=(cos(alfa)*d);
00050 b=(sin(alfa)*d);
00051 }
00052
00053 #endif