Main Page   Modules   Compound List   File List   Compound Members   File Members  

2vectorf.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_2VECTORF_H
00030 #define _GAN_2VECTORF_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_REPEAT2_H
00064 #define _GAN_REPEAT2_H
00065 
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069 
00070 /* macros for constructing two-fold repetitions */
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 /* #ifndef _GAN_REPEAT2_H */
00108 
00121 /* This library is free software; you can redistribute it and/or
00122    modify it under the terms of the GNU Lesser General Public
00123    License as published by the Free Software Foundation; either
00124    version 2.1 of the License, or (at your option) any later version.
00125 
00126    This library is distributed in the hope that it will be useful,
00127    but WITHOUT ANY WARRANTY; without even the implied warranty of
00128    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00129    Lesser General Public License for more details.
00130 
00131    You should have received a copy of the GNU Lesser General Public
00132    License along with this library; if not, write to the Free Software
00133    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 /* macros for testing the types of pointer arguments and then applying an
00144  * operation to them */
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 /* #ifndef _GAN_MATVECF_MACROS_H */
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 
00191 /* declare functions specific to 2-vectors */
00205 /* This library is free software; you can redistribute it and/or
00206    modify it under the terms of the GNU Lesser General Public
00207    License as published by the Free Software Foundation; either
00208    version 2.1 of the License, or (at your option) any later version.
00209 
00210    This library is distributed in the hope that it will be useful,
00211    but WITHOUT ANY WARRANTY; without even the implied warranty of
00212    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00213    Lesser General Public License for more details.
00214 
00215    You should have received a copy of the GNU Lesser General Public
00216    License along with this library; if not, write to the Free Software
00217    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00218 */
00219 
00234 Gan_Vector2_f *gan_vec2f_fill_q ( Gan_Vector2_f *p, float X, float Y );
00235 
00241 #define GAN_VECTYPE Gan_Vector2_f
00242 #define GAN_VECTOR_TYPE Gan_Vector_f
00243 #define GAN_VEC_ELEMENT_TYPE GAN_FLOAT
00244 #define GAN_REALTYPE float
00245 #define GAN_VEC_FPRINT     gan_vec2f_fprint
00246 #define GAN_VEC_PRINT      gan_vec2f_print
00247 #define GAN_VEC_FSCANF     gan_vec2f_fscanf
00248 #define GAN_VEC_FWRITE     gan_vec2f_fwrite
00249 #define GAN_VEC_FREAD      gan_vec2f_fread
00250 #define GAN_VEC_ZERO_Q     gan_vec2f_zero_q
00251 #define GAN_VEC_ZERO_S     gan_vec2f_zero_s
00252 #define GAN_VEC_COPY_Q     gan_vec2f_copy_q
00253 #define GAN_VEC_COPY_S     gan_vec2f_copy_s
00254 #define GAN_VEC_SCALE_Q    gan_vec2f_scale_q
00255 #define GAN_VEC_SCALE_S    gan_vec2f_scale_s
00256 #define GAN_VEC_SCALE_I    gan_vec2f_scale_i
00257 #define GAN_VEC_DIVIDE_Q   gan_vec2f_divide_q
00258 #define GAN_VEC_DIVIDE_S   gan_vec2f_divide_s
00259 #define GAN_VEC_DIVIDE_I   gan_vec2f_divide_i
00260 #define GAN_VEC_NEGATE_Q   gan_vec2f_negate_q
00261 #define GAN_VEC_NEGATE_S   gan_vec2f_negate_s
00262 #define GAN_VEC_NEGATE_I   gan_vec2f_negate_i
00263 #define GAN_VEC_UNIT_Q     gan_vec2f_unit_q
00264 #define GAN_VEC_UNIT_S     gan_vec2f_unit_s
00265 #define GAN_VEC_UNIT_I     gan_vec2f_unit_i
00266 #define GAN_VEC_ADD_Q      gan_vec2f_add_q
00267 #define GAN_VEC_ADD_I1     gan_vec2f_add_i1
00268 #define GAN_VEC_ADD_I2     gan_vec2f_add_i2
00269 #define GAN_VEC_INCREMENT  gan_vec2f_increment
00270 #define GAN_VEC_ADD_S      gan_vec2f_add_s
00271 #define GAN_VEC_SUB_Q      gan_vec2f_sub_q
00272 #define GAN_VEC_SUB_I1     gan_vec2f_sub_i1
00273 #define GAN_VEC_SUB_I2     gan_vec2f_sub_i2
00274 #define GAN_VEC_DECREMENT  gan_vec2f_decrement
00275 #define GAN_VEC_SUB_S      gan_vec2f_sub_s
00276 #define GAN_VEC_DOT_Q      gan_vec2f_dot_q
00277 #define GAN_VEC_DOT_S      gan_vec2f_dot_s
00278 #define GAN_VEC_SQRLEN_Q   gan_vec2f_sqrlen_q
00279 #define GAN_VEC_SQRLEN_S   gan_vec2f_sqrlen_s
00280 #define GAN_VEC_FROM_VEC_Q gan_vec2f_from_vecf_q
00281 #define GAN_VEC_FROM_VEC_S gan_vec2f_from_vecf_s
00282 
00296 /* This library is free software; you can redistribute it and/or
00297    modify it under the terms of the GNU Lesser General Public
00298    License as published by the Free Software Foundation; either
00299    version 2.1 of the License, or (at your option) any later version.
00300 
00301    This library is distributed in the hope that it will be useful,
00302    but WITHOUT ANY WARRANTY; without even the implied warranty of
00303    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00304    Lesser General Public License for more details.
00305 
00306    You should have received a copy of the GNU Lesser General Public
00307    License along with this library; if not, write to the Free Software
00308    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00309 */
00310 
00311 /* function declarations for functions common to all small vector types */
00312 
00313 
00314 /* documentation for macros defined in individual header files */
00315 
00326 Gan_Vector2_f *gan_vec2f_zero_q ( Gan_Vector2_f *p );
00327 
00342 Gan_Vector2_f *gan_vec2f_copy_q ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00343 
00359 Gan_Vector2_f *gan_vec2f_scale_q ( Gan_Vector2_f *p, float a,
00360                                Gan_Vector2_f *q );
00361 
00367 Gan_Vector2_f *gan_vec2f_scale_i ( Gan_Vector2_f *p, float a );
00368 
00375 Gan_Vector2_f *gan_vec2f_divide_q ( Gan_Vector2_f *p, float a,
00376                                 Gan_Vector2_f *q );
00377 
00383 Gan_Vector2_f *gan_vec2f_divide_i ( Gan_Vector2_f *p, float a );
00384 
00392 Gan_Vector2_f *gan_vec2f_negate_q ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00393 
00401 Gan_Vector2_f *gan_vec2f_negate_i ( Gan_Vector2_f *p );
00402 
00408 Gan_Vector2_f *gan_vec2f_unit_i ( Gan_Vector2_f *p );
00409 
00427 Gan_Vector2_f *gan_vec2f_add_q ( Gan_Vector2_f *p, Gan_Vector2_f *q, Gan_Vector2_f *r );
00428 
00437 Gan_Vector2_f *gan_vec2f_add_i1 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00438 
00447 Gan_Vector2_f *gan_vec2f_add_i2 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00448 
00457 Gan_Vector2_f *gan_vec2f_increment ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00458 
00476 Gan_Vector2_f *gan_vec2f_sub_q ( Gan_Vector2_f *p, Gan_Vector2_f *q, Gan_Vector2_f *r );
00477 
00486 Gan_Vector2_f *gan_vec2f_sub_i1 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00487 
00496 Gan_Vector2_f *gan_vec2f_sub_i2 ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00497 
00506 Gan_Vector2_f *gan_vec2f_decrement ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00507 
00523 float gan_vec2f_dot_q ( Gan_Vector2_f *p, Gan_Vector2_f *q );
00524 
00542 float gan_vec2f_sqrlen_q ( Gan_Vector2_f *p );
00543 
00561 Gan_Vector2_f gan_vec2f_from_vecf_s ( Gan_Vector_f *x );
00562 
00580 /* This library is free software; you can redistribute it and/or
00581    modify it under the terms of the GNU Lesser General Public
00582    License as published by the Free Software Foundation; either
00583    version 2.1 of the License, or (at your option) any later version.
00584 
00585    This library is distributed in the hope that it will be useful,
00586    but WITHOUT ANY WARRANTY; without even the implied warranty of
00587    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00588    Lesser General Public License for more details.
00589 
00590    You should have received a copy of the GNU Lesser General Public
00591    License along with this library; if not, write to the Free Software
00592    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00593 */
00594 
00595 #undef GAN_VECTYPE
00596 #undef GAN_VECTOR_TYPE
00597 #undef GAN_VEC_ELEMENT_TYPE
00598 #undef GAN_REALTYPE
00599 #undef GAN_VEC_FPRINT
00600 #undef GAN_VEC_PRINT
00601 #undef GAN_VEC_FSCANF
00602 #undef GAN_VEC_FWRITE
00603 #undef GAN_VEC_FREAD
00604 #undef GAN_VEC_ZERO_Q
00605 #undef GAN_VEC_ZERO_S
00606 #undef GAN_VEC_COPY_Q
00607 #undef GAN_VEC_COPY_S
00608 #undef GAN_VEC_SCALE_Q
00609 #undef GAN_VEC_SCALE_S
00610 #undef GAN_VEC_SCALE_I
00611 #undef GAN_VEC_DIVIDE_Q
00612 #undef GAN_VEC_DIVIDE_S
00613 #undef GAN_VEC_DIVIDE_I
00614 #undef GAN_VEC_NEGATE_Q
00615 #undef GAN_VEC_NEGATE_S
00616 #undef GAN_VEC_NEGATE_I
00617 #undef GAN_VEC_UNIT_Q
00618 #undef GAN_VEC_UNIT_S
00619 #undef GAN_VEC_UNIT_I
00620 #undef GAN_VEC_ADD_Q
00621 #undef GAN_VEC_ADD_I1
00622 #undef GAN_VEC_ADD_I2
00623 #undef GAN_VEC_INCREMENT
00624 #undef GAN_VEC_ADD_S
00625 #undef GAN_VEC_SUB_Q
00626 #undef GAN_VEC_SUB_I1
00627 #undef GAN_VEC_SUB_I2
00628 #undef GAN_VEC_DECREMENT
00629 #undef GAN_VEC_SUB_S
00630 #undef GAN_VEC_DOT_Q
00631 #undef GAN_VEC_DOT_S
00632 #undef GAN_VEC_SQRLEN_Q
00633 #undef GAN_VEC_SQRLEN_S
00634 #undef GAN_VEC_FROM_VEC_Q
00635 #undef GAN_VEC_FROM_VEC_S
00636 
00649 #ifdef __cplusplus
00650 }
00651 #endif
00652 
00653 #endif /* #ifndef _GAN_2VECTORF_H */

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