00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _GAN_2VECTORF_H
00030 #define _GAN_2VECTORF_H
00031
00032 #include <stdlib.h>
00033 #include <stdio.h>
00034 #include <gandalf/common/misc_defs.h>
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #ifndef _GAN_REPEAT2_H
00064 #define _GAN_REPEAT2_H
00065
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069
00070
00071 #define GAN_REP2_AS(a,b,p1,p2) (a p1 b, a p2 b)
00072 #define GAN_REP2_A(a,p1,p2) (a p1, a p2)
00073 #define GAN_REP2_AS_C(a,b) GAN_REP2_AS(a,b,x,y)
00074 #define GAN_REP2_A_C(a) GAN_REP2_A(a,x,y)
00075
00076 #define GAN_FREP2_A(a,b,p1,p2,q1,q2) (a p1 b q1, a p2 b q2)
00077 #define GAN_FREP2_A_C(a,b,p1,p2) GAN_FREP2_A(a,b,x,y,p1,p2)
00078
00079 #define GAN_REP2_AB(a,b,p1,p2,q1,q2) (a p1 b q1, a p2 b q2)
00080 #define GAN_REP2_AA(a,b,p1,p2) GAN_REP2_AB(a,b,p1,p2,p1,p2)
00081 #define GAN_REP2_AA_C(a,b) GAN_REP2_AA(a,b,x,y)
00082
00083 #define GAN_REP2_ABS(a,b,c,p1,p2,q1,q2) (a p1 b q1 c, a p2 b q2 c)
00084 #define GAN_REP2_AAS(a,b,c,p1,p2) GAN_REP2_ABS(a,b,c,p1,p2,p1,p2)
00085 #define GAN_REP2_AAS_C(a,b,c) GAN_REP2_AAS(a,b,c,x,y)
00086
00087 #define GAN_REP2_AB(a,b,p1,p2,q1,q2) (a p1 b q1, a p2 b q2)
00088 #define GAN_REP2_AA(a,b,p1,p2) GAN_REP2_AB(a,b,p1,p2,p1,p2)
00089 #define GAN_REP2_AA_C(a,b) GAN_REP2_AA(a,b,x,y)
00090
00091 #define GAN_REP2_ABCS(a,b,c,d,p1,p2,q1,q2,r1,r2)\
00092 (a p1 b q1 c r1 d, a p2 b q2 c r2 d)
00093 #define GAN_REP2_ABC(a,b,c,p1,p2,q1,q2,r1,r2)\
00094 (a p1 b q1 c r1, a p2 b q2 c r2)
00095 #define GAN_REP2_AAA(a,b,c,p1,p2) GAN_REP2_ABC(a,b,c,p1,p2,p1,p2,p1,p2)
00096 #define GAN_REP2_AAA_C(a,b,c) GAN_REP2_AAA(a,b,c,x,y)
00097
00098 #define GAN_REP2_OP_AB(a,b,p1,p2,q1,q2,op)\
00099 (a p1 b q1 op a p2 b q2)
00100 #define GAN_REP2_OP_AA(a,b,p1,p2,op) GAN_REP2_OP_AB(a,b,p1,p2,p1,p2,op)
00101 #define GAN_REP2_OP_AA_C(a,b,op) GAN_REP2_OP_AA(a,b,x,y,op)
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106
00107 #endif
00108
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 #ifndef _GAN_MATVECF_MACROS_H
00137 #define _GAN_MATVECF_MACROS_H
00138
00139 #ifdef __cplusplus
00140 extern "C" {
00141 #endif
00142
00143
00144
00145 #define GAN_TEST_OP1(A,typeA) assert(sizeof(*(A))==sizeof(typeA))
00146 #define GAN_TEST_OP2(A,B,typeA,typeB)\
00147 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)))
00148 #define GAN_TEST_OP3(A,B,C,typeA,typeB,typeC)\
00149 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00150 sizeof(*(C))==sizeof(typeC)))
00151 #define GAN_TEST_OP4(A,B,C,D,typeA,typeB,typeC,typeD)\
00152 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00153 sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)))
00154 #define GAN_TEST_OP5(A,B,C,D,E,typeA,typeB,typeC,typeD,typeE)\
00155 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00156 sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)&&\
00157 sizeof(*(E))==sizeof(typeE)))
00158
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162
00163 #endif
00164 #include <gandalf/linalg/vecf_gen.h>
00165
00166 #ifdef __cplusplus
00167 extern "C" {
00168 #endif
00169
00185
00186 typedef struct Gan_Vector2_f
00187 {
00188 float x, y;
00189 } Gan_Vector2_f;
00190
00192 #if (SIZEOF_FLOAT == 4)
00193 typedef struct Gan_Vector2_f Gan_Vector2_f32;
00194 #endif
00195
00196
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00239 Gan_Vector2_f *gan_vec2f_fill_q ( Gan_Vector2_f *p, float X, float Y );
00240
00246 #define GAN_VECTYPE Gan_Vector2_f
00247 #define GAN_VECTOR_TYPE Gan_Vector_f
00248 #define GAN_VEC_ELEMENT_TYPE GAN_FLOAT
00249 #define GAN_REALTYPE float
00250 #define GAN_FWRITE_LENDIAN gan_fwrite_lendian_f32
00251 #define GAN_FREAD_LENDIAN gan_fread_lendian_f32
00252 #define GAN_VEC_FPRINT gan_vec2f_fprint
00253 #define GAN_VEC_PRINT gan_vec2f_print
00254 #define GAN_VEC_FSCANF gan_vec2f_fscanf
00255 #define GAN_VEC_FWRITE gan_vec2f_fwrite
00256 #define GAN_VEC_FREAD gan_vec2f_fread
00257 #define GAN_VEC_ZERO_Q gan_vec2f_zero_q
00258 #define GAN_VEC_ZERO_S gan_vec2f_zero_s
00259 #define GAN_VEC_COPY_Q gan_vec2f_copy_q
00260 #define GAN_VEC_COPY_S gan_vec2f_copy_s
00261 #define GAN_VEC_SCALE_Q gan_vec2f_scale_q
00262 #define GAN_VEC_SCALE_S gan_vec2f_scale_s
00263 #define GAN_VEC_SCALE_I gan_vec2f_scale_i
00264 #define GAN_VEC_DIVIDE_Q gan_vec2f_divide_q
00265 #define GAN_VEC_DIVIDE_S gan_vec2f_divide_s
00266 #define GAN_VEC_DIVIDE_I gan_vec2f_divide_i
00267 #define GAN_VEC_NEGATE_Q gan_vec2f_negate_q
00268 #define GAN_VEC_NEGATE_S gan_vec2f_negate_s
00269 #define GAN_VEC_NEGATE_I gan_vec2f_negate_i
00270 #define GAN_VEC_UNIT_Q gan_vec2f_unit_q
00271 #define GAN_VEC_UNIT_S gan_vec2f_unit_s
00272 #define GAN_VEC_UNIT_I gan_vec2f_unit_i
00273 #define GAN_VEC_ADD_Q gan_vec2f_add_q
00274 #define GAN_VEC_ADD_I1 gan_vec2f_add_i1
00275 #define GAN_VEC_ADD_I2 gan_vec2f_add_i2
00276 #define GAN_VEC_INCREMENT gan_vec2f_increment
00277 #define GAN_VEC_ADD_S gan_vec2f_add_s
00278 #define GAN_VEC_SUB_Q gan_vec2f_sub_q
00279 #define GAN_VEC_SUB_I1 gan_vec2f_sub_i1
00280 #define GAN_VEC_SUB_I2 gan_vec2f_sub_i2
00281 #define GAN_VEC_DECREMENT gan_vec2f_decrement
00282 #define GAN_VEC_SUB_S gan_vec2f_sub_s
00283 #define GAN_VEC_DOT_Q gan_vec2f_dot_q
00284 #define GAN_VEC_DOT_S gan_vec2f_dot_s
00285 #define GAN_VEC_SQRLEN_Q gan_vec2f_sqrlen_q
00286 #define GAN_VEC_SQRLEN_S gan_vec2f_sqrlen_s
00287 #define GAN_VEC_FROM_VEC_Q gan_vec2f_from_vecf_q
00288 #define GAN_VEC_FROM_VEC_S gan_vec2f_from_vecf_s
00289
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00333 Gan_Vector2_f *gan_vec2f_zero_q ( Gan_Vector2_f *p );
00334
00349 Gan_Vector2_f *gan_vec2f_copy_q ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00350
00366 Gan_Vector2_f *gan_vec2f_scale_q ( Gan_Vector2_f *p, float a,
00367 Gan_Vector2_f *q );
00368
00374 Gan_Vector2_f *gan_vec2f_scale_i ( Gan_Vector2_f *p, float a );
00375
00382 Gan_Vector2_f *gan_vec2f_divide_q ( Gan_Vector2_f *p, float a,
00383 Gan_Vector2_f *q );
00384
00390 Gan_Vector2_f *gan_vec2f_divide_i ( Gan_Vector2_f *p, float a );
00391
00399 Gan_Vector2_f *gan_vec2f_negate_q ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00400
00408 Gan_Vector2_f *gan_vec2f_negate_i ( Gan_Vector2_f *p );
00409
00415 Gan_Vector2_f *gan_vec2f_unit_i ( Gan_Vector2_f *p );
00416
00434 Gan_Vector2_f *gan_vec2f_add_q ( Gan_Vector2_f *p, Gan_Vector2_f *q, Gan_Vector2_f *r );
00435
00444 Gan_Vector2_f *gan_vec2f_add_i1 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00445
00454 Gan_Vector2_f *gan_vec2f_add_i2 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00455
00464 Gan_Vector2_f *gan_vec2f_increment ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00465
00483 Gan_Vector2_f *gan_vec2f_sub_q ( Gan_Vector2_f *p, Gan_Vector2_f *q, Gan_Vector2_f *r );
00484
00493 Gan_Vector2_f *gan_vec2f_sub_i1 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00494
00503 Gan_Vector2_f *gan_vec2f_sub_i2 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00504
00513 Gan_Vector2_f *gan_vec2f_decrement ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00514
00530 float gan_vec2f_dot_q ( const Gan_Vector2_f *p, const Gan_Vector2_f *q );
00531
00549 float gan_vec2f_sqrlen_q ( const Gan_Vector2_f *p );
00550
00560 Gan_Vector2_f gan_vec2f_from_vecf_s ( const Gan_Vector_f *x );
00561
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594 #undef GAN_VECTYPE
00595 #undef GAN_VECTOR_TYPE
00596 #undef GAN_VEC_ELEMENT_TYPE
00597 #undef GAN_REALTYPE
00598 #undef GAN_FWRITE_LENDIAN
00599 #undef GAN_FREAD_LENDIAN
00600 #undef GAN_VEC_FPRINT
00601 #undef GAN_VEC_PRINT
00602 #undef GAN_VEC_FSCANF
00603 #undef GAN_VEC_FWRITE
00604 #undef GAN_VEC_FREAD
00605 #undef GAN_VEC_ZERO_Q
00606 #undef GAN_VEC_ZERO_S
00607 #undef GAN_VEC_COPY_Q
00608 #undef GAN_VEC_COPY_S
00609 #undef GAN_VEC_SCALE_Q
00610 #undef GAN_VEC_SCALE_S
00611 #undef GAN_VEC_SCALE_I
00612 #undef GAN_VEC_DIVIDE_Q
00613 #undef GAN_VEC_DIVIDE_S
00614 #undef GAN_VEC_DIVIDE_I
00615 #undef GAN_VEC_NEGATE_Q
00616 #undef GAN_VEC_NEGATE_S
00617 #undef GAN_VEC_NEGATE_I
00618 #undef GAN_VEC_UNIT_Q
00619 #undef GAN_VEC_UNIT_S
00620 #undef GAN_VEC_UNIT_I
00621 #undef GAN_VEC_ADD_Q
00622 #undef GAN_VEC_ADD_I1
00623 #undef GAN_VEC_ADD_I2
00624 #undef GAN_VEC_INCREMENT
00625 #undef GAN_VEC_ADD_S
00626 #undef GAN_VEC_SUB_Q
00627 #undef GAN_VEC_SUB_I1
00628 #undef GAN_VEC_SUB_I2
00629 #undef GAN_VEC_DECREMENT
00630 #undef GAN_VEC_SUB_S
00631 #undef GAN_VEC_DOT_Q
00632 #undef GAN_VEC_DOT_S
00633 #undef GAN_VEC_SQRLEN_Q
00634 #undef GAN_VEC_SQRLEN_S
00635 #undef GAN_VEC_FROM_VEC_Q
00636 #undef GAN_VEC_FROM_VEC_S
00637
00650 #ifdef __cplusplus
00651 }
00652 #endif
00653
00654 #endif