nmg_mod.c File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "machine.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "nurb.h"

Include dependency graph for nmg_mod.c:

Go to the source code of this file.

Defines

#define JS_UNKNOWN   0
#define JS_SPLIT   1
#define JS_JAUNT   2
#define JS_TOUCHING_JAUNT   3

Functions

void nmg_merge_regions (struct nmgregion *r1, struct nmgregion *r2, const struct bn_tol *tol)
void nmg_shell_coplanar_face_merge (struct shell *s, const struct bn_tol *tol, const int simplify)
int nmg_simplify_shell (struct shell *s)
void nmg_rm_redundancies (struct shell *s, const struct bn_tol *tol)
void nmg_sanitize_s_lv (struct shell *s, int orient)
void nmg_s_split_touchingloops (struct shell *s, const struct bn_tol *tol)
void nmg_s_join_touchingloops (struct shell *s, const struct bn_tol *tol)
void nmg_js (register struct shell *s1, register struct shell *s2, const struct bn_tol *tol)
void nmg_invert_shell (struct shell *s, const struct bn_tol *tol)
faceusenmg_cmface (struct shell *s, struct vertex ***verts, int n)
faceusenmg_cface (struct shell *s, struct vertex **verts, int n)
faceusenmg_add_loop_to_face (struct shell *s, struct faceuse *fu, struct vertex **verts, int n, int dir)
int nmg_fu_planeeqn (struct faceuse *fu, const struct bn_tol *tol)
void nmg_gluefaces (struct faceuse **fulist, int n, const struct bn_tol *tol)
int nmg_simplify_face (struct faceuse *fu)
void nmg_reverse_face (register struct faceuse *fu)
void nmg_mv_fu_between_shells (struct shell *dest, register struct shell *src, register struct faceuse *fu)
void nmg_jf (register struct faceuse *dest_fu, register struct faceuse *src_fu)
faceusenmg_dup_face (struct faceuse *fu, struct shell *s)
void nmg_jl (struct loopuse *lu, struct edgeuse *eu)
vertexusenmg_join_2loops (struct vertexuse *vu1, struct vertexuse *vu2)
vertexusenmg_join_singvu_loop (struct vertexuse *vu1, struct vertexuse *vu2)
vertexusenmg_join_2singvu_loops (struct vertexuse *vu1, struct vertexuse *vu2)
loopusenmg_cut_loop (struct vertexuse *vu1, struct vertexuse *vu2)
loopusenmg_split_lu_at_vu (struct loopuse *lu, struct vertexuse *split_vu)
vertexusenmg_find_repeated_v_in_lu (struct vertexuse *vu)
void nmg_split_touchingloops (struct loopuse *lu, const struct bn_tol *tol)
int nmg_join_touchingloops (struct loopuse *lu)
int nmg_get_touching_jaunts (const struct loopuse *lu, struct bu_ptbl *tbl, int *need_init)
void nmg_kill_accordions (struct loopuse *lu)
int nmg_loop_split_at_touching_jaunt (struct loopuse *lu, const struct bn_tol *tol)
void nmg_simplify_loop (struct loopuse *lu)
int nmg_kill_snakes (struct loopuse *lu)
void nmg_mv_lu_between_shells (struct shell *dest, register struct shell *src, register struct loopuse *lu)
void nmg_moveltof (struct faceuse *fu, struct shell *s)
loopusenmg_dup_loop (struct loopuse *lu, long int *parent, long int **trans_tbl)
void nmg_set_lu_orientation (struct loopuse *lu, int is_opposite)
void nmg_lu_reorient (struct loopuse *lu)
edgeusenmg_eusplit (struct vertex *v, struct edgeuse *oldeu, int share_geom)
edgeusenmg_esplit (struct vertex *v, struct edgeuse *eu, int share_geom)
edgeusenmg_ebreak (struct vertex *v, struct edgeuse *eu)
edgeusenmg_ebreaker (struct vertex *v, struct edgeuse *eu, const struct bn_tol *tol)
vertexnmg_e2break (struct edgeuse *eu1, struct edgeuse *eu2)
int nmg_unbreak_edge (struct edgeuse *eu1_first)
int nmg_unbreak_shell_edge_unsafe (struct edgeuse *eu1_first)
edgeusenmg_eins (struct edgeuse *eu)
void nmg_mv_eu_between_shells (struct shell *dest, register struct shell *src, register struct edgeuse *eu)
void nmg_mv_vu_between_shells (struct shell *dest, register struct shell *src, register struct vertexuse *vu)


Detailed Description

Routines for modifying n-Manifold Geometry data structures.

Authors - Lee A. Butler Michael John Muuss

Source - SECAD/VLD Computing Consortium, Bldg 394 The U. S. Army Ballistic Research Laboratory Aberdeen Proving Ground, Maryland 21005-5066

