00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef NMG_H
00055 #define NMG_H seen
00056
00057 #include "common.h"
00058
00059
00060
00061 #ifndef MACHINE_H
00062 #include "machine.h"
00063 #endif
00064
00065 #ifndef VMATH_H
00066 #include "vmath.h"
00067 #endif
00068
00069 #ifndef SEEN_RTLIST_H
00070 #include "rtlist.h"
00071 #endif
00072
00073 #ifndef SEEN_COMPAT4_H
00074 #include "compat4.h"
00075 #endif
00076
00077 #ifndef SEEN_BU_H
00078 #include "bu.h"
00079 #endif
00080
00081 #ifndef NULL
00082 #define NULL 0
00083 #endif
00084
00085 #define NMG_EXTERN(type_and_name,args) RT_EXTERN(type_and_name,args)
00086
00087
00088 #define DEBUG_PL_ANIM 0x00000001
00089 #define DEBUG_PL_SLOW 0x00000002
00090 #define DEBUG_GRAPHCL 0x00000004
00091 #define DEBUG_PL_LOOP 0x00000008
00092 #define DEBUG_PLOTEM 0x00000010
00093 #define DEBUG_POLYSECT 0x00000020
00094 #define DEBUG_VERIFY 0x00000040
00095 #define DEBUG_BOOL 0x00000080
00096 #define DEBUG_CLASSIFY 0x00000100
00097 #define DEBUG_BOOLEVAL 0x00000200
00098 #define DEBUG_BASIC 0x00000400
00099 #define DEBUG_MESH 0x00000800
00100 #define DEBUG_MESH_EU 0x00001000
00101 #define DEBUG_POLYTO 0x00002000
00102 #define DEBUG_LABEL_PTS 0x00004000
00103
00104 #define DEBUG_NMGRT 0x00010000
00105 #define DEBUG_FINDEU 0x00020000
00106 #define DEBUG_CMFACE 0x00040000
00107 #define DEBUG_CUTLOOP 0x00080000
00108 #define DEBUG_VU_SORT 0x00100000
00109 #define DEBUG_FCUT 0x00200000
00110 #define DEBUG_RT_SEGS 0x00400000
00111 #define DEBUG_RT_ISECT 0x00800000
00112 #define DEBUG_TRI 0x01000000
00113 #define DEBUG_PT_FU 0x02000000
00114 #define DEBUG_MANIF 0x04000000
00115 #define NMG_DEBUG_FORMAT \
00116 "\020\033MANIF\032PTFU\031TRIANG\030RT_ISECT\
00117 \027RT_SEGS\026FCUT\025VU_SORT\024CUTLOOP\023CMFACE\022FINDEU\021RT_ISECT\020(FREE)\
00118 \017LABEL_PTS\016POLYTO\015MESH_EU\014MESH\013BASIC\012BOOLEVAL\011CLASSIFY\
00119 \010BOOL\7VERIFY\6POLYSECT\5PLOTEM\4PL_LOOP\3GRAPHCL\2PL_SLOW\1PL_ANIM"
00120
00121
00122
00123
00124
00125
00126
00127
00128 #if USE_PROTOTYPES
00129 # define NMG_ARGS(args) args
00130 #else
00131 # define NMG_ARGS(args) ()
00132 #endif
00133
00134
00135 #define NMG_BOOL_SUB 1
00136 #define NMG_BOOL_ADD 2
00137 #define NMG_BOOL_ISECT 4
00138
00139
00140 #define NMG_CLASS_Unknown -1
00141 #define NMG_CLASS_AinB 0
00142 #define NMG_CLASS_AonBshared 1
00143 #define NMG_CLASS_AonBanti 2
00144 #define NMG_CLASS_AoutB 3
00145 #define NMG_CLASS_BinA 4
00146 #define NMG_CLASS_BonAshared 5
00147 #define NMG_CLASS_BonAanti 6
00148 #define NMG_CLASS_BoutA 7
00149
00150
00151 #define OT_NONE 0
00152 #define OT_SAME 1
00153 #define OT_OPPOSITE 2
00154 #define OT_UNSPEC 3
00155 #define OT_BOOLPLACE 4
00156
00157
00158
00159
00160 #define NMG_MODEL_MAGIC 0x12121212
00161 #define NMG_REGION_MAGIC 0x23232323
00162 #define NMG_REGION_A_MAGIC 0x696e6720
00163 #define NMG_SHELL_MAGIC 0x71077345
00164 #define NMG_SHELL_A_MAGIC 0x65207761
00165 #define NMG_FACE_MAGIC 0x45454545
00166 #define NMG_FACE_G_PLANE_MAGIC 0x726b6e65
00167 #define NMG_FACE_G_SNURB_MAGIC 0x736e7262
00168 #define NMG_FACEUSE_MAGIC 0x56565656
00169 #define NMG_LOOP_MAGIC 0x67676767
00170 #define NMG_LOOP_G_MAGIC 0x6420224c
00171 #define NMG_LOOPUSE_MAGIC 0x78787878
00172 #define NMG_EDGE_MAGIC 0x33333333
00173 #define NMG_EDGE_G_LSEG_MAGIC 0x6c696768
00174 #define NMG_EDGE_G_CNURB_MAGIC 0x636e7262
00175 #define NMG_EDGEUSE_MAGIC 0x90909090
00176 #define NMG_EDGEUSE2_MAGIC 0x91919191
00177 #define NMG_VERTEX_MAGIC 0x00123123
00178 #define NMG_VERTEX_G_MAGIC 0x72737707
00179 #define NMG_VERTEXUSE_MAGIC 0x12341234
00180 #define NMG_VERTEXUSE_A_PLANE_MAGIC 0x69676874
00181 #define NMG_VERTEXUSE_A_CNURB_MAGIC 0x20416e64
00182 #define NMG_KNOT_VECTOR_MAGIC 0x6b6e6f74
00183
00184
00185
00186
00187 #define NMG_CKMAG(_ptr, _magic, _str) BU_CKMAG(_ptr,_magic,_str)
00188 #define NMG_CK2MAG(_ptr, _magic1, _magic2, _str) \
00189 if( !(_ptr) || (*((long *)(_ptr)) != (_magic1) && *((long *)(_ptr)) != (_magic2) ) ) { \
00190 bu_badmagic( (long *)(_ptr), _magic1, _str, __FILE__, __LINE__ ); \
00191 }
00192
00193 #define NMG_CK_MODEL(_p) NMG_CKMAG(_p, NMG_MODEL_MAGIC, "model")
00194 #define NMG_CK_REGION(_p) NMG_CKMAG(_p, NMG_REGION_MAGIC, "region")
00195 #define NMG_CK_REGION_A(_p) NMG_CKMAG(_p, NMG_REGION_A_MAGIC, "region_a")
00196 #define NMG_CK_SHELL(_p) NMG_CKMAG(_p, NMG_SHELL_MAGIC, "shell")
00197 #define NMG_CK_SHELL_A(_p) NMG_CKMAG(_p, NMG_SHELL_A_MAGIC, "shell_a")
00198 #define NMG_CK_FACE(_p) NMG_CKMAG(_p, NMG_FACE_MAGIC, "face")
00199 #define NMG_CK_FACE_G_PLANE(_p) NMG_CKMAG(_p, NMG_FACE_G_PLANE_MAGIC, "face_g_plane")
00200 #define NMG_CK_FACE_G_SNURB(_p) NMG_CKMAG(_p, NMG_FACE_G_SNURB_MAGIC, "face_g_snurb")
00201 #define NMG_CK_FACE_G_EITHER(_p) NMG_CK2MAG(_p, NMG_FACE_G_PLANE_MAGIC, NMG_FACE_G_SNURB_MAGIC, "face_g_plane|face_g_snurb")
00202 #define NMG_CK_FACEUSE(_p) NMG_CKMAG(_p, NMG_FACEUSE_MAGIC, "faceuse")
00203 #define NMG_CK_LOOP(_p) NMG_CKMAG(_p, NMG_LOOP_MAGIC, "loop")
00204 #define NMG_CK_LOOP_G(_p) NMG_CKMAG(_p, NMG_LOOP_G_MAGIC, "loop_g")
00205 #define NMG_CK_LOOPUSE(_p) NMG_CKMAG(_p, NMG_LOOPUSE_MAGIC, "loopuse")
00206 #define NMG_CK_EDGE(_p) NMG_CKMAG(_p, NMG_EDGE_MAGIC, "edge")
00207 #define NMG_CK_EDGE_G_LSEG(_p) NMG_CKMAG(_p, NMG_EDGE_G_LSEG_MAGIC, "edge_g_lseg")
00208 #define NMG_CK_EDGE_G_CNURB(_p) NMG_CKMAG(_p, NMG_EDGE_G_CNURB_MAGIC, "edge_g_cnurb")
00209 #define NMG_CK_EDGE_G_EITHER(_p) NMG_CK2MAG(_p, NMG_EDGE_G_LSEG_MAGIC, NMG_EDGE_G_CNURB_MAGIC, "edge_g_lseg|edge_g_cnurb")
00210 #define NMG_CK_EDGEUSE(_p) NMG_CKMAG(_p, NMG_EDGEUSE_MAGIC, "edgeuse")
00211 #define NMG_CK_VERTEX(_p) NMG_CKMAG(_p, NMG_VERTEX_MAGIC, "vertex")
00212 #define NMG_CK_VERTEX_G(_p) NMG_CKMAG(_p, NMG_VERTEX_G_MAGIC, "vertex_g")
00213 #define NMG_CK_VERTEXUSE(_p) NMG_CKMAG(_p, NMG_VERTEXUSE_MAGIC, "vertexuse")
00214 #define NMG_CK_VERTEXUSE_A_PLANE(_p) NMG_CKMAG(_p, NMG_VERTEXUSE_A_PLANE_MAGIC, "vertexuse_a_plane")
00215 #define NMG_CK_VERTEXUSE_A_CNURB(_p) NMG_CKMAG(_p, NMG_VERTEXUSE_A_CNURB_MAGIC, "vertexuse_a_cnurb")
00216 #define NMG_CK_VERTEXUSE_A_EITHER(_p) NMG_CK2MAG(_p, NMG_VERTEXUSE_A_PLANE_MAGIC, NMG_VERTEXUSE_A_CNURB_MAGIC, "vertexuse_a_plane|vertexuse_a_cnurb")
00217 #define NMG_CK_LIST(_p) BU_CKMAG(_p, BU_LIST_HEAD_MAGIC, "bu_list")
00218
00219
00220 #define NMG_TEST_EDGEUSE(_p) \
00221 if (!(_p)->l.forw || !(_p)->l.back || !(_p)->eumate_p || \
00222 !(_p)->radial_p || !(_p)->e_p || !(_p)->vu_p || \
00223 !(_p)->up.magic_p ) { \
00224 bu_log("in %s at %d Bad edgeuse member pointer\n",\
00225 __FILE__, __LINE__); nmg_pr_eu(_p, (char *)NULL); \
00226 rt_bomb("Null pointer\n"); \
00227 } else if ((_p)->vu_p->up.eu_p != (_p) || \
00228 (_p)->eumate_p->vu_p->up.eu_p != (_p)->eumate_p) {\
00229 bu_log("in %s at %d edgeuse lost vertexuse\n",\
00230 __FILE__, __LINE__); rt_bomb("bye");}
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 struct knot_vector {
00241 int magic;
00242 int k_size;
00243 fastf_t * knots;
00244 };
00245 #define RT_KNOT_VECTOR_MAGIC NMG_KNOT_VECTOR_MAGIC
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269 struct model {
00270 long magic;
00271 struct bu_list r_hd;
00272 long index;
00273 long maxindex;
00274 };
00275
00276
00277
00278
00279 struct nmgregion {
00280 struct bu_list l;
00281 struct model *m_p;
00282 struct nmgregion_a *ra_p;
00283 struct bu_list s_hd;
00284 long index;
00285 };
00286
00287 struct nmgregion_a {
00288 long magic;
00289 point_t min_pt;
00290 point_t max_pt;
00291 long index;
00292 };
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 struct shell {
00313 struct bu_list l;
00314 struct nmgregion *r_p;
00315 struct shell_a *sa_p;
00316
00317 struct bu_list fu_hd;
00318 struct bu_list lu_hd;
00319 struct bu_list eu_hd;
00320 struct vertexuse *vu_p;
00321 long index;
00322 };
00323
00324 struct shell_a {
00325 long magic;
00326 point_t min_pt;
00327 point_t max_pt;
00328 long index;
00329 };
00330
00331
00332
00333
00334
00335
00336
00337 struct face {
00338 struct bu_list l;
00339 struct faceuse *fu_p;
00340 union {
00341 long *magic_p;
00342 struct face_g_plane *plane_p;
00343 struct face_g_snurb *snurb_p;
00344 } g;
00345 int flip;
00346
00347
00348 point_t min_pt;
00349 point_t max_pt;
00350 long index;
00351 };
00352
00353 struct face_g_plane {
00354 long magic;
00355 struct bu_list f_hd;
00356 plane_t N;
00357 long index;
00358 };
00359
00360 struct face_g_snurb {
00361
00362 struct bu_list l;
00363 struct bu_list f_hd;
00364 int order[2];
00365 struct knot_vector u;
00366 struct knot_vector v;
00367
00368 int s_size[2];
00369 int pt_type;
00370 fastf_t *ctl_points;
00371
00372 int dir;
00373 point_t min_pt;
00374 point_t max_pt;
00375
00376 long index;
00377 };
00378
00379 struct faceuse {
00380 struct bu_list l;
00381 struct shell *s_p;
00382 struct faceuse *fumate_p;
00383 int orientation;
00384 int outside;
00385 struct face *f_p;
00386 struct bu_list lu_hd;
00387 long index;
00388 };
00389
00390
00391 #define NMG_GET_FU_NORMAL(_N, _fu) { \
00392 register const struct faceuse *_fu1 = (_fu); \
00393 register const struct face_g_plane *_fg; \
00394 NMG_CK_FACEUSE(_fu1); \
00395 NMG_CK_FACE(_fu1->f_p); \
00396 _fg = _fu1->f_p->g.plane_p; \
00397 NMG_CK_FACE_G_PLANE(_fg); \
00398 if( (_fu1->orientation != OT_SAME) != (_fu1->f_p->flip != 0) ) { \
00399 VREVERSE( _N, _fg->N); \
00400 } else { \
00401 VMOVE( _N, _fg->N ); \
00402 } }
00403
00404
00405 #define NMG_GET_FU_PLANE(_N, _fu) { \
00406 register const struct faceuse *_fu1 = (_fu); \
00407 register const struct face_g_plane *_fg; \
00408 NMG_CK_FACEUSE(_fu1); \
00409 NMG_CK_FACE(_fu1->f_p); \
00410 _fg = _fu1->f_p->g.plane_p; \
00411 NMG_CK_FACE_G_PLANE(_fg); \
00412 if( (_fu1->orientation != OT_SAME) != (_fu1->f_p->flip != 0) ) { \
00413 HREVERSE( _N, _fg->N); \
00414 } else { \
00415 HMOVE( _N, _fg->N ); \
00416 } }
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442 #define RT_LIST_SET_DOWN_TO_VERT(_hp,_vu) { \
00443 (_hp)->forw = &((_vu)->l); (_hp)->back = (struct bu_list *)NULL; }
00444
00445 struct loop {
00446 long magic;
00447 struct loopuse *lu_p;
00448 struct loop_g *lg_p;
00449 long index;
00450 };
00451
00452 struct loop_g {
00453 long magic;
00454 point_t min_pt;
00455 point_t max_pt;
00456 long index;
00457 };
00458
00459 struct loopuse {
00460 struct bu_list l;
00461 union {
00462 struct faceuse *fu_p;
00463 struct shell *s_p;
00464 long *magic_p;
00465 } up;
00466 struct loopuse *lumate_p;
00467 int orientation;
00468 struct loop *l_p;
00469 struct bu_list down_hd;
00470 long index;
00471 };
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 struct edge {
00494 long magic;
00495 struct edgeuse *eu_p;
00496 long is_real;
00497 long index;
00498 };
00499
00500
00501
00502
00503
00504
00505 struct edge_g_lseg {
00506 struct bu_list l;
00507 struct bu_list eu_hd2;
00508 point_t e_pt;
00509 vect_t e_dir;
00510 long index;
00511 };
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521 struct edge_g_cnurb {
00522 struct bu_list l;
00523 struct bu_list eu_hd2;
00524 int order;
00525 struct knot_vector k;
00526
00527 int c_size;
00528 int pt_type;
00529 fastf_t *ctl_points;
00530 long index;
00531 };
00532
00533 struct edgeuse {
00534 struct bu_list l;
00535 struct bu_list l2;
00536 union {
00537 struct loopuse *lu_p;
00538 struct shell *s_p;
00539 long *magic_p;
00540 } up;
00541 struct edgeuse *eumate_p;
00542 struct edgeuse *radial_p;
00543 struct edge *e_p;
00544 int orientation;
00545 struct vertexuse *vu_p;
00546 union {
00547 long *magic_p;
00548 struct edge_g_lseg *lseg_p;
00549 struct edge_g_cnurb *cnurb_p;
00550 } g;
00551
00552 long index;
00553 };
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563 struct vertex {
00564 long magic;
00565 struct bu_list vu_hd;
00566 struct vertex_g *vg_p;
00567 long index;
00568 };
00569
00570 struct vertex_g {
00571 long magic;
00572 point_t coord;
00573 long index;
00574 };
00575
00576 struct vertexuse {
00577 struct bu_list l;
00578 union {
00579 struct shell *s_p;
00580 struct loopuse *lu_p;
00581 struct edgeuse *eu_p;
00582 long *magic_p;
00583 } up;
00584 struct vertex *v_p;
00585 union {
00586 long *magic_p;
00587 struct vertexuse_a_plane *plane_p;
00588 struct vertexuse_a_cnurb *cnurb_p;
00589 } a;
00590 long index;
00591 };
00592
00593 struct vertexuse_a_plane {
00594 long magic;
00595 vect_t N;
00596 long index;
00597 };
00598
00599 struct vertexuse_a_cnurb {
00600 long magic;
00601 fastf_t param[3];
00602 long index;
00603 };
00604
00605
00606
00607
00608
00609
00610 #define NMG_GETSTRUCT(p,str) BU_GETSTRUCT(p,str)
00611
00612
00613 #if __STDC__ && !defined(alliant) && !defined(apollo)
00614 # define NMG_FREESTRUCT(ptr, str) \
00615 { bzero((char *)(ptr), sizeof(struct str)); \
00616 bu_free((char *)(ptr), "freestruct " #str); }
00617 #else
00618 # define NMG_FREESTRUCT(ptr, str) \
00619 { bzero((char *)(ptr), sizeof(struct str)); \
00620 bu_free((char *)(ptr), "freestruct str"); }
00621 #endif
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631 #define NMG_INCR_INDEX(_p,_m) \
00632 NMG_CK_MODEL(_m); (_p)->index = ((_m)->maxindex)++
00633
00634 #define GET_REGION(p,m) {NMG_GETSTRUCT(p, nmgregion); NMG_INCR_INDEX(p,m);}
00635 #define GET_REGION_A(p,m) {NMG_GETSTRUCT(p, nmgregion_a); NMG_INCR_INDEX(p,m);}
00636 #define GET_SHELL(p,m) {NMG_GETSTRUCT(p, shell); NMG_INCR_INDEX(p,m);}
00637 #define GET_SHELL_A(p,m) {NMG_GETSTRUCT(p, shell_a); NMG_INCR_INDEX(p,m);}
00638 #define GET_FACE(p,m) {NMG_GETSTRUCT(p, face); NMG_INCR_INDEX(p,m);}
00639 #define GET_FACE_G_PLANE(p,m) {NMG_GETSTRUCT(p, face_g_plane); NMG_INCR_INDEX(p,m);}
00640 #define GET_FACE_G_SNURB(p,m) {NMG_GETSTRUCT(p, face_g_snurb); NMG_INCR_INDEX(p,m);}
00641 #define GET_FACEUSE(p,m) {NMG_GETSTRUCT(p, faceuse); NMG_INCR_INDEX(p,m);}
00642 #define GET_LOOP(p,m) {NMG_GETSTRUCT(p, loop); NMG_INCR_INDEX(p,m);}
00643 #define GET_LOOP_G(p,m) {NMG_GETSTRUCT(p, loop_g); NMG_INCR_INDEX(p,m);}
00644 #define GET_LOOPUSE(p,m) {NMG_GETSTRUCT(p, loopuse); NMG_INCR_INDEX(p,m);}
00645 #define GET_EDGE(p,m) {NMG_GETSTRUCT(p, edge); NMG_INCR_INDEX(p,m);}
00646 #define GET_EDGE_G_LSEG(p,m) {NMG_GETSTRUCT(p, edge_g_lseg); NMG_INCR_INDEX(p,m);}
00647 #define GET_EDGE_G_CNURB(p,m) {NMG_GETSTRUCT(p, edge_g_cnurb); NMG_INCR_INDEX(p,m);}
00648 #define GET_EDGEUSE(p,m) {NMG_GETSTRUCT(p, edgeuse); NMG_INCR_INDEX(p,m);}
00649 #define GET_VERTEX(p,m) {NMG_GETSTRUCT(p, vertex); NMG_INCR_INDEX(p,m);}
00650 #define GET_VERTEX_G(p,m) {NMG_GETSTRUCT(p, vertex_g); NMG_INCR_INDEX(p,m);}
00651 #define GET_VERTEXUSE(p,m) {NMG_GETSTRUCT(p, vertexuse); NMG_INCR_INDEX(p,m);}
00652 #define GET_VERTEXUSE_A_PLANE(p,m) {NMG_GETSTRUCT(p, vertexuse_a_plane); NMG_INCR_INDEX(p,m);}
00653 #define GET_VERTEXUSE_A_CNURB(p,m) {NMG_GETSTRUCT(p, vertexuse_a_cnurb); NMG_INCR_INDEX(p,m);}
00654
00655 #define FREE_MODEL(p) NMG_FREESTRUCT(p, model)
00656 #define FREE_REGION(p) NMG_FREESTRUCT(p, nmgregion)
00657 #define FREE_REGION_A(p) NMG_FREESTRUCT(p, nmgregion_a)
00658 #define FREE_SHELL(p) NMG_FREESTRUCT(p, shell)
00659 #define FREE_SHELL_A(p) NMG_FREESTRUCT(p, shell_a)
00660 #define FREE_FACE(p) NMG_FREESTRUCT(p, face)
00661 #define FREE_FACE_G_PLANE(p) NMG_FREESTRUCT(p, face_g_plane)
00662 #define FREE_FACE_G_SNURB(p) NMG_FREESTRUCT(p, face_g_snurb)
00663 #define FREE_FACEUSE(p) NMG_FREESTRUCT(p, faceuse)
00664 #define FREE_LOOP(p) NMG_FREESTRUCT(p, loop)
00665 #define FREE_LOOP_G(p) NMG_FREESTRUCT(p, loop_g)
00666 #define FREE_LOOPUSE(p) NMG_FREESTRUCT(p, loopuse)
00667 #define FREE_LOOPUSE_A(p) NMG_FREESTRUCT(p, loopuse_a)
00668 #define FREE_EDGE(p) NMG_FREESTRUCT(p, edge)
00669 #define FREE_EDGE_G_LSEG(p) NMG_FREESTRUCT(p, edge_g_lseg)
00670 #define FREE_EDGE_G_CNURB(p) NMG_FREESTRUCT(p, edge_g_cnurb)
00671 #define FREE_EDGEUSE(p) NMG_FREESTRUCT(p, edgeuse)
00672 #define FREE_VERTEX(p) NMG_FREESTRUCT(p, vertex)
00673 #define FREE_VERTEX_G(p) NMG_FREESTRUCT(p, vertex_g)
00674 #define FREE_VERTEXUSE(p) NMG_FREESTRUCT(p, vertexuse)
00675 #define FREE_VERTEXUSE_A_PLANE(p) NMG_FREESTRUCT(p, vertexuse_a_plane)
00676 #define FREE_VERTEXUSE_A_CNURB(p) NMG_FREESTRUCT(p, vertexuse_a_cnurb)
00677
00678
00679 #define NMG_ARE_EUS_ADJACENT(_eu1,_eu2) ( \
00680 ( (_eu1)->vu_p->v_p == (_eu2)->vu_p->v_p && \
00681 (_eu1)->eumate_p->vu_p->v_p == (_eu2)->eumate_p->vu_p->v_p ) || \
00682 ( (_eu1)->vu_p->v_p == (_eu2)->eumate_p->vu_p->v_p && \
00683 (_eu1)->eumate_p->vu_p->v_p == (_eu2)->vu_p->v_p ) )
00684
00685
00686 #define EDGESADJ(_e1, _e2) NMG_ARE_EUS_ADJACENT(_e1,_e2)
00687
00688
00689 #define PLPRINT(_s, _pl) bu_log("%s %gx + %gy + %gz = %g\n", (_s), \
00690 (_pl)[0], (_pl)[1], (_pl)[2], (_pl)[3])
00691
00692
00693
00694 #define NMG_FPI_FIRST 0
00695 #define NMG_FPI_PERGEOM 1
00696
00697
00698
00699 #define NMG_FPI_PERUSE 2
00700
00701
00702
00703
00704
00705 struct nmg_boolstruct {
00706 struct bu_ptbl ilist;
00707 fastf_t tol;
00708 point_t pt;
00709 vect_t dir;
00710 int coplanar;
00711 char *vertlist;
00712 int vlsize;
00713 struct model *model;
00714 };
00715
00716 #define PREEXIST 1
00717 #define NEWEXIST 2
00718
00719
00720 #define VU_PREEXISTS(_bs, _vu) { chkidxlist((_bs), (_vu)); \
00721 (_bs)->vertlist[(_vu)->index] = PREEXIST; }
00722
00723 #define VU_NEW(_bs, _vu) { chkidxlist((_bs), (_vu)); \
00724 (_bs)->vertlist[(_vu)->index] = NEWEXIST; }
00725
00726
00727 struct nmg_struct_counts {
00728
00729 long model;
00730 long region;
00731 long region_a;
00732 long shell;
00733 long shell_a;
00734 long faceuse;
00735 long face;
00736 long face_g_plane;
00737 long face_g_snurb;
00738 long loopuse;
00739 long loop;
00740 long loop_g;
00741 long edgeuse;
00742 long edge;
00743 long edge_g_lseg;
00744 long edge_g_cnurb;
00745 long vertexuse;
00746 long vertexuse_a_plane;
00747 long vertexuse_a_cnurb;
00748 long vertex;
00749 long vertex_g;
00750
00751 long max_structs;
00752 long face_loops;
00753 long face_edges;
00754 long face_lone_verts;
00755 long wire_loops;
00756 long wire_loop_edges;
00757 long wire_edges;
00758 long wire_lone_verts;
00759 long shells_of_lone_vert;
00760 };
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774 #define NMG_INDEX_VALUE(_tab,_index) ((_tab)[_index])
00775 #define NMG_INDEX_TEST(_tab,_p) ( (_tab)[(_p)->index] )
00776 #define NMG_INDEX_SET(_tab,_p) {(_tab)[(_p)->index] = 1;}
00777 #define NMG_INDEX_CLEAR(_tab,_p) {(_tab)[(_p)->index] = 0;}
00778 #define NMG_INDEX_TEST_AND_SET(_tab,_p) \
00779 ( (_tab)[(_p)->index] == 0 ? ((_tab)[(_p)->index] = 1) : 0 )
00780 #define NMG_INDEX_IS_SET(_tab,_p) NMG_INDEX_TEST(_tab,_p)
00781 #define NMG_INDEX_FIRST_TIME(_tab,_p) NMG_INDEX_TEST_AND_SET(_tab,_p)
00782 #define NMG_INDEX_ASSIGN(_tab,_p,_val) {(_tab)[(_p)->index] = _val;}
00783 #define NMG_INDEX_GET(_tab,_p) ((_tab)[(_p)->index])
00784 #define NMG_INDEX_GETP(_ty,_tab,_p) ((struct _ty *)((_tab)[(_p)->index]))
00785 #define NMG_INDEX_OR(_tab,_p,_val) {(_tab)[(_p)->index] |= _val;}
00786 #define NMG_INDEX_AND(_tab,_p,_val) {(_tab)[(_p)->index] &= _val;}
00787 #define NMG_INDEX_RETURN_IF_SET_ELSE_SET(_tab,_index) \
00788 { if( (_tab)[_index] ) return; \
00789 else (_tab)[_index] = 1; }
00790
00791
00792 #define NMG_3MANIFOLD 16
00793 #define NMG_2MANIFOLD 4
00794 #define NMG_1MANIFOLD 2
00795 #define NMG_0MANIFOLD 1
00796 #if 0
00797 # define NMG_DANGLING 8
00798 #endif
00799
00800 #define NMG_SET_MANIFOLD(_t,_p,_v) NMG_INDEX_OR(_t, _p, _v)
00801 #define NMG_MANIFOLDS(_t, _p) NMG_INDEX_VALUE(_t, (_p)->index)
00802 #define NMG_CP_MANIFOLD(_t, _p, _q) (_t)[(_p)->index] = (_t)[(_q)->index]
00803
00804
00805
00806
00807 #define NMG_VLIST_STYLE_VECTOR 0
00808 #define NMG_VLIST_STYLE_POLYGON 1
00809 #define NMG_VLIST_STYLE_VISUALIZE_NORMALS 2
00810 #define NMG_VLIST_STYLE_USE_VU_NORMALS 4
00811 #define NMG_VLIST_STYLE_NO_SURFACES 8
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825 struct nmg_visit_handlers {
00826 void (*bef_model) NMG_ARGS((long *, genptr_t, int));
00827 void (*aft_model) NMG_ARGS((long *, genptr_t, int));
00828
00829 void (*bef_region) NMG_ARGS((long *, genptr_t, int));
00830 void (*aft_region) NMG_ARGS((long *, genptr_t, int));
00831
00832 void (*vis_region_a) NMG_ARGS((long *, genptr_t, int));
00833
00834 void (*bef_shell) NMG_ARGS((long *, genptr_t, int));
00835 void (*aft_shell) NMG_ARGS((long *, genptr_t, int));
00836
00837 void (*vis_shell_a) NMG_ARGS((long *, genptr_t, int));
00838
00839 void (*bef_faceuse) NMG_ARGS((long *, genptr_t, int));
00840 void (*aft_faceuse) NMG_ARGS((long *, genptr_t, int));
00841
00842 void (*vis_face) NMG_ARGS((long *, genptr_t, int));
00843 void (*vis_face_g) NMG_ARGS((long *, genptr_t, int));
00844
00845 void (*bef_loopuse) NMG_ARGS((long *, genptr_t, int));
00846 void (*aft_loopuse) NMG_ARGS((long *, genptr_t, int));
00847
00848 void (*vis_loop) NMG_ARGS((long *, genptr_t, int));
00849 void (*vis_loop_g) NMG_ARGS((long *, genptr_t, int));
00850
00851 void (*bef_edgeuse) NMG_ARGS((long *, genptr_t, int));
00852 void (*aft_edgeuse) NMG_ARGS((long *, genptr_t, int));
00853
00854 void (*vis_edge) NMG_ARGS((long *, genptr_t, int));
00855 void (*vis_edge_g) NMG_ARGS((long *, genptr_t, int));
00856
00857 void (*bef_vertexuse) NMG_ARGS((long *, genptr_t, int));
00858 void (*aft_vertexuse) NMG_ARGS((long *, genptr_t, int));
00859
00860 void (*vis_vertexuse_a) NMG_ARGS((long *, genptr_t, int));
00861 void (*vis_vertex) NMG_ARGS((long *, genptr_t, int));
00862 void (*vis_vertex_g) NMG_ARGS((long *, genptr_t, int));
00863 };
00864
00865 #endif
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876