nmg_misc.c File Reference

#include "common.h"
#include <math.h>
#include <stdio.h>
#include <strings.h>
#include "machine.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "nurb.h"
#include "rtgeom.h"
#include "db.h"

Include dependency graph for nmg_misc.c:

Go to the source code of this file.

Data Structures

struct  top_face
struct  nmg_split_loops_state
struct  nmg_unbreak_state
struct  intersect_fus
struct  dangle

Defines

#define NMG_PUSH(_ptr, _stack)   bu_ptbl_ins( _stack , (long *) _ptr );
#define EDGE_COLLAPSE_DEBUG   0

Functions

int nmg_snurb_calc_lu_uv_orient (const struct loopuse *lu)
void nmg_snurb_fu_eval (const struct faceuse *fu, const fastf_t u, const fastf_t v, fastf_t *pt_on_srf)
void nmg_snurb_fu_get_norm (const struct faceuse *fu, const fastf_t u, const fastf_t v, fastf_t *norm)
void nmg_snurb_fu_get_norm_at_vu (const struct faceuse *fu, const struct vertexuse *vu, fastf_t *norm)
void nmg_find_zero_length_edges (const struct model *m)
facenmg_find_top_face_in_dir (const struct shell *s, int dir, long int *flags)
facenmg_find_top_face (const struct shell *s, int *dir, long int *flags)
int nmg_find_outer_and_void_shells (struct nmgregion *r, struct bu_ptbl ***shells, const struct bn_tol *tol)
int nmg_mark_edges_real (const long int *magic_p)
void nmg_tabulate_face_g_verts (struct bu_ptbl *tab, const struct face_g_plane *fg)
void nmg_isect_shell_self (struct shell *s, const struct bn_tol *tol)
edgeusenmg_next_radial_eu (const struct edgeuse *eu, const struct shell *s, const int wires)
edgeusenmg_prev_radial_eu (const struct edgeuse *eu, const struct shell *s, const int wires)
int nmg_radial_face_count (const struct edgeuse *eu, const struct shell *s)
int nmg_check_closed_shell (const struct shell *s, const struct bn_tol *tol)
int nmg_move_lu_between_fus (struct faceuse *dest, struct faceuse *src, struct loopuse *lu)
void nmg_loop_plane_newell (const struct loopuse *lu, fastf_t *pl)
fastf_t nmg_loop_plane_area (const struct loopuse *lu, fastf_t *pl)
int nmg_calc_face_plane (struct faceuse *fu_in, fastf_t *pl)
int nmg_calc_face_g (struct faceuse *fu)
fastf_t nmg_faceuse_area (const struct faceuse *fu)
fastf_t nmg_shell_area (const struct shell *s)
fastf_t nmg_region_area (const struct nmgregion *r)
fastf_t nmg_model_area (const struct model *m)
int rt_dist_line3_line3 (fastf_t *dist, const fastf_t *p1, const fastf_t *d1, const fastf_t *p2, const fastf_t *d2, const struct bn_tol *tol)
int rt_dist_line3_lseg3 (fastf_t *dist, const fastf_t *p, const fastf_t *d, const fastf_t *a, const fastf_t *b, const struct bn_tol *tol)
void nmg_purge_unwanted_intersection_points (struct bu_ptbl *vert_list, fastf_t *mag_list, const struct faceuse *fu, const struct bn_tol *tol)
int nmg_in_or_ref (struct vertexuse *vu, struct bu_ptbl *b)
void nmg_rebound (struct model *m, const struct bn_tol *tol)
void nmg_count_shell_kids (const struct model *m, long unsigned int *total_faces, long unsigned int *total_wires, long unsigned int *total_points)
void nmg_close_shell (struct shell *s, const struct bn_tol *tol)
shellnmg_dup_shell (struct shell *s, long int ***trans_tbl, const struct bn_tol *tol)
edgeusenmg_pop_eu (struct bu_ptbl *stack)
void nmg_reverse_radials (struct faceuse *fu, const struct bn_tol *tol)
void nmg_reverse_face_and_radials (struct faceuse *fu, const struct bn_tol *tol)
int nmg_shell_is_void (const struct shell *s)
void nmg_propagate_normals (struct faceuse *fu_in, long int *flags, const struct bn_tol *tol)
void nmg_connect_same_fu_orients (struct shell *s)
void nmg_fix_decomposed_shell_normals (struct shell *s, const struct bn_tol *tol)
modelnmg_mk_model_from_region (struct nmgregion *r, int reindex)
void nmg_fix_normals (struct shell *s_orig, const struct bn_tol *tol)
int nmg_break_long_edges (struct shell *s, const struct bn_tol *tol)
faceusenmg_mk_new_face_from_loop (struct loopuse *lu)
void nmg_split_loops_handler (long int *fu_p, genptr_t sl_state, int after)
int nmg_split_loops_into_faces (long int *magic_p, const struct bn_tol *tol)
int nmg_decompose_shell (struct shell *s, const struct bn_tol *tol)
void nmg_stash_model_to_file (const char *filename, const struct model *m, const char *title)
void nmg_unbreak_handler (long int *eup, genptr_t state, int after)
int nmg_unbreak_region_edges (long int *magic_p)
int rt_dist_pt3_line3 (fastf_t *dist, fastf_t *pca, const fastf_t *a, const fastf_t *dir, const fastf_t *p, const struct bn_tol *tol)
int nmg_mv_shell_to_region (struct shell *s, struct nmgregion *r)
int nmg_find_isect_faces (const struct vertex *new_v, struct bu_ptbl *faces, int *free_edges, const struct bn_tol *tol)
int nmg_simple_vertex_solve (struct vertex *new_v, const struct bu_ptbl *faces, const struct bn_tol *tol)
int nmg_ck_vert_on_fus (const struct vertex *v, const struct bn_tol *tol)
void nmg_make_faces_at_vert (struct vertex *new_v, struct bu_ptbl *int_faces, const struct bn_tol *tol)
void nmg_kill_cracks_at_vertex (const struct vertex *vp)
int nmg_complex_vertex_solve (struct vertex *new_v, const struct bu_ptbl *faces, const int free_edges, const int approximate, const struct bn_tol *tol)
int nmg_bad_face_normals (const struct shell *s, const struct bn_tol *tol)
int nmg_faces_are_radial (const struct faceuse *fu1, const struct faceuse *fu2)
int nmg_move_edge_thru_pt (struct edgeuse *mv_eu, const fastf_t *pt, const struct bn_tol *tol)
void nmg_vlist_to_wire_edges (struct shell *s, const struct bu_list *vhead)
void nmg_follow_free_edges_to_vertex (const struct vertex *vpa, const struct vertex *vpb, struct bu_ptbl *bad_verts, const struct shell *s, const struct edgeuse *eu, struct bu_ptbl *verts, int *found)
void nmg_glue_face_in_shell (const struct faceuse *fu, struct shell *s, const struct bn_tol *tol)
int nmg_open_shells_connect (struct shell *dst, struct shell *src, const long int **copy_tbl, const struct bn_tol *tol)
int nmg_in_vert (struct vertex *new_v, const int approximate, const struct bn_tol *tol)
void nmg_mirror_model (struct model *m)
int nmg_kill_cracks (struct shell *s)
int nmg_kill_zero_length_edgeuses (struct model *m)
void nmg_make_faces_within_tol (struct shell *s, const struct bn_tol *tol)
void nmg_intersect_loops_self (struct shell *s, const struct bn_tol *tol)
edge_g_cnurbrt_join_cnurbs (struct bu_list *crv_head)
edge_g_cnurbrt_arc2d_to_cnurb (fastf_t *i_center, fastf_t *i_start, fastf_t *i_end, int point_type, const struct bn_tol *tol)
int nmg_break_edge_at_verts (struct edge *e, struct bu_ptbl *verts, const struct bn_tol *tol)
int nmg_break_edges (long int *magic_p, const struct bn_tol *tol)
int nmg_to_arb (const struct model *m, struct rt_arb_internal *arb_int)
int nmg_to_tgc (const struct model *m, struct rt_tgc_internal *tgc_int, const struct bn_tol *tol)
int nmg_lu_is_convex (struct loopuse *lu, const struct bn_tol *tol)
int nmg_to_poly (const struct model *m, struct rt_pg_internal *poly_int, const struct bn_tol *tol)
int nmg_simplify_shell_edges (struct shell *s, const struct bn_tol *tol)
int nmg_select_collapse (const fastf_t max_dist1, const fastf_t max_dot1, const int flip1, const fastf_t max_dist2, const fastf_t max_dot2, const int flip2, const fastf_t max_dot, const fastf_t tol_dist)
int nmg_edge_collapse (struct model *m, const struct bn_tol *tol, const fastf_t tol_coll, const fastf_t min_angle)
rt_bot_internalnmg_bot (struct shell *s, const struct bn_tol *tol)
void nmg_vlist_to_eu (struct bu_list *vlist, struct shell *s)


