nmg_mk.c File Reference

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

Include dependency graph for nmg_mk.c:

Go to the source code of this file.

Functions

modelnmg_mm (void)
modelnmg_mmr (void)
nmgregionnmg_mrsv (struct model *m)
shellnmg_msv (struct nmgregion *r)
faceusenmg_mf (struct loopuse *lu1)
loopusenmg_mlv (long int *magic, struct vertex *v, int orientation)
edgeusenmg_me (struct vertex *v1, struct vertex *v2, struct shell *s)
edgeusenmg_meonvu (struct vertexuse *vu)
loopusenmg_ml (struct shell *s)
int nmg_kvu (register struct vertexuse *vu)
int nmg_kfu (struct faceuse *fu1)
int nmg_klu (struct loopuse *lu1)
int nmg_keg (struct edgeuse *eu)
int nmg_keu (register struct edgeuse *eu1)
int nmg_ks (struct shell *s)
int nmg_kr (struct nmgregion *r)
void nmg_km (struct model *m)
void nmg_vertex_gv (struct vertex *v, const fastf_t *pt)
void nmg_vertex_g (register struct vertex *v, fastf_t x, fastf_t y, fastf_t z)
void nmg_vertexuse_nv (struct vertexuse *vu, const fastf_t *norm)
void nmg_vertexuse_a_cnurb (struct vertexuse *vu, const fastf_t *uvw)
void nmg_edge_g (struct edgeuse *eu)
void nmg_edge_g_cnurb (struct edgeuse *eu, int order, int n_knots, fastf_t *kv, int n_pts, int pt_type, fastf_t *points)
void nmg_edge_g_cnurb_plinear (struct edgeuse *eu)
int nmg_use_edge_g (struct edgeuse *eu, long int *magic_p)
void nmg_loop_g (struct loop *l, const struct bn_tol *tol)
void nmg_face_g (struct faceuse *fu, const fastf_t *p)
void nmg_face_new_g (struct faceuse *fu, const fastf_t *pl)
void nmg_face_g_snurb (struct faceuse *fu, int u_order, int v_order, int n_u_knots, int n_v_knots, fastf_t *ukv, fastf_t *vkv, int n_rows, int n_cols, int pt_type, fastf_t *mesh)
void nmg_face_bb (struct face *f, const struct bn_tol *tol)
void nmg_shell_a (struct shell *s, const struct bn_tol *tol)
void nmg_region_a (struct nmgregion *r, const struct bn_tol *tol)
int nmg_demote_lu (struct loopuse *lu1)
int nmg_demote_eu (struct edgeuse *eu)
void nmg_movevu (struct vertexuse *vu, struct vertex *v)
void nmg_je (struct edgeuse *eudst, struct edgeuse *eusrc)
void nmg_unglueedge (struct edgeuse *eu)
void nmg_jv (register struct vertex *v1, register struct vertex *v2)
void nmg_jfg (struct face *f1, struct face *f2)
void nmg_jeg (struct edge_g_lseg *dest_eg, struct edge_g_lseg *src_eg)


Detailed Description

Support routines for n-Manifold Geometry.

Naming convention nmg_m* routines "make" NMG structures. nmg_k* routines "kill" (delete) NMG structures.

in each of the above cases the letters or words following are an attempt at a mnemonic representation for what is manipulated

m Model r Region s shell f face fu faceuse l loop lu loopuse e edge eu edgeuse v vertex vu vertexuse

Rules:

XXX - What does "overlap" mean? ctj edges of loops of the same face must not overlap the "magic" member of each struct is the first item.

All routines which create and destroy the NMG data structures are contained in this module.

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_mk.c.


Function Documentation

struct loopuse* nmg_mlv long int *  magic,
struct vertex v,
int  orientation
 

N M G _ M L V

XXX - vertex or vertexuse? or both? ctj Make a new loop (with specified orientation) and vertex, in a shell or face. If the vertex 'v' is NULL, the shell's lone vertex is used, or a new vertex is created.

"magic" must point to the magic number of a faceuse or shell.

If the shell has a lone vertex in it, that lone vertex *will* be used. If a non-NULL 'v' is provided, the lone vertex and 'v' will be fused together. XXX Why is this good?

If a convenient shell does not exist, use s=nmg_msv() to make the shell and vertex, then call lu=nmg_mlv(s,s->vu_p->v_p,OT_SAME), followed by nmg_kvu(s->vu_p).

Implicit returns - The new vertexuse can be had by: BU_LIST_FIRST(vertexuse, &lu->down_hd);

In case the returned loopuse isn't retained, the new loopuse was inserted at the +head+ of the appropriate list, e.g.: lu = BU_LIST_FIRST(loopuse, &fu->lu_hd); or lu = BU_LIST_FIRST(loopuse, &s->lu_hd);

