00001
00032 #ifndef _VEL_H_
00033 #define _VEL_H_
00034
00035 #include <mc/mc_base.h>
00036
00037
00038
00039
00040
00041
00042
00045 #define MASK_00000000000000000000000000000000 000000000000
00046
00048 #define MASK_00000000000000000000000000000011 000000000003
00049
00051 #define MASK_00000000000000000000000000001100 000000000014
00052
00054 #define MASK_00000000000000000000000000110000 000000000060
00055
00057 #define MASK_00000000000000000011111111000000 000000037700
00058
00060 #define MASK_11111111111111111100000000000000 007777740000
00061
00064 #define MASK_11111111111111111111111111111111 ~000000000000
00065
00067 #define MASK_11111111111111111111111111111100 ~000000000003
00068
00070 #define MASK_11111111111111111111111111110011 ~000000000014
00071
00073 #define MASK_11111111111111111111111111001111 ~000000000060
00074
00076 #define MASK_11111111111111111100000000111111 ~000000037700
00077
00079 #define MASK_00000000000000000011111111111111 ~007777740000
00080
00081
00084 #define MASK_00000000000000000000000000000111 000000000007
00085
00087 #define MASK_00000000000000000000000000111000 000000000070
00088
00090 #define MASK_00000000000000000000000111000000 000000000700
00091
00093 #define MASK_00000000000000000000111000000000 000000007000
00094
00096 #define MASK_00000000000000000111000000000000 000000070000
00097
00099 #define MASK_00000000000000111000000000000000 000000700000
00100
00102 #define MASK_00000000000001000000000000000000 000001000000
00103
00105 #define MASK_00000000000010000000000000000000 000002000000
00106
00109 #define MASK_11111111111111111111111111111000 ~000000000007
00110
00112 #define MASK_11111111111111111111111111000111 ~000000000070
00113
00115 #define MASK_11111111111111111111111000111111 ~000000000700
00116
00118 #define MASK_11111111111111111111000111111111 ~000000007000
00119
00121 #define MASK_11111111111111111000111111111111 ~000000070000
00122
00124 #define MASK_11111111111111000111111111111111 ~000000700000
00125
00127 #define MASK_11111111111110111111111111111111 ~000001000000
00128
00130 #define MASK_11111111111101111111111111111111 ~000002000000
00131
00132
00133
00136 #define MASK_00000000000000000000000011111111 000000000377
00137
00139 #define MASK_00000000000000001111111100000000 000000177400
00140
00142 #define MASK_00000000111111110000000000000000 000077600000
00143
00145 #define MASK_11111111000000000000000000000000 037700000000
00146
00149 #define MASK_11111111111111111111111100000000 ~000000000377
00150
00152 #define MASK_11111111111111110000000011111111 ~000000177400
00153
00155 #define MASK_11111111000000001111111111111111 ~000077600000
00156
00158 #define MASK_00000000111111111111111111111111 ~037700000000
00159
00160
00166 typedef struct Gip {
00195 unsigned int bits;
00197 unsigned int uid;
00198 } Gip;
00199
00205 typedef struct Vip {
00207 double x[3];
00209 void *ePtr;
00211 void *sPtr;
00213 void *eParent;
00214 } Vip;
00215
00221 typedef struct Eip {
00223 void *vPtr[2];
00225 void *ePtr[2];
00227 void *midPtr;
00229 void *eParent;
00230 } Eip;
00231
00237 typedef struct Fip {
00239 int gID;
00241 void *sPtr;
00243 unsigned int rhist;
00245 unsigned int rlevel;
00246 } Fip;
00247
00253 typedef struct Sip {
00255 void *vPtr[4];
00257 void *sPtr[4];
00259 void *fPtr[4];
00260 #if defined(VG_ELEMENT)
00261
00262 int fNum[4];
00264 int eNum[6];
00265 #endif
00266
00281 unsigned int tags;
00289 unsigned int faces;
00290 } Sip;
00291
00298 typedef union VES {
00300 Vip v;
00302 Eip e;
00304 Sip s;
00305 } VES;
00306
00307
00308
00309
00310
00311
00312
00314 const int vmapE[4][4];
00316 const int vmapEI[6][2];
00318 const int vmapV[6][4];
00320 const int vmapF[4][3];
00322 const int vmapFE[4][3];
00324 const int vmapOV1[4][4][4];
00326 const int vmapOV2[2][4][4];
00328 const int vmapOV3[4][3];
00330 const int vmapOE[4][3];
00331
00337 typedef struct Vel {
00338 Gip g;
00339 VES d;
00340 } Vel;
00341
00342
00343
00344
00345
00346
00347
00348 #if !defined(VINLINE_GEM)
00349
00359 void Vel_init(Vel *thee, int tdim, int tid);
00360
00369 void Vel_reinit(Vel *thee);
00370
00380 void Vel_setReality(Vel *thee, int reel);
00381
00391 void Vel_setDim(Vel *thee, int dim);
00392
00402 void Vel_setClass(Vel *thee, int clas);
00403
00413 void Vel_setType(Vel *thee, int type);
00414
00424 void Vel_setChart(Vel *thee, int chart);
00425
00435 void Vel_setId(Vel *thee, int id);
00436
00445 unsigned int Vel_reality(Vel *thee);
00446
00455 unsigned int Vel_dim(Vel *thee);
00456
00465 unsigned int Vel_dimVV(Vel *thee);
00466
00475 unsigned int Vel_dimEE(Vel *thee);
00476
00485 unsigned int Vel_dimFF(Vel *thee);
00486
00495 unsigned int Vel_class(Vel *thee);
00496
00505 unsigned int Vel_type(Vel *thee);
00506
00515 unsigned int Vel_chart(Vel *thee);
00516
00525 unsigned int Vel_id(Vel *thee);
00526 #else
00527
00537 # define Vel_init(thee,tdim,tid) ( \
00538 (thee)->g.bits = MASK_00000000000000000000000000000000, \
00539 (thee)->g.uid = MASK_00000000000000000000000000000000, \
00540 Vel_setDim((thee),(tdim)), \
00541 Vel_setId((thee),(tid)) \
00542 )
00543
00552 # define Vel_reinit(thee) ( \
00553 (thee)->g.bits &= MASK_11111111111111111100000000111111, \
00554 (thee)->g.uid &= MASK_11111111111111111111111111111111 \
00555 )
00556
00566 # define Vel_setReality(thee,reel) ( \
00567 (thee)->g.bits &= MASK_11111111111111111111111111111100, \
00568 (thee)->g.bits |= (reel) \
00569 )
00570
00580 # define Vel_setDim(thee,dim) ( \
00581 (thee)->g.bits &= MASK_11111111111111111111111111110011, \
00582 (thee)->g.bits |= ((dim) << 2) \
00583 )
00584
00594 # define Vel_setClass(thee,clas) ( \
00595 (thee)->g.bits &= MASK_11111111111111111111111111001111, \
00596 (thee)->g.bits |= ((clas) << 4) \
00597 )
00598
00608 # define Vel_setType(thee,type) ( \
00609 (thee)->g.bits &= MASK_11111111111111111100000000111111, \
00610 (thee)->g.bits |= ((type) << 6) \
00611 )
00612
00622 # define Vel_setChart(thee,chart) ( \
00623 (thee)->g.bits &= MASK_00000000000000000011111111111111, \
00624 (thee)->g.bits |= ((chart) << 14) \
00625 )
00626
00636 # define Vel_setId(thee,id) ((thee)->g.uid = (id))
00637
00646 # define Vel_reality(thee) ( \
00647 ((thee)->g.bits & MASK_00000000000000000000000000000011) \
00648 )
00649
00658 # define Vel_dim(thee) ( \
00659 ((thee)->g.bits & MASK_00000000000000000000000000001100) >> 2 \
00660 )
00661
00670 # define Vel_dimVV(thee) ( \
00671 Vel_dim((thee))+1 \
00672 )
00673
00682 # define Vel_dimEE(thee) ( \
00683 3*(Vel_dim((thee))-1) \
00684 )
00685
00694 # define Vel_dimFF(thee) ( \
00695 Vel_dim((thee))+1 \
00696 )
00697
00706 # define Vel_class(thee) ( \
00707 ((thee)->g.bits & MASK_00000000000000000000000000110000) >> 4 \
00708 )
00709
00718 # define Vel_type(thee) ( \
00719 ((thee)->g.bits & MASK_00000000000000000011111111000000) >> 6 \
00720 )
00721
00730 # define Vel_chart(thee) ( \
00731 ((thee)->g.bits & MASK_11111111111111111100000000000000) >> 14 \
00732 )
00733
00742 # define Vel_id(thee) ((thee)->g.uid)
00743 #endif
00744
00745
00755 Vel* Vel_ctor(int dim, int id);
00756
00765 void Vel_dtor(Vel **thee);
00766
00767 #endif
00768