Detailed Description

As the name implies, these are miscellaneous routines that work with the NMG structures.

Authors - John R. Anderson Lee A. Butler Michael John Muuss

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

Definition in file nmg_misc.c.


Define Documentation

#define NMG_PUSH _ptr,
_stack   )     bu_ptbl_ins( _stack , (long *) _ptr );
 

Definition at line 3175 of file nmg_misc.c.

Referenced by nmg_propagate_normals().

#define EDGE_COLLAPSE_DEBUG   0
 

Definition at line 11255 of file nmg_misc.c.


Function Documentation

void nmg_snurb_fu_eval const struct faceuse fu,
const fastf_t  u,
const fastf_t  v,
fastf_t pt_on_srf
 

Definition at line 189 of file nmg_misc.c.

References bu_log(), faceuse::f_p, face::g, face::magic_p, NMG_CK_FACE, NMG_CK_FACEUSE, NMG_FACE_G_SNURB_MAGIC, face_g_snurb::pt_type, rt_bomb(), RT_NURB_IS_PT_RATIONAL, rt_nurb_s_eval(), face::snurb_p, VMOVE, VSCALE, and VSETALLN.

Here is the call graph for this function:

void nmg_snurb_fu_get_norm const struct faceuse fu,
const fastf_t  u,
const fastf_t  v,
fastf_t norm
 