N.B. This function is made more complex than warrented by using the "hack" of stealing a vertexuse structure from the shell if at all possible. A future enhancement to this function would be to remove the vertexuse steal and have the caller pass in the vertex from the shell followed by a call to nmg_kvu(s->vu_p). The v==NULL convention is used only in nmg_mod.c.

Definition at line 520 of file nmg_mk.c.

References BU_LIST_INIT, BU_LIST_INSERT, bu_log(), DEBUG_BASIC, loopuse::down_hd, loopuse::fu_p, faceuse::fumate_p, GET_LOOP, GET_LOOPUSE, loopuse::l, faceuse::l, loopuse::l_p, shell::lu_hd, vertexuse::lu_p, loop::lu_p, loopuse::lumate_p, bu_list::magic, loop::magic, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, NMG_FACEUSE_MAGIC, nmg_find_model(), NMG_LOOP_MAGIC, NMG_LOOPUSE_MAGIC, nmg_movevu(), nmg_orientation(), NMG_SHELL_MAGIC, NULL, loopuse::orientation, rt_bomb(), RT_LIST_SET_DOWN_TO_VERT, loopuse::s_p, vertexuse::up, loopuse::up, vertexuse::v_p, and shell::vu_p.

Here is the call graph for this function:

int nmg_kvu register struct vertexuse vu  ) 
 

N M G _ K V U

Kill vertexuse, and null out parent's vu_p.

This routine is not intented for general use by applications, because it requires cooperation on the part of the caller to properly dispose of or fix the now *quite* illegal parent. (Illegal because the parent's vu_p is NULL). It exists primarily as a support routine for "mopping up" after nmg_klu(), nmg_keu(), nmg_ks(), and nmg_mv_vu_between_shells().

It is also used in a particularly ugly way in nmg_cut_loop() and nmg_split_lu_at_vu() as part of their method for obtaining an "empty" loopuse/loop set.

It is worth noting that all these callers ignore the return code, because they *all* exist to intentionally empty out the parent, but the return code is provided anyway, in the name of [CTJ] symmetry.

Returns - 0 If all is well in the parent 1 If parent is empty, and is thus "illegal"

Definition at line 1120 of file nmg_mk.c.

References BU_LIST_DEQUEUE, BU_LIST_INIT, BU_LIST_IS_EMPTY, bu_log(), DEBUG_BASIC, FREE_VERTEX, FREE_VERTEX_G, FREE_VERTEXUSE, FREE_VERTEXUSE_A_CNURB, FREE_VERTEXUSE_A_PLANE, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, NMG_CK_VERTEXUSE_A_EITHER, NMG_EDGEUSE_MAGIC, NMG_LOOPUSE_MAGIC, nmg_shell_is_empty(), NMG_SHELL_MAGIC, NMG_VERTEXUSE_A_CNURB_MAGIC, NMG_VERTEXUSE_A_PLANE_MAGIC, NULL, rt_bomb(), vertex::vg_p, and vertex::vu_hd.

Here is the call graph for this function:

int nmg_keu register struct edgeuse eu1  ) 
 

Definition at line 1420 of file nmg_mk.c.

References BU_LIST_DEQUEUE, BU_LIST_IS_EMPTY, bu_log(), DEBUG_BASIC, loopuse::down_hd, edgeuse::e_p, edge::eu_p, edgeuse::eumate_p, FREE_EDGE, FREE_EDGEUSE, edgeuse::g, edgeuse::l, edgeuse::l2, edgeuse::lu_p, loopuse::lumate_p, edgeuse::magic_p, NMG_CK_EDGE, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, nmg_keg(), nmg_kvu(), NMG_LOOPUSE_MAGIC, nmg_shell_is_empty(), NMG_SHELL_MAGIC, NULL, edgeuse::radial_p, rt_bomb(), edgeuse::s_p, edgeuse::up, loopuse::up, void(), and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_vertex_gv struct vertex v,
const fastf_t pt
 

N M G _ V E R T E X _ G V

Associate point_t ("vector") coordinates with a vertex

Definition at line 1650 of file nmg_mk.c.

References BU_LIST_NEXT, bu_log(), vertex_g::coord, DEBUG_BASIC, GET_VERTEX_G, vertex_g::magic, NMG_CK_VERTEX, NMG_CK_VERTEX_G, nmg_find_model(), NMG_VERTEX_G_MAGIC, V3ARGS, vertex::vg_p, VMOVE, and vertex::vu_hd.

Here is the call graph for this function:

void nmg_vertex_g register struct vertex v,
fastf_t  x,
fastf_t  y,
fastf_t  z
 

N M G _ V E R T E X _ G

a version that can take x, y, z coords and doesn't need a point array. Mostly useful for quick and dirty programs.

Definition at line 1682 of file nmg_mk.c.

References bu_log(), DEBUG_BASIC, and nmg_vertex_gv().

Here is the call graph for this function:

void nmg_vertexuse_nv struct vertexuse vu,
const fastf_t norm
 

N M G _ V E R T E X U S E _ N V

Assign a normal vector to a vertexuse

Definition at line 1702 of file nmg_mk.c.

References vertexuse::a, bu_log(), DEBUG_BASIC, GET_VERTEXUSE_A_PLANE, vertexuse::l, vertexuse_a_plane::magic, bu_list::magic, vertexuse::magic_p, vertexuse_a_plane::N, NMG_CK_VERTEXUSE, NMG_CK_VERTEXUSE_A_PLANE, nmg_find_model(), NMG_VERTEXUSE_A_CNURB_MAGIC, NMG_VERTEXUSE_A_PLANE_MAGIC, vertexuse::plane_p, rt_bomb(), V3ARGS, and VMOVE.

Here is the call graph for this function:

int nmg_use_edge_g struct edgeuse eu,
long int *  magic_p
 

N M G _ U S E _ E D G E _ G

Associate edgeuse 'eu' with the edge_g_X structure given as 'magic_p'. If the edgeuse is already associated with some geometry, release that first. Note that, to start with, the two edgeuses may be using different original geometries.

Also do the edgeuse mate.

Returns - 0 If the old edge geometry (eu->g.magic_p) has other uses. 1 If the old edge geometry has been destroyed. Caller beware!

Definition at line 2082 of file nmg_mk.c.

References bn_radtodeg, BU_LIST_DEQUEUE, BU_LIST_INSERT, bu_log(), DEBUG_BASIC, edge_g_lseg::e_dir, edge_g_lseg::eu_hd2, edgeuse::eumate_p, edgeuse::g, edgeuse::l2, edgeuse::lseg_p, edgeuse::magic_p, NMG_CK_EDGE_G_LSEG, NMG_CK_EDGEUSE, nmg_keg(), NULL, rt_bomb(), VDOT, VMOVE, VPRINT, and VUNITIZE.

Here is the call graph for this function:

void nmg_face_g struct faceuse fu,
const fastf_t p
 

N M G _ F A C E _ G

Assign plane equation to face. XXX Should probably be called nmg_face_g_plane()

In the interest of modularity this no longer calls nmg_face_bb().

Definition at line 2251 of file nmg_mk.c.

References BU_LIST_APPEND, BU_LIST_INIT, bu_log(), DEBUG_BASIC, ELEMENTS_PER_PLANE, face_g_plane::f_hd, faceuse::f_p, face::flip, faceuse::fumate_p, face::g, GET_FACE_G_PLANE, HMOVE, face::l, faceuse::l, face_g_plane::magic, bu_list::magic, face_g_plane::N, NMG_CK_FACE, NMG_CK_FACE_G_PLANE, NMG_CK_FACEUSE, NMG_FACE_G_PLANE_MAGIC, nmg_find_model(), faceuse::orientation, OT_OPPOSITE, OT_SAME, face::plane_p, and V4ARGS.

Here is the call graph for this function:

void nmg_face_new_g struct faceuse fu,
const fastf_t pl
 

N M G _ F A C E _ N E W _ P L A N E

Assign plane equation to this face. If other faces use current geometry for this face, then make a new geometry for this face.

Definition at line 2298 of file nmg_mk.c.

References BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_INIT, bu_log(), DEBUG_BASIC, face_g_plane::f_hd, faceuse::f_p, face::flip, faceuse::fumate_p, face::g, GET_FACE_G_PLANE, HMOVE, faceuse::l, face::l, face_g_plane::magic, bu_list::magic, face_g_plane::N, NMG_CK_FACE, NMG_CK_FACEUSE, nmg_face_g(), NMG_FACE_G_PLANE_MAGIC, nmg_find_model(), faceuse::orientation, OT_OPPOSITE, OT_SAME, face::plane_p, and V4ARGS.

Here is the call graph for this function:

void nmg_jv register struct vertex v1,
register struct vertex v2
 

N M G _ J V

Join two vertexes into one. v1 inherits all the vertexuses presently pointing to v2, and v2 is then destroyed.

Definition at line 2922 of file nmg_mk.c.

References BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_INSERT, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), DEBUG_BASIC, FREE_VERTEX, FREE_VERTEX_G, vertexuse::l, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, and vertexuse::v_p.

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