Definition in file nmg_mod.c.


Define Documentation

#define JS_UNKNOWN   0
 

Definition at line 2936 of file nmg_mod.c.

#define JS_SPLIT   1
 

Definition at line 2937 of file nmg_mod.c.

#define JS_JAUNT   2
 

Definition at line 2938 of file nmg_mod.c.

#define JS_TOUCHING_JAUNT   3
 

Definition at line 2939 of file nmg_mod.c.


Function Documentation

void nmg_js register struct shell s1,
register struct shell s2,
const struct bn_tol tol
 

N M G _ J S

Join two shells into one. This is mostly an up-pointer re-labeling activity, as it is left up to the caller to ensure that there are no non-explicit intersections.

Upon return, s2 will no longer exist.

The 'tol' arg is used strictly for printing purposes.

Definition at line 800 of file nmg_mod.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_NON_EMPTY, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), DEBUG_BASIC, DEBUG_VERIFY, edgeuse::e_p, edgeuse::eumate_p, faceuse::f_p, faceuse::fumate_p, loopuse::l_p, loopuse::lumate_p, NMG_CK_EDGE, NMG_CK_EDGEUSE, NMG_CK_FACE, NMG_CK_FACEUSE, NMG_CK_LOOP, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, nmg_find_fu_with_fg_in_s(), nmg_jf(), nmg_ks(), nmg_mv_eu_between_shells(), nmg_mv_fu_between_shells(), nmg_mv_lu_between_shells(), nmg_mv_vu_between_shells(), nmg_s_radial_harmonize(), nmg_vshell(), faceuse::orientation, OT_SAME, rt_bomb(), and vertexuse::v_p.

Here is the call graph for this function:

struct faceuse* nmg_cmface struct shell s,
struct vertex ***  verts,
int  n
 

N M G _ C M F A C E

Create a face with exactly one exterior loop (and no holes), given an array of pointers to struct vertex pointers. Intended to help create a "3-manifold" shell, where each edge has only two faces alongside of it. (Shades of winged edges!)

"verts" is an array of "n" pointers to pointers to (struct vertex). "s" is the parent shell for the new face.

The new face will consist of a single loop made from n edges between the n vertices. Before an edge is created between a pair of verticies, we check to see if there is already an edge with exactly one edgeuse+mate (in this shell) that runs between the two verticies. If such an edge can be found, the newly created edgeuses will just use the existing edge. This means that no special call to nmg_gluefaces() is needed later.

If a pointer in verts is a pointer to a null vertex pointer, a new vertex is created. In this way, new verticies can be created conveniently within a user's list of known verticies

verts pointers to struct vertex vertex structs

------- -------- 0 | +--|-------->| +--|--------------------------> (struct vertex) ------- -------- --------- 1 | +--|------------------------>| +---|---------> (struct vertex) ------- -------- --------- 2 | +--|-------->| +--|--------------------------> (struct vertex) ------- -------- ... ------- --------- n | +--|------------------------>| +---|---------> (struct vertex) ------- ---------

The vertices *must* be listed in "counter-clockwise" (CCW) order. This routine makes only topology, without reference to any geometry.

Note that this routine inserts new vertices (by edge use splitting) at the head of the loop, which reverses the order. Therefore, the caller's vertices are traversed in reverse order to counter this behavior, and to effect the proper vertex order in the final face loop.

Also note that this routine uses one level more of indirection in the verts[] array than nmg_cface().

Recent improvement: the lu's list of eu's traverses the verts[] array in order specified by the caller. Imagine that.

Definition at line 1056 of file nmg_mod.c.

References bu_log(), NMG_CK_SHELL, NMG_CK_VERTEX, NULL, and rt_bomb().

Here is the call graph for this function:

void nmg_gluefaces struct faceuse **  fulist,
int  n,
const struct bn_tol tol
 

N M G _ G L U E F A C E S

given a shell containing "n" faces whose outward oriented faceuses are enumerated in "fulist", glue the edges of the faces together Most especially useful after using nmg_cface() several times to make faces which share vertex structures.

Definition at line 1489 of file nmg_mod.c.

References bu_log(), NMG_CK_FACEUSE, NMG_CK_SHELL, rt_bomb(), and faceuse::s_p.

Here is the call graph for this function:

void nmg_reverse_face register struct faceuse fu  ) 
 

N M G _ R E V E R S E _ F A C E

This routine reverses the direction of the Normal vector which defines the plane of the face.

The OT_SAME faceuse becomes the OT_OPPOSITE faceuse, and vice versa. This preserves the convention that OT_SAME loopuses in the OT_SAME faceuse are counter-clockwise rotating about the surface normal.