Definition at line 224 of file nmg_misc.c.

References bu_log(), faceuse::f_p, face::flip, face::g, face::magic_p, NMG_CK_FACE, NMG_CK_FACEUSE, NMG_FACE_G_SNURB_MAGIC, faceuse::orientation, OT_SAME, rt_bomb(), rt_nurb_s_norm(), face::snurb_p, and VREVERSE.

Here is the call graph for this function:

void nmg_snurb_fu_get_norm_at_vu const struct faceuse fu,
const struct vertexuse vu,
fastf_t norm
 

Definition at line 250 of file nmg_misc.c.

References vertexuse::a, bu_log(), vertexuse::cnurb_p, vertexuse::magic_p, NMG_CK_FACEUSE, NMG_CK_VERTEXUSE, NMG_CK_VERTEXUSE_A_CNURB, nmg_snurb_fu_get_norm(), NMG_VERTEXUSE_A_CNURB_MAGIC, vertexuse_a_cnurb::param, and rt_bomb().

Here is the call graph for this function:

struct face* nmg_find_top_face_in_dir const struct shell s,
int  dir,
long int *  flags
 

N M G _ F I N D _ T O P _ F A C E _ I N _ D I R

Finds the topmost face in a shell (in given direction). Expects to have a translation table (variable "flags") for the model, and will ignore face structures that have their flag set in the table.

dir must be X,Y, or Z

Definition at line 325 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), vertex_g::coord, DEBUG_BASIC, loopuse::down_hd, edgeuse::e_p, edge::eu_p, vertexuse::eu_p, edgeuse::eumate_p, faceuse::f_p, shell::fu_hd, loopuse::fu_p, face::g, faceuse::lu_hd, edgeuse::lu_p, face::magic_p, loopuse::magic_p, edgeuse::magic_p, vertexuse::magic_p, MAX_FASTF, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, NMG_EDGEUSE_MAGIC, NMG_FACE_G_PLANE_MAGIC, NMG_FACE_G_SNURB_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_s_of_eu(), NMG_GET_FU_NORMAL, NMG_INDEX_TEST, NMG_LOOPUSE_MAGIC, nmg_snurb_fu_get_norm_at_vu(), NULL, edgeuse::radial_p, faceuse::s_p, loopuse::up, edgeuse::up, vertexuse::up, V3ARGS, vertexuse::v_p, VCROSS, vertex::vg_p, VSUB2, vertex::vu_hd, edgeuse::vu_p, VUNITIZE, and Z.

Here is the call graph for this function:

struct face* nmg_find_top_face const struct shell s,
int *  dir,
long int *  flags
 

N M G _ F I N D _ T O P _ F A C E

Finds the topmost face in a shell (in some direction). Expects to have a translation table (variable "flags") for the model, and will ignore face structures that have their flag set in the table.

returns the top face in some direction.

dir will be set to X, Y, or Z to indicate which top face was found.

Definition at line 627 of file nmg_misc.c.

References bu_log(), nmg_find_top_face_in_dir(), NULL, X, and Z.

Here is the call graph for this function:

int nmg_mark_edges_real const long int *  magic_p  ) 
 

N M G _ M A R K _ E D G E S _ R E A L

Sets the "is_real" flag on all edges at or below the pointer passed. Returns the number of flags set.

Definition at line 965 of file nmg_misc.c.

References BU_PTBL_END, BU_PTBL_GET, NMG_CK_EDGE, and nmg_edge_tabulate().

Here is the call graph for this function:

void nmg_loop_plane_newell const struct loopuse lu,
fastf_t pl
 

