00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _GAN_3VECTORF_H
00030 #define _GAN_3VECTORF_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_REPEAT3_H
00064 #define _GAN_REPEAT3_H
00065
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069
00070
00071 #define GAN_REP3_AS(a,b,p1,p2,p3) (a p1 b, a p2 b, a p3 b)
00072 #define GAN_REP3_AS_C(a,b) GAN_REP3_AS(a,b,x,y,z)
00073 #define GAN_REP3_A(a,p1,p2,p3) (a p1, a p2, a p3)
00074 #define GAN_REP3_A_C(a) GAN_REP3_A(a,x,y,z)
00075
00076 #define GAN_FREP3_A(a,b,p1,p2,p3,q1,q2,q3) (a p1 b q1, a p2 b q2, a p3 b q3)
00077 #define GAN_FREP3_A_C(a,b,p1,p2,p3) GAN_FREP3_A(a,b,x,y,z,p1,p2,p3)
00078
00079
00080 #define GAN_REP3_ABS(a,b,c,p1,p2,p3,q1,q2,q3)\
00081 (a p1 b q1 c, a p2 b q2 c, a p3 b q3 c)
00082 #define GAN_REP3_AAS(a,b,c,p1,p2,p3) GAN_REP3_ABS(a,b,c,p1,p2,p3,p1,p2,p3)
00083 #define GAN_REP3_AAS_C(a,b,c) GAN_REP3_AAS(a,b,c,x,y,z)
00084
00085 #define GAN_REP3_AB(a,b,p1,p2,p3,q1,q2,q3)\
00086 (a p1 b q1, a p2 b q2, a p3 b q3)
00087 #define GAN_REP3_AA(a,b,p1,p2,p3) GAN_REP3_AB(a,b,p1,p2,p3,p1,p2,p3)
00088 #define GAN_REP3_AA_C(a,b) GAN_REP3_AA(a,b,x,y,z)
00089
00090 #define GAN_REP3_ABCS(a,b,c,d,p1,p2,p3,q1,q2,q3,r1,r2,r3)\
00091 (a p1 b q1 c r1 d, a p2 b q2 c r2 d, a p3 b q3 c r3 d)
00092 #define GAN_REP3_ABC(a,b,c,p1,p2,p3,q1,q2,q3,r1,r2,r3)\
00093 (a p1 b q1 c r1, a p2 b q2 c r2, a p3 b q3 c r3)
00094 #define GAN_REP3_AAA(a,b,c,p1,p2,p3)\
00095 GAN_REP3_ABC(a,b,c,p1,p2,p3,p1,p2,p3,p1,p2,p3)
00096 #define GAN_REP3_AAA_C(a,b,c) GAN_REP3_AAA(a,b,c,x,y,z)
00097
00098 #define GAN_REP3_OP_AB(a,b,p1,p2,p3,q1,q2,q3,op)\
00099 (a p1 b q1 op a p2 b q2 op a p3 b q3)
00100 #define GAN_REP3_OP_AA(a,b,p1,p2,p3,op)\
00101 GAN_REP3_OP_AB(a,b,p1,p2,p3,p1,p2,p3,op)
00102 #define GAN_REP3_OP_AA_C(a,b,op) GAN_REP3_OP_AA(a,b,x,y,z,op)
00103
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107
00108 #endif
00109
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 #ifndef _GAN_MATVECF_MACROS_H
00138 #define _GAN_MATVECF_MACROS_H
00139
00140 #ifdef __cplusplus
00141 extern "C" {
00142 #endif
00143
00144
00145
00146 #define GAN_TEST_OP1(A,typeA) assert(sizeof(*(A))==sizeof(typeA))
00147 #define GAN_TEST_OP2(A,B,typeA,typeB)\
00148 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)))
00149 #define GAN_TEST_OP3(A,B,C,typeA,typeB,typeC)\
00150 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00151 sizeof(*(C))==sizeof(typeC)))
00152 #define GAN_TEST_OP4(A,B,C,D,typeA,typeB,typeC,typeD)\
00153 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00154 sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)))
00155 #define GAN_TEST_OP5(A,B,C,D,E,typeA,typeB,typeC,typeD,typeE)\
00156 (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00157 sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)&&\
00158 sizeof(*(E))==sizeof(typeE)))
00159
00160 #ifdef __cplusplus
00161 }
00162 #endif
00163
00164 #endif
00165 #include <gandalf/linalg/2vectorf.h>
00166 #include <gandalf/linalg/vecf_gen.h>
00167
00168 #ifdef __cplusplus
00169 extern "C" {
00170 #endif
00171
00187
00188 typedef struct Gan_Vector3_f
00189 {
00190 float x, y, z;
00191 } Gan_Vector3_f;
00192
00194 #if (SIZEOF_FLOAT == 4)
00195 typedef struct Gan_Vector3_f Gan_Vector3_f32;
00196 #endif
00197
00198
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00243 Gan_Vector3_f *gan_vec3f_fill_q ( Gan_Vector3_f *p,
00244 float X, float Y, float Z );
00245
00263 Gan_Vector3_f *gan_vec3f_cross_q ( const Gan_Vector3_f *p, const Gan_Vector3_f *q,
00264 Gan_Vector3_f *r );
00265
00280 Gan_Vector2_f *gan_vec3f_get_v2t_q ( const Gan_Vector3_f *p, Gan_Vector2_f *q );
00281
00303 Gan_Vector3_f *gan_vec3f_set_parts_q ( Gan_Vector3_f *p,
00304 const Gan_Vector2_f *q, float s );
00305
00311 #define GAN_VECTYPE Gan_Vector3_f
00312 #define GAN_VECTOR_TYPE Gan_Vector_f
00313 #define GAN_VEC_ELEMENT_TYPE GAN_FLOAT
00314 #define GAN_REALTYPE float
00315 #define GAN_FWRITE_LENDIAN gan_fwrite_lendian_f32
00316 #define GAN_FREAD_LENDIAN gan_fread_lendian_f32
00317 #define GAN_VEC_FPRINT gan_vec3f_fprint
00318 #define GAN_VEC_PRINT gan_vec3f_print
00319 #define GAN_VEC_FSCANF gan_vec3f_fscanf
00320 #define GAN_VEC_FWRITE gan_vec3f_fwrite
00321 #define GAN_VEC_FREAD gan_vec3f_fread
00322 #define GAN_VEC_ZERO_Q gan_vec3f_zero_q
00323 #define GAN_VEC_ZERO_S gan_vec3f_zero_s
00324 #define GAN_VEC_COPY_Q gan_vec3f_copy_q
00325 #define GAN_VEC_COPY_S gan_vec3f_copy_s
00326 #define GAN_VEC_SCALE_Q gan_vec3f_scale_q
00327 #define GAN_VEC_SCALE_S gan_vec3f_scale_s
00328 #define GAN_VEC_SCALE_I gan_vec3f_scale_i
00329 #define GAN_VEC_DIVIDE_Q gan_vec3f_divide_q
00330 #define GAN_VEC_DIVIDE_S gan_vec3f_divide_s
00331 #define GAN_VEC_DIVIDE_I gan_vec3f_divide_i
00332 #define GAN_VEC_NEGATE_Q gan_vec3f_negate_q
00333 #define GAN_VEC_NEGATE_S gan_vec3f_negate_s
00334 #define GAN_VEC_NEGATE_I gan_vec3f_negate_i
00335 #define GAN_VEC_UNIT_Q gan_vec3f_unit_q
00336 #define GAN_VEC_UNIT_S gan_vec3f_unit_s
00337 #define GAN_VEC_UNIT_I gan_vec3f_unit_i
00338 #define GAN_VEC_ADD_Q gan_vec3f_add_q
00339 #define GAN_VEC_ADD_I1 gan_vec3f_add_i1
00340 #define GAN_VEC_ADD_I2 gan_vec3f_add_i2
00341 #define GAN_VEC_INCREMENT gan_vec3f_increment
00342 #define GAN_VEC_ADD_S gan_vec3f_add_s
00343 #define GAN_VEC_SUB_Q gan_vec3f_sub_q
00344 #define GAN_VEC_SUB_I1 gan_vec3f_sub_i1
00345 #define GAN_VEC_SUB_I2 gan_vec3f_sub_i2
00346 #define GAN_VEC_DECREMENT gan_vec3f_decrement
00347 #define GAN_VEC_SUB_S gan_vec3f_sub_s
00348 #define GAN_VEC_DOT_Q gan_vec3f_dot_q
00349 #define GAN_VEC_DOT_S gan_vec3f_dot_s
00350 #define GAN_VEC_SQRLEN_Q gan_vec3f_sqrlen_q
00351 #define GAN_VEC_SQRLEN_S gan_vec3f_sqrlen_s
00352 #define GAN_VEC_FROM_VEC_Q gan_vec3f_from_vecf_q
00353 #define GAN_VEC_FROM_VEC_S gan_vec3f_from_vecf_s
00354
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00398 Gan_Vector3_f *gan_vec3f_zero_q ( Gan_Vector3_f *p );
00399
00414 Gan_Vector3_f *gan_vec3f_copy_q ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00415
00431 Gan_Vector3_f *gan_vec3f_scale_q ( Gan_Vector3_f *p, float a,
00432 Gan_Vector3_f *q );
00433
00439 Gan_Vector3_f *gan_vec3f_scale_i ( Gan_Vector3_f *p, float a );
00440
00447 Gan_Vector3_f *gan_vec3f_divide_q ( Gan_Vector3_f *p, float a,
00448 Gan_Vector3_f *q );
00449
00455 Gan_Vector3_f *gan_vec3f_divide_i ( Gan_Vector3_f *p, float a );
00456
00464 Gan_Vector3_f *gan_vec3f_negate_q ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00465
00473 Gan_Vector3_f *gan_vec3f_negate_i ( Gan_Vector3_f *p );
00474
00480 Gan_Vector3_f *gan_vec3f_unit_i ( Gan_Vector3_f *p );
00481
00499 Gan_Vector3_f *gan_vec3f_add_q ( Gan_Vector3_f *p, Gan_Vector3_f *q, Gan_Vector3_f *r );
00500
00509 Gan_Vector3_f *gan_vec3f_add_i1 ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00510
00519 Gan_Vector3_f *gan_vec3f_add_i2 ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00520
00529 Gan_Vector3_f *gan_vec3f_increment ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00530
00548 Gan_Vector3_f *gan_vec3f_sub_q ( Gan_Vector3_f *p, Gan_Vector3_f *q, Gan_Vector3_f *r );
00549
00558 Gan_Vector3_f *gan_vec3f_sub_i1 ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00559
00568 Gan_Vector3_f *gan_vec3f_sub_i2 ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00569
00578 Gan_Vector3_f *gan_vec3f_decrement ( Gan_Vector3_f *p, Gan_Vector3_f *q );
00579
00595 float gan_vec3f_dot_q ( const Gan_Vector3_f *p, const Gan_Vector3_f *q );
00596
00614 float gan_vec3f_sqrlen_q ( const Gan_Vector3_f *p );
00615
00625 Gan_Vector3_f gan_vec3f_from_vecf_s ( const Gan_Vector_f *x );
00626
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659 #undef GAN_VECTYPE
00660 #undef GAN_VECTOR_TYPE
00661 #undef GAN_VEC_ELEMENT_TYPE
00662 #undef GAN_REALTYPE
00663 #undef GAN_FWRITE_LENDIAN
00664 #undef GAN_FREAD_LENDIAN
00665 #undef GAN_VEC_FPRINT
00666 #undef GAN_VEC_PRINT
00667 #undef GAN_VEC_FSCANF
00668 #undef GAN_VEC_FWRITE
00669 #undef GAN_VEC_FREAD
00670 #undef GAN_VEC_ZERO_Q
00671 #undef GAN_VEC_ZERO_S
00672 #undef GAN_VEC_COPY_Q
00673 #undef GAN_VEC_COPY_S
00674 #undef GAN_VEC_SCALE_Q
00675 #undef GAN_VEC_SCALE_S
00676 #undef GAN_VEC_SCALE_I
00677 #undef GAN_VEC_DIVIDE_Q
00678 #undef GAN_VEC_DIVIDE_S
00679 #undef GAN_VEC_DIVIDE_I
00680 #undef GAN_VEC_NEGATE_Q
00681 #undef GAN_VEC_NEGATE_S
00682 #undef GAN_VEC_NEGATE_I
00683 #undef GAN_VEC_UNIT_Q
00684 #undef GAN_VEC_UNIT_S
00685 #undef GAN_VEC_UNIT_I
00686 #undef GAN_VEC_ADD_Q
00687 #undef GAN_VEC_ADD_I1
00688 #undef GAN_VEC_ADD_I2
00689 #undef GAN_VEC_INCREMENT
00690 #undef GAN_VEC_ADD_S
00691 #undef GAN_VEC_SUB_Q
00692 #undef GAN_VEC_SUB_I1
00693 #undef GAN_VEC_SUB_I2
00694 #undef GAN_VEC_DECREMENT
00695 #undef GAN_VEC_SUB_S
00696 #undef GAN_VEC_DOT_Q
00697 #undef GAN_VEC_DOT_S
00698 #undef GAN_VEC_SQRLEN_Q
00699 #undef GAN_VEC_SQRLEN_S
00700 #undef GAN_VEC_FROM_VEC_Q
00701 #undef GAN_VEC_FROM_VEC_S
00702
00715 #ifdef __cplusplus
00716 }
00717 #endif
00718
00719 #endif