40 #include <visp3/core/vpConfig.h>
41 #include <visp3/robot/vpWireFrameSimulatorTypes.h>
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 #define ADD_COORD2(r,a,b) { (r).x = (a).x + (b).x;\
47 (r).y = (a).y + (b).y; }
49 #define ADD_COORD3(r,a,b) { (r).x = (a).x + (b).x;\
50 (r).y = (a).y + (b).y;\
51 (r).z = (a).z + (b).z; }
53 #define INC_COORD2(r,a) { (r).x += (a).x; (r).y += (a).y; }
55 #define INC_COORD3(r,a) { (r).x += (a).x; (r).y += (a).y;\
58 #define CROSS_PRODUCT(r,a,b) { (r).x = (a).y * (b).z - (a).z * (b).y;\
59 (r).y = (a).z * (b).x - (a).x * (b).z;\
60 (r).z = (a).x * (b).y - (a).y * (b).x; }
62 #define DIF_COORD2(r,a,b) { (r).x = (a).x - (b).x;\
63 (r).y = (a).y - (b).y; }
65 #define DIF_COORD3(r,a,b) { (r).x = (a).x - (b).x;\
66 (r).y = (a).y - (b).y;\
67 (r).z = (a).z - (b).z; }
69 #define DOT_PRODUCT(a,b) ( ((a).x * (b).x) +\
73 #define LENGTH3(a) (sqrt((double) DOT_PRODUCT((a),(a))))
75 #define MID_COORD3(r,a,b) { (r).x = ((a).x + (b).x) / 2.0;\
76 (r).y = ((a).y + (b).y) / 2.0;\
77 (r).z = ((a).z + (b).z) / 2.0; }
79 #define MUL_COORD3(r,a,b,c) { (r).x *= (a); (r).y *= (b); (r).z *= (c); }
81 #define PAR_COORD3(r,t,a,b) { (r).x = ((b).x - (a).x) * (t) + (a).x;\
82 (r).y = ((b).y - (a).y) * (t) + (a).y;\
83 (r).z = ((b).z - (a).z) * (t) + (a).z; }
85 #define SET_COORD2(r,a,b) { (r).x = (a); (r).y = (b); }
87 #define SET_COORD3(r,a,b,c) { (r).x = (a); (r).y = (b); (r).z = (c); }
89 #define SUB_COORD2(r,a) { (r).x -= (a).x; (r).y -= (a).y; }
91 #define SUB_COORD3(r,a) { (r).x -= (a).x; (r).y -= (a).y;\
94 #define COORD3_COL(x,y,z,m,i) ( ((x) * (m)[0][i]) +\
99 #define COORD4_COL(x,y,z,w,m,i) ( ((x) * (m)[0][i]) +\
104 #define M_POLY1(x,a,b) ((a) * (x) + (b))
105 #define M_POLY2(x,a,b,c) (M_POLY1((x),(a),(b)) * (x) + (c))
106 #define M_POLY3(x,a,b,c,d) (M_POLY2((x),(a),(b),(c)) * (x) + (d))
130 #define IDENTITY_MATRIX { {1.0, 0.0, 0.0, 0.0},\
131 {0.0, 1.0, 0.0, 0.0},\
132 {0.0, 0.0, 1.0, 0.0},\
133 {0.0, 0.0, 0.0, 1.0} }
153 #define IDENTITY_ROTATE { 0.0, 0.0, 0.0 }
154 #define IDENTITY_SCALE { 1.0, 1.0, 1.0 }
155 #define IDENTITY_TRANSLATE { 0.0, 0.0, 0.0 }
157 #define IDENTITY_POSITION { IDENTITY_ROTATE,\
161 void fprintf_matrix (FILE *fp, Matrix m);
162 void ident_matrix (Matrix m);
163 void premult_matrix (Matrix a, Matrix b);
164 void premult3_matrix (Matrix a, Matrix b);
165 void prescale_matrix (Matrix m, Vector *vp);
166 void pretrans_matrix (Matrix m, Vector *vp);
167 void postleft_matrix (Matrix m,
char axis);
168 void postmult_matrix (Matrix a, Matrix b);
169 void postmult3_matrix (Matrix a, Matrix b);
170 void postscale_matrix (Matrix m, Vector *vp);
171 void posttrans_matrix (Matrix m, Vector *vp);
172 void transpose_matrix (Matrix m);
174 float cosin_to_angle (
float ca,
float sa);
175 float norm_vector (Vector *vp);
176 void point_matrix (Point4f *p4, Point3f *p3, Matrix m);
177 void plane_norme (Vector *np, Point3f *ap, Point3f *bp, Point3f *cp);
178 void point_3D_3D (Point3f *ip,
int size, Matrix m, Point3f *op);
179 void point_3D_4D (Point3f *p3,
int size, Matrix m, Point4f *p4);
180 void rotate_vector (Vector *vp,
float a, Vector *axis);
181 void upright_vector (Vector *vp, Vector *up);
183 void Matrix_to_Position (Matrix m, AritPosition *pp);
184 void Matrix_to_Rotate (Matrix m, Vector *vp);
185 void Position_to_Matrix (AritPosition *pp, Matrix m);
186 void Rotate_to_Matrix (Vector *vp, Matrix m);
187 void Rotaxis_to_Matrix (
float a, Vector *axis, Matrix m);
188 void Rotrans_to_Matrix (Vector *rp, Vector *tp, Matrix m);
189 void Scale_to_Matrix (Vector *vp, Matrix m);
190 void Translate_to_Matrix (Vector *vp, Matrix m);
192 void fscanf_Point3f (Point3f *pp);
193 void fscanf_Vector (Vector *vp);