N M G _ L O O P _ P L A N E _ N E W E L L

Calculate the plane equation of a loop using Newell's Method (See "Graphics Gems III", David Kirk editor, Academic Press, Inc. 1992)

If the loop orientation is OT_OPPOSITE, the normal of the plane is reversed.

Definition at line 1388 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, vertex_g::coord, loopuse::down_hd, H, HREVERSE, edgeuse::l, MAX_FASTF, NMG_CK_LOOPUSE, NMG_EDGEUSE_MAGIC, nmg_loop_is_a_crack(), loopuse::orientation, OT_OPPOSITE, vertexuse::v_p, VDOT, vertex::vg_p, VMOVE, VSETALL, edgeuse::vu_p, VUNITIZE, X, Y, and Z.

Here is the call graph for this function:

fastf_t nmg_loop_plane_area const struct loopuse lu,
fastf_t pl
 

N M G _ L O O P _ P L A N E _ A R E A

Calculates a plane equation and the area of a loop

returns: the area of the loop less than zero indicates an error

pl is assigned the plane equation for the loop

Definition at line 1465 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, vertex_g::coord, loopuse::down_hd, HMOVE, edgeuse::l, MAGNITUDE, NMG_CK_EDGEUSE, NMG_CK_LOOPUSE, NMG_CK_VERTEX, NMG_CK_VERTEX_G, NMG_CK_VERTEXUSE, NMG_EDGEUSE_MAGIC, nmg_loop_is_a_crack(), SMALL_FASTF, trans, vertexuse::v_p, VADD2, VCROSS, VDOT, vertex::vg_p, VMOVE, VSCALE, VSET, VSUB2, and edgeuse::vu_p.

Here is the call graph for this function:

int nmg_calc_face_plane struct faceuse fu_in,
fastf_t pl
 

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

Calculate face geometry using a least squares fit or Newell's method.

If fu does not already have a face_g_plane associated, only vertices in fu will participate, and if it has only one loop Newell's method will be used rather than a least square fit.

if fu has a face_g_plane, then all vertices in any face that references the same face_g_plane will participate in the fit for the face plane.

Returns: 0 - All is well 1 - Failed to calculate face geometry

Definition at line 1578 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, vertex_g::coord, loopuse::down_hd, face_g_plane::f_hd, faceuse::f_p, face::fu_p, faceuse::fumate_p, face::g, HMOVE, faceuse::l, faceuse::lu_hd, bu_list::magic, MAT_ZERO, MAX_FASTF, NMG_CK_FACE, NMG_CK_FACE_G_PLANE, NMG_CK_FACEUSE, NMG_EDGEUSE_MAGIC, nmg_loop_plane_newell(), nmg_tabulate_face_g_verts(), nmg_vertex_tabulate(), faceuse::orientation, OT_SAME, OT_UNSPEC, face::plane_p, VSET, X, Y, and Z.

Here is the call graph for this function:

int rt_dist_line3_line3 fastf_t dist,
const fastf_t p1,
const fastf_t d1,
const fastf_t p2,
const fastf_t d2,
const struct bn_tol tol
 

R T _ D I S T _ L I N E 3 _ L I N E 3

Calculate closest approach of two lines

returns: -2 -> lines are parallel and do not intersect -1 -> lines are parallel and collinear 0 -> lines intersect 1 -> lines do not intersect For return values less than zero, dist is not set. For return valuse of 0 or 1, dist[0] is the distance from p1 in the d1 direction to the point of closest approach for that line. Similar for the second line. d1 and d2 must be unit direction vectors. XXX How is this different from bn_isect_line3_line3() ? XXX Why are the calling sequences just slightly different? XXX Can we pick the better one, and get rid of the other one? XXX If not, can we document how they differ?

Definition at line 1949 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_line3_pt3(), BN_VECT_ARE_PARALLEL, bu_log(), bn_tol::dist, bn_tol::dist_sq, MAGNITUDE, MAGSQ, NEAR_ZERO, rt_bomb(), V3ARGS, VDOT, VJOIN1, and VSUB2.

Here is the call graph for this function:

int rt_dist_line3_lseg3 fastf_t dist,
const fastf_t p,
const fastf_t d,
const fastf_t a,
const fastf_t b,
const struct bn_tol tol
 

R T _ D I S T _ L I N E 3 _ L S E G 3

calculate intersection or closest approach of a line and a line segement.

returns: -2 -> line and line segment are parallel and collinear. -1 -> line and line segment are parallel, not collinear. 0 -> intersection between points a and b. 1 -> intersection outside a and b. 2 -> closest approach is between a and b. 3 -> closest approach is outside a and b.