Before After

N OT_SAME OT_OPPOSITE \ .<---------. .<---------. \ |fu ^ |fu ^ \ | .------ | ->. | .------ | ->. \| ^fumate | | | ^fumate | | | | | | | | | | | | | | | | | | V | | | V | | |\ .--------->. | .--------->. | \ | V | V \ .<----------. .<----------. \ OT_OPPOSITE OT_SAME \ N

Also note that this reverses the same:opposite:opposite:same parity radially around each edge. This can create parity errors until all faces of this shell have been processed.

Applications programmers should use nmg_invert_shell(), which does not have this problem. This routine is for internal use only.

Definition at line 1624 of file nmg_mod.c.

References bu_log(), DEBUG_BASIC, faceuse::fumate_p, NMG_CK_FACE, NMG_CK_FACE_G_EITHER, NMG_CK_FACEUSE, faceuse::orientation, OT_OPPOSITE, OT_SAME, and rt_bomb().

Here is the call graph for this function:

void nmg_mv_fu_between_shells struct shell dest,
register struct shell src,
register struct faceuse fu
 

N M G _ M V _ F U _ B E T W E E N _ S H E L L S

Move faceuse from 'src' shell to 'dest' shell.

Definition at line 1832 of file nmg_mod.c.

References BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_IS_EMPTY, bu_log(), DEBUG_BASIC, shell::fu_hd, faceuse::fumate_p, faceuse::l, NMG_CK_FACEUSE, OT_SAME, rt_bomb(), and faceuse::s_p.

Here is the call graph for this function:

void nmg_jf register struct faceuse dest_fu,
register struct faceuse src_fu
 

N M G _ J F

Join two faces together by moving everything from the source faceuse and mate into the destination faceuse and mate, taking into account face orientations. The source face is destroyed by this operation.

Definition at line 1922 of file nmg_mod.c.

References bu_log(), DEBUG_BASIC, NMG_CK_FACEUSE, nmg_kfu(), and rt_bomb().

Here is the call graph for this function:

void nmg_mv_lu_between_shells struct shell dest,
register struct shell src,
register struct loopuse lu
 

N M G _ M V _ L U _ B E T W E E N _ S H E L L S

Move a wire-loopuse from one shell to another. Note that this routine can not be used on loops in faces.

Definition at line 3591 of file nmg_mod.c.

References BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_IS_EMPTY, bu_log(), DEBUG_BASIC, loopuse::l, shell::lu_hd, loopuse::lumate_p, NMG_CK_LOOPUSE, rt_bomb(), loopuse::s_p, and loopuse::up.

Here is the call graph for this function:

struct loopuse* nmg_dup_loop struct loopuse lu,
long int *  parent,
long int **  trans_tbl
 

N M G _ D U P _ L O O P

A support routine for nmg_dup_face()

trans_tbl may be NULL.

Definition at line 3678 of file nmg_mod.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_LAST, bu_log(), vertex_g::coord, DEBUG_BASIC, loopuse::down_hd, edgeuse::e_p, edgeuse::g, edgeuse::magic_p, NMG_CK_EDGE, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX, NMG_CK_VERTEX_G, NMG_CK_VERTEXUSE, nmg_edge_g(), nmg_eusplit(), NMG_INDEX_ASSIGN, NMG_INDEX_GETP, nmg_je(), nmg_meonvu(), nmg_mlv(), nmg_orientation(), nmg_vertex_gv(), NMG_VERTEXUSE_MAGIC, NULL, loopuse::orientation, rt_bomb(), vertexuse::v_p, vertex::vg_p, and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_mv_eu_between_shells struct shell dest,
register struct shell src,
register struct edgeuse eu
 

N M G _ M V _ E U _ B E T W E E N _ S H E L L S

Move a wire edgeuse and it's mate from one shell to another.

Definition at line 5022 of file nmg_mod.c.

References BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_IS_EMPTY, bu_log(), shell::eu_hd, edgeuse::eumate_p, edgeuse::l, NMG_CK_EDGEUSE, rt_bomb(), edgeuse::s_p, and edgeuse::up.

Here is the call graph for this function:

void nmg_mv_vu_between_shells struct shell dest,
register struct shell src,
register struct vertexuse vu
 

N M G _ M V _ V U _ B E T W E E N _ S H E L L S

If this shell had a single vertexuse in it, move it to the other shell, but "promote" it to a "loop of a single vertex" along the way.

Definition at line 5079 of file nmg_mod.c.

References bu_log(), shell::l, bu_list::magic, NMG_CK_VERTEX, NMG_CK_VERTEX_G, NMG_CK_VERTEXUSE, nmg_kvu(), nmg_mlv(), OT_SAME, and void().

Here is the call graph for this function:


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