gCAD3D 2.40
msh2d.h
Go to the documentation of this file.
1 // ../ut/msh2d.h
2 // prereq:
3 // ../ut/ut_memTab.h
4 // ../ut/ut_itmsh.h
5 
6 
7 typedef struct {
8  MemTab tab; // IndTab boundaries, tesselated patches
9  MemTab ipa; // int index to points
10  MemTab pa2; // Point2 2D-points
11  MemTab pa3; // Point 3D-points
12  MemTab vc3; // Vec3f normalVectors
13  MemTab fac; // Fac3 indexed faces
14  MemTab fnb; // Fac3 neighbour-faces
16  double tol;
17  } TessStru;
18 
19 #ifdef _MSC_VER
20 #define MSH2D_STRU(mshs)\
21  TessStru (mshs);\
22  (mshs).tab = *((MemTab_IndTab*)&MEMTAB_NUL);\
23  (mshs).ipa = *((MemTab_int*)&MEMTAB_NUL);\
24  (mshs).pa2 = *((MemTab_Point2*)&MEMTAB_NUL);\
25  (mshs).pa3 = *((MemTab_Point*)&MEMTAB_NUL);\
26  (mshs).vc3 = *((MemTab_Vec3f*)&MEMTAB_NUL);\
27  (mshs).fac = *((MemTab_Fac3*)&MEMTAB_NUL);\
28  (mshs).fnb = *((MemTab_Fac3*)&MEMTAB_NUL);
29 
30 
31 #else
32  // C99
33 #define MSH2D_STRU(mshs)\
34  TessStru (mshs) = {\
35  .tab = _MEMTAB_NUL,\
36  .ipa = _MEMTAB_NUL,\
37  .pa2 = _MEMTAB_NUL,\
38  .pa3 = _MEMTAB_NUL,\
39  .vc3 = _MEMTAB_NUL,\
40  .fac = _MEMTAB_NUL,\
41  .fnb = _MEMTAB_NUL,\
42  .gbx = _GRIDBOX_NUL\
43  };
44 #endif
45 
46 
47 // get nr of quads (ix * iy; 0 is first)
48 #define MSH2D_quadNr()\
49  (MSH2D_qbx.ix * MSH2D_qbx.iy)
50 
51 // get quad-index (itx + (ity * MSH2D_qbx.ix)
52 #define MSH2D_quadInd(itx,ity)\
53  itx + (ity * MSH2D_qbx.ix)
54 
55 
56 // get itx=col-index, dx=dist-horiz
57 void MSH2D_quadX (int *itx, double *dx, Point2 *ptx);
58 #define MSH2D_quadX(itx,dpx,ptx){\
59  *(itx) = (ptx->x + MSH2D_tol - MSH2D_qbx.pMin.x) / MSH2D_qbx.dx;\
60  *(dpx) = (*(itx) * MSH2D_qbx.dx) - (ptx->x - MSH2D_qbx.pMin.x);}
61 
62 
63 // get ity=row-index, dy=dist-vert
64 void MSH2D_quadY (int *ity, double *dy, Point2 *ptx);
65 #define MSH2D_quadY(ity,dpy,ptx){\
66  *(ity) = (ptx->y + MSH2D_tol - MSH2D_qbx.pMin.y) / MSH2D_qbx.dy;\
67  *(dpy) = (*(ity) * MSH2D_qbx.dy) - (ptx->y - MSH2D_qbx.pMin.y);}
68  // DMOD (ity, (dy), ptx->y, MSH2D_ts->gbx.dy)
69 
70 
71 // get quadNr of left-quad of quad iqx; -1 = iqx is on left boundary; invalid.
72 int MSH2D_quadLeft (int iqx, int itx);
73 #define MSH2D_quadLeft(iqx,itx)\
74  ((itx) == 0 ? -1 : iqx - 1)
75 
76 
77 // get quadNr of left-quad of quad iqx; -1 = iqx is on left boundary; invalid.
78 int MSH2D_quadBelow (int iqx);
79 #define MSH2D_quadBelow(iqx)\
80  (iqx - MSH2D_qbx.ix)
81 
82 #define MSH2D_IS_PLANAR MSH2D_qbx.ix == 0
83 
84 // MSH2D_pst_set set MSH2D_psta (grid-point-status)
85 #define MSH2D_pst_set(ipgb,mode){\
86  ((char*)MSH2D_mpst.data)[ipgb - MSH2D_pgb_ips] = mode;}
87 #define MSH2D_pgst_set(ipgb,mode){\
88  ((char*)MSH2D_mpst.data)[ipgb] = mode;}
89 
90 
91 // EOF
MemTab(STP_MDL)
Definition: stp_r.c:493
#define MSH2D_quadLeft(iqx, itx)
Definition: msh2d.h:73
Definition: tst_mshig.c:141
MemTab fac
Definition: msh2d.h:13
MemTab fnb
Definition: msh2d.h:14
MemTab vc3
Definition: msh2d.h:12
MemTab tab
Definition: msh2d.h:8
double tol
Definition: msh2d.h:16
GridBox gbx
Definition: msh2d.h:15
#define MSH2D_quadY(ity, dpy, ptx)
Definition: msh2d.h:65
2D-point, Typ_PT2
Definition: ut_geo.h:190
MemTab pa3
Definition: msh2d.h:11
#define MSH2D_quadBelow(iqx)
Definition: msh2d.h:79
MemTab pa2
Definition: msh2d.h:10
Typ_GridBox _GRIDBOX_NUL.
Definition: ut_geo.h:1023
#define MSH2D_quadX(itx, dpx, ptx)
Definition: msh2d.h:58
MemTab ipa
Definition: msh2d.h:9