dist[0] is actual distance from p in d direction to closest portion of segment. dist[1] is ratio of distance from a to b (0.0 at a, and 1.0 at b), dist[1] may be less than 0 or greater than 1. For return values less than 0, closest approach is defined as closest to point p. Direction vector, d, must be unit length. XXX This should be moved to libbn/plane.c XXX probably renamed as bn_dist_line3_line3().

Definition at line 2033 of file nmg_misc.c.

References BN_CK_TOL, bn_tol::dist, MAGNITUDE, rt_dist_line3_line3(), VDOT, VSCALE, and VSUB2.

Here is the call graph for this function:

void nmg_count_shell_kids const struct model m,
long unsigned int *  total_faces,
long unsigned int *  total_wires,
long unsigned int *  total_points
 

N M G _ C O U N T _ S H E L L _ K I D S

Definition at line 2350 of file nmg_misc.c.

References bu_calloc(), bu_free(), BU_LIST_FOR, edgeuse::e_p, shell::eu_hd, faceuse::f_p, shell::fu_hd, loopuse::l_p, shell::lu_hd, model::maxindex, NMG_CK_MODEL, NMG_INDEX_TEST_AND_SET, model::r_hd, nmgregion::s_hd, and shell::vu_p.

Here is the call graph for this function:

struct shell* nmg_dup_shell struct shell s,
long int ***  trans_tbl,
const struct bn_tol tol
 

N M G _ D U P _ S H E L L

Duplicate a shell and return the new copy. New shell is in the same region.

The vertex geometry is copied from the source faces into topologically distinct (new) vertex and vertex_g structs. They will start out being geometricly coincident, but it is anticipated that the caller will modify the geometry, e.g. as in an extrude operation.

NOTE: This routine creates a translation table that gives the correspondence between old and new structures, the caller is responsible for freeing this memory. Warning - NOT EVERY structure is assigned a correspondence.

Definition at line 2956 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), BU_LIST_FOR, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_ins(), DEBUG_BASIC, edgeuse::eumate_p, faceuse::f_p, faceuse::fumate_p, face::g, vertex::index, edgeuse::index, face_g_plane::index, faceuse::index, loopuse::index, loopuse::l, faceuse::l, faceuse::lu_hd, bu_list::magic, model::maxindex, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_CK_VERTEXUSE, nmg_dup_loop(), nmg_face_g(), nmg_find_model(), NMG_GET_FU_PLANE, nmg_gluefaces(), NMG_INDEX_ASSIGN, NMG_INDEX_GETP, nmg_jfg(), nmg_kvu(), nmg_me(), nmg_mf(), nmg_msv(), nmg_vertex_gv(), NULL, faceuse::orientation, OT_OPPOSITE, OT_SAME, face::plane_p, rt_bomb(), vertexuse::v_p, void(), and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_propagate_normals struct faceuse fu_in,
long int *  flags,
const struct bn_tol tol
 

N M G _ P R O P A G A T E _ N O R M A L S

This routine expects "fu_in" to have a correctly oriented normal. It then checks all faceuses in the same shell it can reach via radial structures, and reverses faces and modifies radial structures as needed to result in a consistent NMG shell structure. The "flags" variable is a translation table for the model, and as each face is checked, its flag is set. Faces with flags that have already been set will not be checked by this routine.

Definition at line 3366 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_ptbl_free(), bu_ptbl_init(), DEBUG_BASIC, loopuse::down_hd, edgeuse::eumate_p, faceuse::f_p, faceuse::fumate_p, faceuse::lu_hd, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_eu(), NMG_INDEX_SET, NMG_INDEX_TEST_AND_SET, nmg_pop_eu(), nmg_pr_fu_briefly(), NMG_PUSH, nmg_reverse_face(), nmg_reverse_face_and_radials(), nmg_reverse_radials(), NULL, faceuse::orientation, OT_OPPOSITE, OT_SAME, edgeuse::radial_p, rt_bomb(), stack, vertexuse::v_p, and edgeuse::vu_p.

Here is the call graph for this function:

void nmg_split_loops_handler long int *  fu_p,
genptr_t  sl_state,
int  after
 

Definition at line 4252 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_reset(), loopuse::down_hd, loopuse::l, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CLASS_AinB, nmg_classify_lu_lu(), NMG_EDGEUSE_MAGIC, nmg_face_bb(), nmg_face_g(), NMG_GET_FU_PLANE, NMG_INDEX_SET, NMG_INDEX_TEST_AND_SET, nmg_mk_new_face_from_loop(), nmg_move_lu_between_fus(), nmg_orientation(), loopuse::orientation, OT_OPPOSITE, OT_SAME, state, and nmg_split_loops_state::tol.

