nmg_bool.c File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "machine.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "./debug.h"

Include dependency graph for nmg_bool.c:

Go to the source code of this file.

Data Structures

struct  dangling_faceuse_state
int nmg_has_dangling_faces (long int *magic_p, const char *manifolds)
void nmg_show_each_loop (struct shell *s, long int **classlist, int new, int fancy, const char *str)
void stash_shell (struct shell *s, char *file_name, char *title, const struct bn_tol *tol)
void nmg_kill_non_common_cracks (struct shell *sA, struct shell *sB)
void nmg_kill_anti_loops (struct shell *s, const struct bn_tol *tol)
void nmg_kill_wire_edges (struct shell *s)
nmgregionnmg_do_bool (struct nmgregion *rA, struct nmgregion *rB, const int oper, const struct bn_tol *tol)
treenmg_booltree_leaf_tess (struct db_tree_state *tsp, struct db_full_path *pathp, struct rt_db_internal *ip, genptr_t client_data)
treenmg_booltree_leaf_tnurb (struct db_tree_state *tsp, struct db_full_path *pathp, struct rt_db_internal *ip, genptr_t client_data)
treenmg_booltree_evaluate (register union tree *tp, const struct bn_tol *tol, struct resource *resp)
int nmg_boolean (union tree *tp, struct model *m, const struct bn_tol *tol, struct resource *resp)
int nmg_class_nothing_broken
int debug_file_count = 0


Detailed Description

Support for boolean operations on NMG objects. Most of the routines in here are static/local to this file. The interfaces here are the functions "nmg_do_bool" and "nmg_mesh_faces". The former does boolean operations on a pair of shells. The latter is a function to make edges shared between two faces whenever possible.

Authors - Lee A. Butler Michael John Muuss

Source - The U. S. Army Research Laboratory Aberdeen Proving Ground, Maryland 21005-5068 USA

Definition in file nmg_bool.c.


Function Documentation

int nmg_has_dangling_faces long int *  magic_p,
const char *  manifolds
 

N M G _ H A S _ D A N G L I N G _ F A C E S

Argument is expected to be model, region, shell, or faceuse pointer.

Returns - 0 No dangling faces !0 Has dangling faces

Definition at line 96 of file nmg_bool.c.

References bu_calloc(), bu_free(), dangling_faceuse_state::count, dangling_faceuse_state::manifolds, model::maxindex, NMG_CK_MODEL, nmg_find_model(), nmg_visit(), NULL, and dangling_faceuse_state::visited.

Here is the call graph for this function:

void nmg_show_each_loop struct shell s,
long int **  classlist,
int  new,
int  fancy,
const char *  str
 

N M G _ S H O W _ E A C H _ L O O P

Within a shell, show each loop as a separate display. Pause after displaying each one.

Note that in "non-fancy" mode, show_broken_eu() draws just the edge.

Definition at line 128 of file nmg_bool.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, loopuse::down_hd, shell::fu_hd, shell::lu_hd, faceuse::lu_hd, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, nmg_show_broken_classifier_stuff(), NMG_VERTEXUSE_MAGIC, loopuse::orientation, faceuse::orientation, and OT_OPPOSITE.

Here is the call graph for this function:

void stash_shell struct shell s,
char *  file_name,
char *  title,
const struct bn_tol tol
 

Definition at line 163 of file nmg_bool.c.

References BU_LIST_FIRST, BU_LIST_FOR, debug_file_count, shell::fu_hd, nmg_dup_face(), nmg_km(), nmg_mm(), nmg_mrsv(), nmg_rebound(), nmg_stash_model_to_file(), faceuse::orientation, OT_SAME, nmgregion::s_hd, and void().

Here is the call graph for this function:

void nmg_kill_non_common_cracks struct shell sA,
struct shell sB
 

Definition at line 190 of file nmg_bool.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_CIRC, bu_log(), DEBUG_BASIC, loopuse::down_hd, edgeuse::eumate_p, shell::fu_hd, faceuse::fumate_p, edgeuse::l, loopuse::l, faceuse::l, faceuse::lu_hd, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_EDGEUSE_MAGIC, nmg_find_v_in_shell(), nmg_keu(), nmg_kfu(), nmg_klu(), vertexuse::v_p, and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_kill_anti_loops struct shell s,
const struct bn_tol tol
 

N M G _ K I L L _ A N T I _ L O O P S

Look for same loop in opposite direction in shell "s", Kill them.

Definition at line 447 of file nmg_bool.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, BU_PTBL_END, BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_rm(), loopuse::down_hd, vertexuse::eu_p, shell::fu_hd, edgeuse::l, faceuse::lu_hd, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_EDGEUSE_MAGIC, nmg_find_vertex_in_lu(), nmg_kfu(), nmg_klu(), faceuse::orientation, OT_SAME, vertexuse::up, vertexuse::v_p, and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_kill_wire_edges struct shell s  ) 
 

Definition at line 556 of file nmg_bool.c.

References BU_LIST_FIRST, BU_LIST_NON_EMPTY, shell::eu_hd, shell::lu_hd, nmg_keu(), and nmg_klu().

Here is the call graph for this function:

union tree* nmg_booltree_evaluate register union tree tp,
const struct bn_tol tol,
struct resource resp
 

N M G _ B O O L T R E E _ E V A L U A T E

Given a tree of leaf nodes tesselated earlier by nmg_booltree_leaf_tess(), use recursion to do a depth-first traversal of the tree, evaluating each pair of boolean operations and reducing that result to a single nmgregion.

Usually called from a do_region_end() handler from db_walk_tree(). For an example of several, see mged/dodraw.c.

Returns an OP_NMG_TESS union tree node, which will contain the resulting region and it's name, as a dynamic string. The caller is responsible for releasing the string, and the node, by calling db_free_tree() on the node.

It is *essential* that the caller call nmg_model_fuse() before calling this subroutine.

Returns NULL if there is no geometry to return.

Typical calls will be of this form: (void)nmg_model_fuse( m, tol ); curtree = nmg_booltree_evaluate( curtree, tol );

Definition at line 1277 of file nmg_bool.c.

References BN_CK_TOL, BU_LIST_FIRST, bu_log(), bu_malloc(), db_free_tree(), DEBUG_BOOL, DEBUG_VERIFY, nmgregion::m_p, name, NMG_BOOL_ADD, NMG_BOOL_ISECT, NMG_BOOL_SUB, nmg_booltree_evaluate(), nmg_ck_closed_region(), NMG_CK_REGION, nmg_do_bool(), nmg_merge_models(), nmg_pr_s_briefly(), nmg_r_radial_check(), nmg_vshell(), OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_SUBTRACT, OP_UNION, rt_bomb(), RT_CK_RESOURCE, RT_CK_TREE, nmgregion::s_hd, tree::tree_nmgregion::td_name, tree::tree_nmgregion::td_r, tree::tr_d, and TREE_NULL.

Here is the call graph for this function:


Variable Documentation

int nmg_class_nothing_broken
 

Definition at line 1550 of file nmg_plot.c.

int debug_file_count = 0
 

Definition at line 67 of file nmg_bool.c.

Referenced by nmg_eu_radial_check(), and stash_shell().


Generated on Mon Sep 18 01:25:07 2006 for BRL-CAD by  doxygen 1.4.6