Main Page   Modules   Compound List   File List   Compound Members   File Members  

4vectorf.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_4VECTORF_H
00030 #define _GAN_4VECTORF_H
00031 
00032 #include <stdlib.h>
00033 #include <stdio.h>
00034 #include <gandalf/common/misc_defs.h>
00048 /* This library is free software; you can redistribute it and/or
00049    modify it under the terms of the GNU Lesser General Public
00050    License as published by the Free Software Foundation; either
00051    version 2.1 of the License, or (at your option) any later version.
00052 
00053    This library is distributed in the hope that it will be useful,
00054    but WITHOUT ANY WARRANTY; without even the implied warranty of
00055    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00056    Lesser General Public License for more details.
00057 
00058    You should have received a copy of the GNU Lesser General Public
00059    License along with this library; if not, write to the Free Software
00060    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00061 */
00062 
00063 #ifndef _GAN_REPEAT4_H
00064 #define _GAN_REPEAT4_H
00065 
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069 
00070 /* macros for constructing four-fold repetitions */
00071 #define GAN_REP4_AS(a,b,p1,p2,p3,p4) (a p1 b, a p2 b, a p3 b, a p4 b)
00072 #define GAN_REP4_AS_C(a,b) GAN_REP4_AS(a,b,x,y,z,w)
00073 #define GAN_REP4_A(a,p1,p2,p3,p4) (a p1, a p2, a p3, a p4)
00074 #define GAN_REP4_A_C(a) GAN_REP4_A(a,x,y,z,w)
00075 
00076 #define GAN_FREP4_A(a,b,p1,p2,p3,p4,q1,q2,q3,q4)\
00077     (a p1 b q1, a p2 b q2,\
00078      a p3 b q3, a p4 b q4)
00079 #define GAN_FREP4_A_C(a,b,p1,p2,p3,p4) GAN_FREP4_A(a,b,x,y,z,w,p1,p2,p3,p4)
00080 
00081 #define GAN_REP4_ABS(a,b,c,p1,p2,p3,p4,q1,q2,q3,q4)\
00082            (a p1 b q1 c, a p2 b q2 c, a p3 b q3 c, a p4 b q4 c)
00083 #define GAN_REP4_AAS(a,b,c,p1,p2,p3,p4)\
00084            GAN_REP4_ABS(a,b,c,p1,p2,p3,p4,p1,p2,p3,p4)
00085 #define GAN_REP4_AAS_C(a,b,c) GAN_REP4_AAS(a,b,c,x,y,z,w)
00086 
00087 #define GAN_REP4_AB(a,b,p1,p2,p3,p4,q1,q2,q3,q4)\
00088            (a p1 b q1, a p2 b q2, a p3 b q3, a p4 b q4)
00089 #define GAN_REP4_AA(a,b,p1,p2,p3,p4)\
00090            GAN_REP4_AB(a,b,p1,p2,p3,p4,p1,p2,p3,p4)
00091 #define GAN_REP4_AA_C(a,b) GAN_REP4_AA(a,b,x,y,z,w)
00092 
00093 #define GAN_REP4_ABCS(a,b,c,d,p1,p2,p3,p4,q1,q2,q3,q4,r1,r2,r3,r4)\
00094      (a p1 b q1 c r1 d, a p2 b q2 c r2 d, a p3 b q3 c r3 d, a p4 b q4 c r4 d)
00095 #define GAN_REP4_ABC(a,b,c,p1,p2,p3,p4,q1,q2,q3,q4,r1,r2,r3,r4)\
00096      (a p1 b q1 c r1, a p2 b q2 c r2, a p3 b q3 c r3, a p4 b q4 c r4)
00097 #define GAN_REP4_AAA(a,b,c,p1,p2,p3,p4)\
00098            GAN_REP4_ABC(a,b,c,p1,p2,p3,p4,p1,p2,p3,p4,p1,p2,p3,p4)
00099 #define GAN_REP4_AAA_C(a,b,c) GAN_REP4_AAA(a,b,c,x,y,z,w)
00100 
00101 #define GAN_REP4_OP_AB(a,b,p1,p2,p3,p4,q1,q2,q3,q4,op)\
00102         (a p1 b q1 op a p2 b q2 op a p3 b q3 op a p4 b q4)
00103 #define GAN_REP4_OP_AA(a,b,p1,p2,p3,p4,op)\
00104            GAN_REP4_OP_AB(a,b,p1,p2,p3,p4,p1,p2,p3,p4,op)
00105 #define GAN_REP4_OP_AA_C(a,b,op) GAN_REP4_OP_AA(a,b,x,y,z,w,op)
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* #ifndef _GAN_REPEAT4_H */
00112 
00125 /* This library is free software; you can redistribute it and/or
00126    modify it under the terms of the GNU Lesser General Public
00127    License as published by the Free Software Foundation; either
00128    version 2.1 of the License, or (at your option) any later version.
00129 
00130    This library is distributed in the hope that it will be useful,
00131    but WITHOUT ANY WARRANTY; without even the implied warranty of
00132    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00133    Lesser General Public License for more details.
00134 
00135    You should have received a copy of the GNU Lesser General Public
00136    License along with this library; if not, write to the Free Software
00137    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00138 */
00139 
00140 #ifndef _GAN_MATVECF_MACROS_H
00141 #define _GAN_MATVECF_MACROS_H
00142 
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146 
00147 /* macros for testing the types of pointer arguments and then applying an
00148  * operation to them */
00149 #define GAN_TEST_OP1(A,typeA) assert(sizeof(*(A))==sizeof(typeA))
00150 #define GAN_TEST_OP2(A,B,typeA,typeB)\
00151   (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)))
00152 #define GAN_TEST_OP3(A,B,C,typeA,typeB,typeC)\
00153   (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00154           sizeof(*(C))==sizeof(typeC)))
00155 #define GAN_TEST_OP4(A,B,C,D,typeA,typeB,typeC,typeD)\
00156   (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00157           sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)))
00158 #define GAN_TEST_OP5(A,B,C,D,E,typeA,typeB,typeC,typeD,typeE)\
00159   (assert(sizeof(*(A))==sizeof(typeA)&&sizeof(*(B))==sizeof(typeB)&&\
00160           sizeof(*(C))==sizeof(typeC)&&sizeof(*(D))==sizeof(typeD)&&\
00161           sizeof(*(E))==sizeof(typeE)))
00162 
00163 #ifdef __cplusplus
00164 }
00165 #endif
00166 
00167 #endif /* #ifndef _GAN_MATVECF_MACROS_H */
00168 #include <gandalf/linalg/3vectorf.h>
00169 #include <gandalf/linalg/vecf_gen.h>
00170 
00171 #ifdef __cplusplus
00172 extern "C" {
00173 #endif
00174 
00190 
00191 typedef struct Gan_Vector4_f
00192 {
00193    float x, y, z, w;
00194 } Gan_Vector4_f;
00195 
00196 /* declare functions specific to 4-vectors */
00210 /* This library is free software; you can redistribute it and/or
00211    modify it under the terms of the GNU Lesser General Public
00212    License as published by the Free Software Foundation; either
00213    version 2.1 of the License, or (at your option) any later version.
00214 
00215    This library is distributed in the hope that it will be useful,
00216    but WITHOUT ANY WARRANTY; without even the implied warranty of
00217    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00218    Lesser General Public License for more details.
00219 
00220    You should have received a copy of the GNU Lesser General Public
00221    License along with this library; if not, write to the Free Software
00222    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00223 */
00224 
00240 Gan_Vector4_f *gan_vec4f_fill_q ( Gan_Vector4_f *p,
00241                                   float X, float Y, float Z, float W );
00242 
00257 Gan_Vector3_f *gan_vec4f_get_v3t_q ( Gan_Vector4_f *p, Gan_Vector3_f *q );
00258 
00280 Gan_Vector4_f *gan_vec4f_set_parts_q ( Gan_Vector4_f *p,
00281                                        Gan_Vector3_f *q, float s );
00282 
00294 Gan_Vector4_f *gan_vec4f_set_blocks_q ( Gan_Vector4_f *p,
00295                                         Gan_Vector2_f *q, Gan_Vector2_f *r );
00296 
00302 #define GAN_VECTYPE Gan_Vector4_f
00303 #define GAN_VECTOR_TYPE Gan_Vector_f
00304 #define GAN_VEC_ELEMENT_TYPE GAN_FLOAT
00305 #define GAN_REALTYPE float
00306 #define GAN_VEC_FPRINT      gan_vec4f_fprint
00307 #define GAN_VEC_PRINT       gan_vec4f_print
00308 #define GAN_VEC_FSCANF      gan_vec4f_fscanf
00309 #define GAN_VEC_FWRITE      gan_vec4f_fwrite
00310 #define GAN_VEC_FREAD       gan_vec4f_fread
00311 #define GAN_VEC_ZERO_Q      gan_vec4f_zero_q
00312 #define GAN_VEC_ZERO_S      gan_vec4f_zero_s
00313 #define GAN_VEC_COPY_Q      gan_vec4f_copy_q
00314 #define GAN_VEC_COPY_S      gan_vec4f_copy_s
00315 #define GAN_VEC_SCALE_Q     gan_vec4f_scale_q
00316 #define GAN_VEC_SCALE_S     gan_vec4f_scale_s
00317 #define GAN_VEC_SCALE_I     gan_vec4f_scale_i
00318 #define GAN_VEC_DIVIDE_Q    gan_vec4f_divide_q
00319 #define GAN_VEC_DIVIDE_S    gan_vec4f_divide_s
00320 #define GAN_VEC_DIVIDE_I    gan_vec4f_divide_i
00321 #define GAN_VEC_NEGATE_Q    gan_vec4f_negate_q
00322 #define GAN_VEC_NEGATE_S    gan_vec4f_negate_s
00323 #define GAN_VEC_NEGATE_I    gan_vec4f_negate_i
00324 #define GAN_VEC_UNIT_Q      gan_vec4f_unit_q
00325 #define GAN_VEC_UNIT_S      gan_vec4f_unit_s
00326 #define GAN_VEC_UNIT_I      gan_vec4f_unit_i
00327 #define GAN_VEC_ADD_Q       gan_vec4f_add_q
00328 #define GAN_VEC_ADD_I1      gan_vec4f_add_i1
00329 #define GAN_VEC_ADD_I2      gan_vec4f_add_i2
00330 #define GAN_VEC_INCREMENT   gan_vec4f_increment
00331 #define GAN_VEC_ADD_S       gan_vec4f_add_s
00332 #define GAN_VEC_SUB_Q       gan_vec4f_sub_q
00333 #define GAN_VEC_SUB_I1      gan_vec4f_sub_i1
00334 #define GAN_VEC_SUB_I2      gan_vec4f_sub_i2
00335 #define GAN_VEC_DECREMENT   gan_vec4f_decrement
00336 #define GAN_VEC_SUB_S       gan_vec4f_sub_s
00337 #define GAN_VEC_DOT_Q       gan_vec4f_dot_q
00338 #define GAN_VEC_DOT_S       gan_vec4f_dot_s
00339 #define GAN_VEC_SQRLEN_Q    gan_vec4f_sqrlen_q
00340 #define GAN_VEC_SQRLEN_S    gan_vec4f_sqrlen_s
00341 #define GAN_VEC_FROM_VEC_Q  gan_vec4f_from_vecf_q
00342 #define GAN_VEC_FROM_VEC_S  gan_vec4f_from_vecf_s
00343 
00357 /* This library is free software; you can redistribute it and/or
00358    modify it under the terms of the GNU Lesser General Public
00359    License as published by the Free Software Foundation; either
00360    version 2.1 of the License, or (at your option) any later version.
00361 
00362    This library is distributed in the hope that it will be useful,
00363    but WITHOUT ANY WARRANTY; without even the implied warranty of
00364    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00365    Lesser General Public License for more details.
00366 
00367    You should have received a copy of the GNU Lesser General Public
00368    License along with this library; if not, write to the Free Software
00369    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00370 */
00371 
00372 /* function declarations for functions common to all small vector types */
00373 
00374 
00375 /* documentation for macros defined in individual header files */
00376 
00387 Gan_Vector4_f *gan_vec4f_zero_q ( Gan_Vector4_f *p );
00388 
00403 Gan_Vector4_f *gan_vec4f_copy_q ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00404 
00420 Gan_Vector4_f *gan_vec4f_scale_q ( Gan_Vector4_f *p, float a,
00421                                Gan_Vector4_f *q );
00422 
00428 Gan_Vector4_f *gan_vec4f_scale_i ( Gan_Vector4_f *p, float a );
00429 
00436 Gan_Vector4_f *gan_vec4f_divide_q ( Gan_Vector4_f *p, float a,
00437                                 Gan_Vector4_f *q );
00438 
00444 Gan_Vector4_f *gan_vec4f_divide_i ( Gan_Vector4_f *p, float a );
00445 
00453 Gan_Vector4_f *gan_vec4f_negate_q ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00454 
00462 Gan_Vector4_f *gan_vec4f_negate_i ( Gan_Vector4_f *p );
00463 
00469 Gan_Vector4_f *gan_vec4f_unit_i ( Gan_Vector4_f *p );
00470 
00488 Gan_Vector4_f *gan_vec4f_add_q ( Gan_Vector4_f *p, Gan_Vector4_f *q, Gan_Vector4_f *r );
00489 
00498 Gan_Vector4_f *gan_vec4f_add_i1 ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00499 
00508 Gan_Vector4_f *gan_vec4f_add_i2 ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00509 
00518 Gan_Vector4_f *gan_vec4f_increment ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00519 
00537 Gan_Vector4_f *gan_vec4f_sub_q ( Gan_Vector4_f *p, Gan_Vector4_f *q, Gan_Vector4_f *r );
00538 
00547 Gan_Vector4_f *gan_vec4f_sub_i1 ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00548 
00557 Gan_Vector4_f *gan_vec4f_sub_i2 ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00558 
00567 Gan_Vector4_f *gan_vec4f_decrement ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00568 
00584 float gan_vec4f_dot_q ( Gan_Vector4_f *p, Gan_Vector4_f *q );
00585 
00603 float gan_vec4f_sqrlen_q ( Gan_Vector4_f *p );
00604 
00622 Gan_Vector4_f gan_vec4f_from_vecf_s ( Gan_Vector_f *x );
00623 
00641 /* This library is free software; you can redistribute it and/or
00642    modify it under the terms of the GNU Lesser General Public
00643    License as published by the Free Software Foundation; either
00644    version 2.1 of the License, or (at your option) any later version.
00645 
00646    This library is distributed in the hope that it will be useful,
00647    but WITHOUT ANY WARRANTY; without even the implied warranty of
00648    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00649    Lesser General Public License for more details.
00650 
00651    You should have received a copy of the GNU Lesser General Public
00652    License along with this library; if not, write to the Free Software
00653    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00654 */
00655 
00656 #undef GAN_VECTYPE
00657 #undef GAN_VECTOR_TYPE
00658 #undef GAN_VEC_ELEMENT_TYPE
00659 #undef GAN_REALTYPE
00660 #undef GAN_VEC_FPRINT
00661 #undef GAN_VEC_PRINT
00662 #undef GAN_VEC_FSCANF
00663 #undef GAN_VEC_FWRITE
00664 #undef GAN_VEC_FREAD
00665 #undef GAN_VEC_ZERO_Q
00666 #undef GAN_VEC_ZERO_S
00667 #undef GAN_VEC_COPY_Q
00668 #undef GAN_VEC_COPY_S
00669 #undef GAN_VEC_SCALE_Q
00670 #undef GAN_VEC_SCALE_S
00671 #undef GAN_VEC_SCALE_I
00672 #undef GAN_VEC_DIVIDE_Q
00673 #undef GAN_VEC_DIVIDE_S
00674 #undef GAN_VEC_DIVIDE_I
00675 #undef GAN_VEC_NEGATE_Q
00676 #undef GAN_VEC_NEGATE_S
00677 #undef GAN_VEC_NEGATE_I
00678 #undef GAN_VEC_UNIT_Q
00679 #undef GAN_VEC_UNIT_S
00680 #undef GAN_VEC_UNIT_I
00681 #undef GAN_VEC_ADD_Q
00682 #undef GAN_VEC_ADD_I1
00683 #undef GAN_VEC_ADD_I2
00684 #undef GAN_VEC_INCREMENT
00685 #undef GAN_VEC_ADD_S
00686 #undef GAN_VEC_SUB_Q
00687 #undef GAN_VEC_SUB_I1
00688 #undef GAN_VEC_SUB_I2
00689 #undef GAN_VEC_DECREMENT
00690 #undef GAN_VEC_SUB_S
00691 #undef GAN_VEC_DOT_Q
00692 #undef GAN_VEC_DOT_S
00693 #undef GAN_VEC_SQRLEN_Q
00694 #undef GAN_VEC_SQRLEN_S
00695 #undef GAN_VEC_FROM_VEC_Q
00696 #undef GAN_VEC_FROM_VEC_S
00697 
00710 #ifdef __cplusplus
00711 }
00712 #endif
00713 
00714 #endif /* #ifndef _GAN_4VECTORF_H */

Generated on Mon Oct 13 16:14:31 2003 by doxygen1.3-rc1