Referenced by nmg_split_loops_into_faces().

Here is the call graph for this function:

int nmg_split_loops_into_faces long int *  magic_p,
const struct bn_tol tol
 

N M G _ S P L I T _ L O O P S _ I N T O _ F A C E S

Visits each faceuse and splits disjoint loops into seperate faces.

Returns the number of faces modified.

Definition at line 4445 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), bu_free(), bu_log(), DEBUG_BASIC, nmg_split_loops_state::flags, model::maxindex, NMG_CK_MODEL, nmg_find_model(), nmg_split_loops_handler(), nmg_visit(), NULL, nmg_split_loops_state::split, and nmg_split_loops_state::tol.

Here is the call graph for this function:

void nmg_unbreak_handler long int *  eup,
genptr_t  state,
int  after
 

N M G _ U N B R E A K _ H A N D L E R

edgeuse visit routine for nmg_unbreak_region_edges.

checks if edgeuse "eu" and its successor are candidates to be unbroken. looks for two consectutive edgeuses sharing the same edge geometry. Checks that the middle vertex has no other uses, and, if so, kills the second edgeuse. Also moves the vu of the first edgeuse mate to the vu of the killed edgeuse mate.

Definition at line 5029 of file nmg_misc.c.

References bu_list_len(), BU_LIST_PNEXT_CIRC, bu_log(), edge_g_lseg::eu_hd2, nmg_unbreak_state::flags, edgeuse::g, edgeuse::lseg_p, NMG_CK_EDGE, NMG_CK_EDGE_G_EITHER, NMG_CK_EDGEUSE, NMG_CK_VERTEX, NMG_INDEX_TEST_AND_SET, nmg_unbreak_edge(), nmg_unbreak_state::unbroken, vertexuse::v_p, and edgeuse::vu_p.

Referenced by nmg_unbreak_region_edges().

Here is the call graph for this function:

int nmg_unbreak_region_edges long int *  magic_p  ) 
 

N M G _ U N B R E A K _ R E G I O N _ E D G E S

Uses the visit handler to call nmg_unbreak_handler for each edgeuse below the region (or any other NMG element).

returns the number of edges mended

Definition at line 5107 of file nmg_misc.c.

References bu_calloc(), bu_free(), bu_log(), DEBUG_BASIC, nmg_unbreak_state::flags, model::maxindex, NMG_CK_MODEL, nmg_find_model(), nmg_unbreak_handler(), nmg_visit(), NULL, and nmg_unbreak_state::unbroken.

Here is the call graph for this function:

int rt_dist_pt3_line3 fastf_t dist,
fastf_t pca,
const fastf_t a,
const fastf_t dir,
const fastf_t p,
const struct bn_tol tol
 

R T _ D I S T _ P T 3 _ L I N E 3

Find the distance from a point P to a line described by the endpoint A and direction dir, and the point of closest approach (PCA).

P * /. / . / . / . (dist) / . / . *------*--------> A PCA dir

There are three distinct cases, with these return codes - 0 P is within tolerance of point A. *dist = 0, pca=A. 1 P is within tolerance of line. *dist = 0, pca=computed. 2 P is "above/below" line. *dist=|PCA-P|, pca=computed.

XXX For efficiency, a version of this routine that provides the XXX distance squared would be faster. XXX This should be moved into libbn/plane.c, XXX probably named bn_dist_pt3_line3().

Definition at line 5166 of file nmg_misc.c.

References BN_CK_TOL, bu_log(), DEBUG_BASIC, bn_tol::dist_sq, MAGSQ, V3ARGS, VDOT, VJOIN1, VMOVE, VSUB2, and VUNITIZE.

Here is the call graph for this function:

int nmg_move_edge_thru_pt struct edgeuse mv_eu,
const fastf_t pt,
const struct bn_tol tol
 

N M G _ M O V E _ E D G E _ T H R U _ P T

moves indicated edgeuse (mv_eu) so that it passes thru the given point (pt). The direction of the edgeuse is not changed, so new edgeuse is parallel to the original.

plane equations of all radial faces on this edge are changed and all vertices (except one anchor point) in radial loops are adjusted Note that the anchor point is chosen arbitrarily.

returns: 1 - failure 0 - success

Definition at line 7690 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), BU_PTBL_END, bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_reset(), vertex_g::coord, loopuse::down_hd, edge_g_lseg::e_dir, edgeuse::e_p, edge_g_lseg::e_pt, edgeuse::eumate_p, faceuse::fumate_p, edgeuse::g, edgeuse::l, edgeuse::lseg_p, faceuse::lu_hd, bu_list::magic, edgeuse::magic_p, MAGNITUDE, model::maxindex, NMG_CK_EDGE_G_LSEG, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_MODEL, NMG_CK_VERTEX, nmg_edge_g(), NMG_EDGE_G_LSEG_MAGIC, nmg_face_g(), nmg_find_fu_of_eu(), nmg_find_isect_faces(), nmg_find_model(), NMG_GET_FU_NORMAL, NMG_INDEX_TEST_AND_SET, NMG_LOOPUSE_MAGIC, nmg_simple_vertex_solve(), nmg_vertex_gv(), NMG_VERTEXUSE_MAGIC, NULL, faceuse::orientation, edgeuse::orientation, OT_OPPOSITE, OT_SAME, edgeuse::radial_p, SQRT_SMALL_FASTF, V3ARGS, vertexuse::v_p, VADD2, VCROSS, VDOT, vertex::vg_p, VJOIN1, VMOVE, VREVERSE, VSCALE, VSUB2, edgeuse::vu_p, and VUNITIZE.

Here is the call graph for this function:

int nmg_open_shells_connect struct shell dst,
struct shell src,
const long int **  copy_tbl,
const struct bn_tol tol
 

Definition at line 8795 of file nmg_misc.c.

References dangle::bad_verts, BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_malloc(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), loopuse::down_hd, vertexuse::eu_p, edgeuse::eumate_p, faceuse::lu_hd, vertexuse::magic_p, dangle::needs_edge_breaking, nmg_check_closed_shell(), NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_EDGEUSE_MAGIC, NMG_INDEX_GETP, nmg_js(), NMG_VERTEXUSE_MAGIC, faceuse::orientation, OT_SAME, edgeuse::radial_p, vertexuse::up, dangle::v1, dangle::v2, V3ARGS, vertexuse::v_p, dangle::va, dangle::vb, vertex::vu_hd, and edgeuse::vu_p.

Here is the call graph for this function:

struct edge_g_cnurb* rt_arc2d_to_cnurb fastf_t i_center,
fastf_t i_start,
fastf_t i_end,
int  point_type,
const struct bn_tol tol
 

R T _ A R C 2 D _ T O _ C N U R B

Convert a 2D arc to a NURB curve. point_type indicates what type of CNURB is requested. The arc start, end, and center must be at the same Z coordinate value if point_type is RT_NURB_PT_XYZ. For values of point_type of RT_NURB_PT_XY or RT_NURB_PT_UV, the Z coordinate is ignored. (Note that point_type must be one of the point types defined in nurb.h). The arc is constructed counter-clockwise (as viewed from the +Z direction).

Definition at line 9850 of file nmg_misc.c.

References BN_CK_TOL, bn_isect_line3_line3(), bn_pi, BU_LIST_INIT, BU_LIST_INSERT, bu_log(), edge_g_cnurb::ctl_points, bn_tol::dist, edge_g_cnurb::k, knot_vector::knots, edge_g_cnurb::l, MAGNITUDE, NEAR_ZERO, NULL, rt_arc2d_to_cnurb(), RT_NURB_MAKE_PT_TYPE, rt_nurb_new_cnurb(), RT_NURB_PT_DATA, RT_NURB_PT_PROJ, RT_NURB_PT_RATIONAL, RT_NURB_PT_UV, RT_NURB_PT_XY, RT_NURB_PT_XYZ, VCROSS, VDOT, VJOIN1N, VJOIN2, VMOVE, VMOVEN, VREVERSE, VSCALE, VSCALEN, VSET, VSUB2, VUNITIZE, X, Y, and Z.

Here is the call graph for this function:

int nmg_break_edges long int *  magic_p,
const struct bn_tol tol
 

Definition at line 10112 of file nmg_misc.c.

References BN_CK_TOL, BU_PTBL_END, BU_PTBL_GET, nmg_break_edge_at_verts(), NMG_CK_EDGE, nmg_edge_tabulate(), and nmg_vertex_tabulate().

Here is the call graph for this function:

int nmg_to_arb const struct model m,
struct rt_arb_internal arb_int
 

N M G _ T O _ A R B

Converts an NMG to an ARB, if possible.

NMG must have been coplanar face merged and simplified

Returns: 1 - Equivalent ARB was constructed 0 - Cannot construct an equivalent ARB

The newly constructed arb is in "arb_int"

Definition at line 10334 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_NEXT_NOT_HEAD, BU_LIST_PNEXT_CIRC, bu_ptbl_free(), BU_PTBL_GET, vertex_g::coord, loopuse::down_hd, edgeuse::eumate_p, shell::fu_hd, faceuse::fumate_p, edgeuse::l, faceuse::l, shell::l, nmgregion::l, faceuse::lu_hd, NMG_CK_FACEUSE, NMG_CK_MODEL, NMG_CK_SHELL, NMG_CK_VERTEX, nmg_faces_are_radial(), nmg_find_fu_of_eu(), faceuse::orientation, OT_SAME, rt_arb_internal::pt, model::r_hd, edgeuse::radial_p, nmgregion::s_hd, vertexuse::v_p, vertex::vg_p, VMOVE, and edgeuse::vu_p.

Referenced by wdb_nmg_simplify_cmd().

Here is the call graph for this function:

int nmg_to_tgc const struct model m,
struct rt_tgc_internal tgc_int,
const struct bn_tol tol
 

N M G _ T O _ T G C

Converts an NMG to a TGC, if possible.

NMG must have been coplanar face merged and simplified

Returns: 1 - Equivalent TGC was constructed 0 - Cannot construct an equivalent TGC

The newly constructed tgc is in "tgc_int"

Currently only supports RCC, and creates circumscribed RCC

Definition at line 10585 of file nmg_misc.c.

References BN_CK_TOL, bn_vec_perp(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NEXT_NOT_HEAD, vertex_g::coord, loopuse::down_hd, shell::fu_hd, shell::l, nmgregion::l, faceuse::lu_hd, MAGSQ, MAX_FASTF, NEAR_ZERO, NMG_CK_EDGEUSE, NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_MODEL, NMG_CK_SHELL, NMG_CK_VERTEX, NMG_CK_VERTEX_G, NMG_CK_VERTEXUSE, NMG_EDGEUSE_MAGIC, NMG_GET_FU_PLANE, NULL, faceuse::orientation, OT_SAME, RT_TGC_INTERNAL_MAGIC, nmgregion::s_hd, vertexuse::v_p, VADD2, VCROSS, VDOT, vertex::vg_p, VMOVE, VSCALE, VSETALL, VSUB2, edgeuse::vu_p, and VUNITIZE.

Referenced by wdb_nmg_simplify_cmd().

Here is the call graph for this function:

int nmg_to_poly const struct model m,
struct rt_pg_internal poly_int,
const struct bn_tol tol
 

N M G _ T O _ P O L Y

XXX This routine is deprecated in favor of BoTs

Definition at line 10898 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), vertex_g::coord, loopuse::down_hd, shell::fu_hd, faceuse::lu_hd, rt_pg_internal::magic, nmg_check_closed_shell(), NMG_CK_FACEUSE, NMG_CK_LOOPUSE, NMG_CK_MODEL, NMG_CK_VERTEX_G, nmg_dup_face(), NMG_EDGEUSE_MAGIC, NMG_GET_FU_NORMAL, nmg_km(), nmg_lu_is_convex(), nmg_mm(), nmg_mrsv(), nmg_triangulate_fu(), rt_pg_internal::rt_pg_face_internal::norms, rt_pg_internal::npoly, rt_pg_internal::rt_pg_face_internal::npts, loopuse::orientation, faceuse::orientation, OT_SAME, rt_pg_internal::poly, model::r_hd, RT_PG_INTERNAL_MAGIC, nmgregion::s_hd, vertexuse::v_p, rt_pg_internal::rt_pg_face_internal::verts, vertex::vg_p, VMOVE, void(), and edgeuse::vu_p.

Referenced by wdb_nmg_simplify_cmd().

Here is the call graph for this function:

int nmg_select_collapse const fastf_t  max_dist1,
const fastf_t  max_dot1,
const int  flip1,
const fastf_t  max_dist2,
const fastf_t  max_dot2,
const int  flip2,
const fastf_t  max_dot,
const fastf_t  tol_dist
 

Definition at line 11258 of file nmg_misc.c.

References bu_log().

Referenced by nmg_edge_collapse().

Here is the call graph for this function:

void nmg_vlist_to_eu struct bu_list vlist,
struct shell s
 

N M G _ V L I S T _ T O _ E U

create wire edges corresponding to the lines in the vlist. The wire edges are created in the specified shell

Definition at line 12143 of file nmg_misc.c.

References BN_VLIST_LINE_DRAW, BN_VLIST_LINE_MOVE, BN_VLIST_POLY_DRAW, BN_VLIST_POLY_END, BN_VLIST_POLY_MOVE, BN_VLIST_POLY_START, BU_LIST_FOR, bn_vlist::cmd, edgeuse::eumate_p, nmg_me(), nmg_vertex_gv(), NULL, bn_vlist::nused, bn_vlist::pt, vertexuse::v_p, VMOVE, and edgeuse::vu_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