BRL-CAD
#include "common.h"
#include <math.h>
#include <string.h>
#include "bio.h"
#include "vmath.h"
#include "nmg.h"
#include "rtgeom.h"
#include "raytrace.h"
#include "nurb.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
 

Macros

#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)
 
struct face * nmg_find_top_face_in_dir (const struct shell *s, int dir, long int *flags)
 
struct face * nmg_find_top_face (const struct shell *s, int *dir, long int *flags)
 
HIDDEN void nmg_assoc_void_shells (const struct nmgregion *r, struct bu_ptbl *shells, const struct bn_tol *ttol)
 
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 uint32_t *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)
 
struct edgeuse * nmg_next_radial_eu (const struct edgeuse *eu, const struct shell *s, const int wires)
 
struct edgeuse * nmg_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)
 
fastf_t nmg_loop_plane_area2 (const struct loopuse *lu, fastf_t *pl, const struct bn_tol *tol)
 
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)
 
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, size_t *total_faces, size_t *total_wires, size_t *total_points)
 
HIDDEN void order_tbl (struct bu_ptbl *tbl, int start_idx, int **idx, int tbl_size, int *loop_size)
 
void nmg_close_shell (struct shell *s, const struct bn_tol *tol)
 
struct shell * nmg_dup_shell (struct shell *s, long int ***trans_tbl, const struct bn_tol *tol)
 
struct edgeuse * nmg_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)
 
HIDDEN void nmg_disconnect_shells (struct nmgregion *r)
 
void nmg_connect_same_fu_orients (struct shell *s)
 
void nmg_fix_decomposed_shell_normals (struct shell *s, const struct bn_tol *tol)
 
struct model * nmg_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)
 
struct faceuse * nmg_mk_new_face_from_loop (struct loopuse *lu)
 
void nmg_split_loops_handler (uint32_t *fu_p, void *sl_state, int unused)
 
int nmg_split_loops_into_faces (uint32_t *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 (uint32_t *eup, void *state, int unused)
 
int nmg_unbreak_region_edges (uint32_t *magic_p)
 
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)
 
HIDDEN void nmg_pr_inter (const struct vertex *new_v, const struct bu_ptbl *int_faces)
 
HIDDEN int nmg_get_edge_lines (struct vertex *new_v, struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
HIDDEN int nmg_get_max_edge_inters (const struct vertex *new_v, struct bu_ptbl *int_faces, const struct bu_ptbl *faces, const struct bn_tol *tol)
 
HIDDEN void nmg_fuse_inters (struct intersect_fus *i_fus, struct intersect_fus *j_fus, struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
HIDDEN void nmg_split_edges_at_pts (const struct vertex *new_v, struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
HIDDEN void nmg_remove_short_eus_inter (struct vertex *new_v, struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
HIDDEN void nmg_simplify_inter (const struct vertex *new_v, struct bu_ptbl *int_faces, 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)
 
HIDDEN fastf_t nmg_dist_to_cross (const struct intersect_fus *i_fus, const struct intersect_fus *j_fus, fastf_t *new_pt, const struct bn_tol *tol)
 
HIDDEN void nmg_fix_crossed_loops (struct vertex *new_v, struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
HIDDEN int nmg_calc_new_v (struct vertex *new_v, const struct bu_ptbl *int_faces, const struct bn_tol *tol)
 
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)
 
HIDDEN struct bu_ptblnmg_find_path (const struct vertex *vpa, const struct vertex *vpb, struct bu_ptbl *bad_verts, const struct shell *s)
 
void nmg_glue_face_in_shell (const struct faceuse *fu, struct shell *s, const struct bn_tol *tol)
 
HIDDEN int nmg_make_connect_faces (struct shell *dst, struct vertex *vpa, struct vertex *vpb, struct bu_ptbl *verts, 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)
 
struct edge_g_cnurb * rt_join_cnurbs (struct bu_list *crv_head)
 
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)
 
int nmg_break_edge_at_verts (struct edge *e, struct bu_ptbl *verts, const struct bn_tol *tol)
 
int nmg_break_edges (uint32_t *magic_p, const struct bn_tol *tol)
 
HIDDEN int Shell_is_arb (struct shell *s, struct bu_ptbl *tab)
 
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)
 
struct rt_bot_internal * nmg_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.

Definition in file nmg_misc.c.

Macro Definition Documentation

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

Definition at line 2840 of file nmg_misc.c.

Referenced by nmg_propagate_normals().

#define EDGE_COLLAPSE_DEBUG   0

Definition at line 10144 of file nmg_misc.c.

Function Documentation

int nmg_snurb_calc_lu_uv_orient ( const struct loopuse *  lu)

Definition at line 46 of file nmg_misc.c.

References bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, NMG_CK_LOOPUSE(), NMG_EDGE_G_CNURB_MAGIC, NMG_EDGEUSE_MAGIC, NMG_FACE_G_SNURB_MAGIC, NMG_FACEUSE_MAGIC, NMG_VERTEXUSE_A_CNURB_MAGIC, rt_nurb_c_eval(), VSETALL, and Z.

Here is the call graph for this function:

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 160 of file nmg_misc.c.

References bu_bomb(), bu_log(), NMG_FACE_G_SNURB_MAGIC, and rt_nurb_s_eval().

Referenced by nmg_snurb_fu_to_vlist().

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 192 of file nmg_misc.c.

References bu_bomb(), bu_log(), NMG_FACE_G_SNURB_MAGIC, and rt_nurb_s_norm().

Referenced by nmg_snurb_fu_get_norm_at_vu(), and nmg_snurb_fu_to_vlist().

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 217 of file nmg_misc.c.

References bu_bomb(), bu_log(), nmg_snurb_fu_get_norm(), and NMG_VERTEXUSE_A_CNURB_MAGIC.

Referenced by nmg_find_top_face_in_dir().

Here is the call graph for this function:

void nmg_find_zero_length_edges ( const struct model *  m)

Definition at line 245 of file nmg_misc.c.

References bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), lu, nmg_edgeuse_tabulate(), NMG_LOOPUSE_MAGIC, and nmg_pr_lu_briefly().

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 
)

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 290 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, lu, MAX_FASTF, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACE_G_PLANE_MAGIC, NMG_FACE_G_SNURB_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_s_of_eu(), NMG_LOOPUSE_MAGIC, nmg_snurb_fu_get_norm_at_vu(), RTG, V3ARGS, and Z.

Referenced by nmg_find_outer_and_void_shells(), and nmg_find_top_face().

Here is the call graph for this function:

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

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 526 of file nmg_misc.c.

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

Referenced by nmg_assoc_void_shells(), nmg_fix_decomposed_shell_normals(), and nmg_shell_is_void().

Here is the call graph for this function:

HIDDEN void nmg_assoc_void_shells ( const struct nmgregion *  r,
struct bu_ptbl shells,
const struct bn_tol ttol 
)

Definition at line 563 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), BU_CK_PTBL, bu_free(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), BU_PTBL_GET, bu_ptbl_ins(), top_face::dir, top_face::f, lu, NMG_CK_SHELL(), nmg_class_pt_s(), NMG_EDGEUSE_MAGIC, nmg_find_top_face(), top_face::normal, top_face::s, and s.

Referenced by nmg_find_outer_and_void_shells().

Here is the call graph for this function:

int nmg_find_outer_and_void_shells ( struct nmgregion *  r,
struct bu_ptbl ***  shells,
const struct bn_tol tol 
)

This routine takes a region and constructs an array of bu_ptbl lists. A list is created for each outer shell, and that shell is the first item on the list. Additional shells on any list are void shells within that lists outer shell. This routine calls "nmg_decompose_shell" for every shell in the region, so the original region topology may be changed to accomplish this. No geometry is altered.

Definition at line 756 of file nmg_misc.c.

References BN_CK_TOL, BU_ALLOC, bu_bomb(), bu_calloc(), BU_CK_PTBL, bu_free(), BU_LIST_FOR, bu_malloc(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_reset(), nmg_assoc_void_shells(), NMG_CK_SHELL(), nmg_decompose_shell(), nmg_find_top_face_in_dir(), nmg_region_a(), s, X, and Z.

Here is the call graph for this function:

int nmg_mark_edges_real ( const uint32_t *  magic_p)

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

Definition at line 846 of file nmg_misc.c.

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

Referenced by brep_to_nmg(), rt_arb_tess(), rt_arb_tnurb(), rt_arbn_tess(), rt_ars_tess(), rt_bot_tess(), rt_dsp_tess(), rt_ebm_tess(), rt_epa_tess(), rt_metaball_tess(), rt_rhc_tess(), rt_rpc_tess(), and rt_vol_tess().

Here is the call graph for this function:

void nmg_tabulate_face_g_verts ( struct bu_ptbl tab,
const struct face_g_plane *  fg 
)

Tabulates all vertices in faces that use fg

Definition at line 873 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_ptbl_init(), bu_ptbl_ins_unique(), lu, NMG_CK_LOOPUSE(), NMG_VERTEXUSE_MAGIC, and OSL::Strings::v.

Referenced by nmg_brep_face(), and nmg_calc_face_plane().

Here is the call graph for this function:

void nmg_isect_shell_self ( struct shell *  s,
const struct bn_tol tol 
)

Intersects all faces in a shell with all other faces in the same shell Intended for use after extrusion

Definition at line 936 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_NON_EMPTY, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), f2, NMG_CK_SHELL(), rt_g::NMG_debug, nmg_faces_are_radial(), nmg_find_model(), nmg_isect_two_generic_faces(), nmg_ks(), nmg_msv(), nmg_mv_fu_between_shells(), nmg_vmodel(), and RTG.

Referenced by nmg_extrude_cleanup().

Here is the call graph for this function:

struct edgeuse* nmg_next_radial_eu ( const struct edgeuse *  eu,
const struct shell *  s,
const int  wires 
)

Traverse radial edgeuse around specified edgeuse looking for one that meets optional restrictions. If a shell is specified only edgeuse from that shell will be considered. If wires is non-zero, wire edges will be considered, otherwise, wire edges are ignored.

returns: radial edgeuse

Definition at line 1039 of file nmg_misc.c.

References bu_bomb(), NMG_CK_SHELL(), nmg_find_fu_of_eu(), and nmg_find_s_of_eu().

Referenced by nmg_check_closed_shell(), nmg_decompose_shell(), and Shell_is_arb().

Here is the call graph for this function:

struct edgeuse* nmg_prev_radial_eu ( const struct edgeuse *  eu,
const struct shell *  s,
const int  wires 
)

Traverse radial edgeuse around specified edgeuse in opposite direction from nmg_next_radial_eu, looking for one that meets optional restrictions. If a shell is specified only edgeuse from that shell will be considered. If wires is non-zero, wire edges will be considered, otherwise, wire edges are ignored.

returns: radial edgeuse

Definition at line 1077 of file nmg_misc.c.

References bu_bomb(), NMG_CK_SHELL(), nmg_find_fu_of_eu(), and nmg_find_s_of_eu().

Referenced by nmg_decompose_shell().

Here is the call graph for this function:

int nmg_radial_face_count ( const struct edgeuse *  eu,
const struct shell *  s 
)

Counts the number of faces (actually, the number of radial edgeuse/mate pairs) around eu. If s is specified, only edgeuses in shell s are counted. Wire edgeuses are not counted.

returns: number of edgeuse/mate pairs radially around eu that meet restrictions

Definition at line 1109 of file nmg_misc.c.

References eu1, NMG_CK_SHELL(), nmg_find_fu_of_eu(), and nmg_find_s_of_eu().

Referenced by nmg_decompose_shell().

Here is the call graph for this function:

int nmg_check_closed_shell ( const struct shell *  s,
const struct bn_tol tol 
)

Looks at every eu in OT_SAME fu's. If any eu has no radials, then it must be the edge of a dangling face and therefore the edge of an opening.

returns: 0 - O.K. 1 - found a hole

Definition at line 1142 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, and nmg_next_radial_eu().

Referenced by nmg_hollow_shell(), nmg_open_shells_connect(), and nmg_to_poly().

Here is the call graph for this function:

int nmg_move_lu_between_fus ( struct faceuse *  dest,
struct faceuse *  src,
struct loopuse *  lu 
)

Moves lu from src faceuse to dest faceuse

returns: 0 - All is well 1 - src faceuse is now empty

Definition at line 1187 of file nmg_misc.c.

References bu_bomb(), BU_LIST_DEQUEUE, BU_LIST_INSERT, BU_LIST_IS_EMPTY, bu_log(), NMG_CK_LOOPUSE(), rt_g::NMG_debug, and RTG.

Referenced by nmg_split_loops_handler().

Here is the call graph for this function:

void nmg_loop_plane_newell ( const struct loopuse *  lu,
fastf_t pl 
)

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 1250 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, MAX_FASTF, NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, nmg_loop_is_a_crack(), X, Y, and Z.

Referenced by nmg_calc_face_plane(), nmg_ck_lu_orientation(), and nmg_lu_reorient().

Here is the call graph for this function:

fastf_t nmg_loop_plane_area ( const struct loopuse *  lu,
fastf_t pl 
)

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 1320 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, and nmg_loop_is_a_crack().

Referenced by nmg_bad_face_normals(), nmg_close_shell(), nmg_extrude_shell(), nmg_faceuse_area(), nmg_make_connect_faces(), and nmg_translate_face().

Here is the call graph for this function:

fastf_t nmg_loop_plane_area2 ( const struct loopuse *  lu,
fastf_t pl,
const struct bn_tol tol 
)

Calculates a plane equation and the area of a loop

This function only works correctly when the loop represents a "simple polygon" (i.e. simple meaning not self intersecting) and the loop is "not" a "weakly simple polygon" (i.e. weakly simple meaning is simple and at least one vertex is reused by the polygon).

returns: the area of the loop positive area is ccw loop negative area is cw loop zero is no area or degenerate loop

pl is assigned the plane equation for the loop

NOTE: The rotation cw/ccw is actual, meaning not relative to the faceuse normal.

Definition at line 1424 of file nmg_misc.c.

References bn_mat_fromto(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bn_tol::dist, MAX_FASTF, NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, out, SMALL_FASTF, UNLIKELY, VSETALL, X, Y, Z, and ZERO.

Referenced by nmg_loop_is_ccw().

Here is the call graph for this function:

int nmg_calc_face_plane ( struct faceuse *  fu_in,
fastf_t pl 
)

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 1557 of file nmg_misc.c.

References bn_mat_determinant(), bn_mat_inv(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, f1, bu_ptbl::l, lu, bu_list::magic, MAX_FASTF, NMG_EDGEUSE_MAGIC, nmg_loop_plane_newell(), nmg_pr_fu_briefly(), nmg_tabulate_face_g_verts(), nmg_vertex_tabulate(), out, SMALL_FASTF, OSL::Strings::v, X, Y, Z, and ZERO.

Referenced by make_model_from_face(), nmg_calc_face_g(), nmg_make_faces_within_tol(), and rt_extrude_tess().

Here is the call graph for this function:

int nmg_calc_face_g ( struct faceuse *  fu)

interface to nmg_calc_face_plane(), calls nmg_face_g with the resulting plane

Definition at line 1786 of file nmg_misc.c.

References nmg_calc_face_plane(), and nmg_face_g().

Referenced by fix_halfs(), nmg_close_shell(), nmg_edge_collapse(), nmg_extrude_face(), nmg_make_faces_at_vert(), nmg_mc_realize_cube(), rt_ars_tess(), rt_bot_tess(), rt_cline_tess(), rt_nmg_adjust(), rt_nmg_mirror(), rt_pg_tess(), rt_tgc_tess(), tesselate_pipe_bend(), tesselate_pipe_end(), tesselate_pipe_linear(), and tesselate_pipe_start().

Here is the call graph for this function:

fastf_t nmg_faceuse_area ( const struct faceuse *  fu)

The following routines calculate surface area of NMG objects. Note that this includes all surfaces, not just external surfaces, i.e., an NMG object consisting of two adjacent cubes with a coincident face will have a surface area of 12*s*s (s is length of one side)

Definition at line 1807 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), lu, NMG_EDGEUSE_MAGIC, nmg_loop_plane_area(), and nmg_orientation().

Referenced by nmg_shell_area().

Here is the call graph for this function:

fastf_t nmg_shell_area ( const struct shell *  s)

Definition at line 1840 of file nmg_misc.c.

References BU_LIST_FOR, NMG_CK_SHELL(), and nmg_faceuse_area().

Referenced by nmg_region_area().

Here is the call graph for this function:

fastf_t nmg_region_area ( const struct nmgregion *  r)

Definition at line 1864 of file nmg_misc.c.

References BU_LIST_FOR, nmg_shell_area(), and s.

Referenced by nmg_model_area().

Here is the call graph for this function:

fastf_t nmg_model_area ( const struct model *  m)

Definition at line 1879 of file nmg_misc.c.

References BU_LIST_FOR, and nmg_region_area().

Here is the call graph for this function:

void nmg_purge_unwanted_intersection_points ( struct bu_ptbl vert_list,
fastf_t mag_list,
const struct faceuse *  fu,
const struct bn_tol tol 
)

Make sure that the list of intersection points doesn't contain any vertexuses from loops whose bounding boxes don;t overlap the bounding box of a loop in the given faceuse.

This is really a special purpose routine to help the intersection operations of the boolean process. The only reason it's here instead of nmg_inter.c is that it knows too much about the format and contents of an bu_ptbl structure.

Definition at line 1904 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_ptbl::buffer, bn_tol::dist, bu_ptbl::end, if(), lu, MAX_FASTF, NMG_CK_LOOPUSE(), rt_g::NMG_debug, nmg_find_lu_of_vu(), nmg_orientation(), nmg_pr_vu_briefly(), NMG_VERTEXUSE_MAGIC, overlap(), RTG, and V3ARGS.

Here is the call graph for this function:

int nmg_in_or_ref ( struct vertexuse *  vu,
struct bu_ptbl b 
)

if the given vertexuse "vu" is in the table given by "b" or if "vu" references a vertex which is referenced by a vertexuse in the table, then we return 1. Otherwise, we return 0.

Definition at line 2043 of file nmg_misc.c.

References bu_ptbl::buffer, bu_ptbl::end, magic_p, and NMG_VERTEXUSE_MAGIC.

void nmg_rebound ( struct model *  m,
const struct bn_tol tol 
)

Re-compute all the bounding boxes in the NMG model. Bounding boxes are presently found in these structures: loop_g face_g shell_a nmgregion_a The re-bounding must be performed in a bottom-up manner, computing the loops first, and working up to the nmgregions.

Definition at line 2072 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), bu_free(), BU_LIST_FOR, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), nmg_face_bb(), nmg_loop_g(), nmg_region_a(), nmg_shell_a(), and s.

Referenced by fix_halfs(), ged_decompose(), ged_shells(), nmg_decompose_shell(), nmg_extrude_cleanup(), nmg_fix_normals(), nmg_merge_regions(), rt_nmg_adjust(), rt_nmg_import4_internal(), rt_nmg_mirror(), rt_pipe_tess(), and stash_shell().

Here is the call graph for this function:

void nmg_count_shell_kids ( const struct model *  m,
size_t *  total_faces,
size_t *  total_wires,
size_t *  total_points 
)

Definition at line 2141 of file nmg_misc.c.

References bu_calloc(), bu_free(), BU_LIST_FOR, lu, and s.

Referenced by ged_fracture().

Here is the call graph for this function:

HIDDEN void order_tbl ( struct bu_ptbl tbl,
int  start_idx,
int **  idx,
int  tbl_size,
int *  loop_size 
)

private support routine for nmg_close_shell creates an array of indices into a table of edgeuses, ordered end-to-end. This may or may not create an actual loop.

Arguments: tbl is the table (provided by caller) index is the array of indices created by order_tbl tbl_size is the size of the table (provided by caller) loop_size is the number of edgeuses in the loop (calculated by order_tbl)

Definition at line 2194 of file nmg_misc.c.

References bu_calloc(), BU_PTBL_GET, and eu1.

Referenced by nmg_close_shell().

Here is the call graph for this function:

void nmg_close_shell ( struct shell *  s,
const struct bn_tol tol 
)

Examines the passed shell and, if there are holes, closes them note that not much care is taken as to how the holes are closed so the results are not entirely predictable. A list of free edges is created (edges bounding only one face). New faces are constructed by taking two consecutive edges and making a face. The newly created edge is added to the list of free edges and the two used ones are removed.

Definition at line 2256 of file nmg_misc.c.

References bn_3pts_collinear(), BN_CK_TOL, bn_coplanar(), bn_mk_plane_3pts(), bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_reset(), bu_ptbl_rm(), eu1, eu2, lu, nmg_calc_face_g(), NMG_CK_LOOPUSE(), NMG_CK_SHELL(), nmg_cmface(), rt_g::NMG_debug, nmg_face_bb(), nmg_face_g(), nmg_find_e(), nmg_kfu(), nmg_loop_plane_area(), NMG_VERTEXUSE_MAGIC, order_tbl(), RTG, and V3ARGS.

Referenced by fix_halfs(), and nmg_hollow_shell().

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 
)

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 geometrically 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 2673 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), BU_LIST_FOR, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_ins(), lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_dup_loop(), nmg_face_g(), nmg_find_model(), nmg_gluefaces(), nmg_me(), nmg_mf(), nmg_msv(), nmg_vertex_gv(), and RTG.

Referenced by ged_decompose(), ged_shells(), nmg_fix_normals(), and nmg_hollow_shell().

Here is the call graph for this function:

struct edgeuse* nmg_pop_eu ( struct bu_ptbl stack)

Definition at line 2843 of file nmg_misc.c.

References BU_PTBL_END, BU_PTBL_GET, and bu_ptbl_rm().

Referenced by nmg_decompose_shell(), and nmg_propagate_normals().

Here is the call graph for this function:

void nmg_reverse_radials ( struct faceuse *  fu,
const struct bn_tol tol 
)

Definition at line 2862 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, and RTG.

Referenced by nmg_propagate_normals().

Here is the call graph for this function:

void nmg_reverse_face_and_radials ( struct faceuse *  fu,
const struct bn_tol tol 
)

This routine calls "nmg_reverse_face" and also makes the radial pointers connect faces of like orientation (i.e., OT_SAME to OT_SAME and OT_OPPOSITE to OT_OPPOSITE).

XXX Don't use this, use nmg_s_radial_harmonize() at the right time.

Definition at line 2914 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_reverse_face(), and RTG.

Referenced by nmg_fix_decomposed_shell_normals(), nmg_fix_normals(), and nmg_propagate_normals().

Here is the call graph for this function:

int nmg_shell_is_void ( const struct shell *  s)

determines if the shell is a void shell or an exterior shell by finding the topmost face (in some direction) and looking at the component of the OT_SAME faceuse normal in that direction.

returns: 0 - shell is exterior shell 1 - shell is a void shell -1 - cannot determine

It is expected that this shell is the result of nmg_decompose_shells().

Definition at line 2975 of file nmg_misc.c.

References bu_calloc(), bu_free(), NMG_CK_SHELL(), nmg_find_model(), nmg_find_top_face(), and ZERO.

Referenced by nmg_extrude_cleanup(), nmg_extrude_shell(), and nmg_hollow_shell().

Here is the call graph for this function:

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

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 3030 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_ptbl_free(), bu_ptbl_init(), eu1, lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_pop_eu(), nmg_pr_fu_briefly(), NMG_PUSH, nmg_reverse_face(), nmg_reverse_face_and_radials(), nmg_reverse_radials(), and RTG.

Referenced by nmg_fix_decomposed_shell_normals().

Here is the call graph for this function:

HIDDEN void nmg_disconnect_shells ( struct nmgregion *  r)

looks for edges that have uses in more than one shell in region. creates new edges so that there is no sharing of edges among shells

Definition at line 3147 of file nmg_misc.c.

References BU_LIST_FOR, BU_PTBL_END, BU_PTBL_GET, eu1, eu2, if(), bu_ptbl::l, bu_list::magic, nmg_edge_tabulate(), nmg_find_fu_of_eu(), nmg_find_s_of_eu(), nmg_je(), nmg_unglueedge(), and orientation.

Referenced by nmg_fix_normals().

Here is the call graph for this function:

void nmg_connect_same_fu_orients ( struct shell *  s)

looks for radially connected faceuses that have disagreeing orientations. if such a condition is found, the radial pointers are rearranged to make the radial faces agree in orientation.

Definition at line 3259 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, eu2, lu, NMG_EDGEUSE_MAGIC, and nmg_find_fu_of_eu().

Referenced by nmg_fix_normals().

Here is the call graph for this function:

void nmg_fix_decomposed_shell_normals ( struct shell *  s,
const struct bn_tol tol 
)

Routine to set all OT_SAME faceuse normals to outward direction. Assumes that there are no other shells sharing edges with this one.

Definition at line 3303 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FOR, bu_log(), missed(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_FACE_G_PLANE_MAGIC, nmg_find_top_face(), nmg_propagate_normals(), nmg_reverse_face_and_radials(), RTG, and V3ARGS.

Referenced by nmg_fix_normals().

Here is the call graph for this function:

struct model* nmg_mk_model_from_region ( struct nmgregion *  r,
int  reindex 
)

Definition at line 3416 of file nmg_misc.c.

References BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_INSERT, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, eu1, bu_ptbl::l, bu_list::magic, nmg_edge_tabulate(), nmg_find_max_index(), nmg_find_s_of_eu(), nmg_find_s_of_vu(), nmg_m_reindex(), nmg_mm(), nmg_vertex_tabulate(), OSL::Strings::v, and V3ARGS.

Referenced by ged_decompose(), and nmg_fix_normals().

Here is the call graph for this function:

void nmg_fix_normals ( struct shell *  s_orig,
const struct bn_tol tol 
)

Routine to set faceuse normals to correct direction.

Method:

  1. Make a copy of the shell in another model.
  2. Decompose the copy into constituent shells.
  3. Set all normals of constituent shells outward (no void shells)
  4. Use nmg_classify_s_vs_s() for every pair of shells.
  5. Mark any shell that is inside an odd number of other shells as a void shell.
  6. Compare original faceuses with the results in the copy and adjust normals as needed.
  7. Destroy the copy model.

Definition at line 3505 of file nmg_misc.c.

References BN_CK_TOL, bu_free(), BU_LIST_FIRST, BU_LIST_FOR, bu_log(), bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_locate(), NMG_CK_SHELL(), nmg_classify_s_vs_s(), nmg_connect_same_fu_orients(), rt_g::NMG_debug, nmg_decompose_shell(), nmg_disconnect_shells(), nmg_dup_shell(), NMG_FACE_G_PLANE_MAGIC, nmg_fix_decomposed_shell_normals(), nmg_km(), nmg_ks(), nmg_mk_model_from_region(), nmg_mrsv(), nmg_mv_shell_to_region(), nmg_pr_fu_briefly(), nmg_rebound(), nmg_reverse_face_and_radials(), and RTG.

Referenced by brep_to_nmg(), ged_nmg_fix_normals(), rt_arbn_tess(), rt_ars_tess(), rt_bot_tess(), and rt_pg_tess().

Here is the call graph for this function:

int nmg_break_long_edges ( struct shell *  s,
const struct bn_tol tol 
)

This codes looks for situations as illustrated:

*----—>*-----—>*------—>* *<-------------------------—*

where one long edgeuse (the bottom one above) and two or more shorter edgeuses (the top ones) are collinear and have the same start and end vertices. The code breaks the longer edgeuse into ones that can be radials of the shorter ones. Returns the number of splits performed.

Definition at line 3688 of file nmg_misc.c.

References bn_3pts_collinear(), BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, RTG, and V3ARGS.

Here is the call graph for this function:

struct faceuse* nmg_mk_new_face_from_loop ( struct loopuse *  lu)

Remove a loopuse from an existing face and construct a new face from that loop

Returns new faceuse as built by nmg_mf()

Definition at line 3786 of file nmg_misc.c.

References BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_INSERT, bu_log(), NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_FACEUSE_MAGIC, nmg_mf(), RTG, and s.

Referenced by nmg_make_faces_at_vert(), and nmg_split_loops_handler().

Here is the call graph for this function:

void nmg_split_loops_handler ( uint32_t *  fu_p,
void *  sl_state,
int  unused 
)
int nmg_split_loops_into_faces ( uint32_t *  magic_p,
const struct bn_tol tol 
)

Visits each faceuse and splits disjoint loops into separate faces.

Returns the number of faces modified.

Definition at line 4035 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), bu_free(), bu_log(), nmg_split_loops_state::flags, rt_g::NMG_debug, nmg_find_model(), nmg_split_loops_handler(), nmg_visit(), RTG, nmg_split_loops_state::split, and nmg_split_loops_state::tol.

Referenced by nmg_decompose_shell(), nmg_edge_collapse(), nmg_fix_overlapping_loops(), and nmg_make_faces_within_tol().

Here is the call graph for this function:

int nmg_decompose_shell ( struct shell *  s,
const struct bn_tol tol 
)

Accepts one shell and breaks it to the minimum number of disjoint shells.

explicit returns:

of resulting shells (1 indicates that nothing was done)

implicit returns: additional shells in the passed in shell's region.

Definition at line 4082 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NEXT, BU_LIST_NOT_HEAD, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_ins_unique(), bu_ptbl_reset(), bu_ptbl_rm(), eu1, eu2, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_find_s_of_eu(), nmg_gluefaces(), nmg_kvu(), nmg_msv(), nmg_mv_fu_between_shells(), nmg_next_radial_eu(), nmg_pop_eu(), nmg_prev_radial_eu(), nmg_radial_face_count(), nmg_rebound(), nmg_shell_a(), nmg_split_loops_into_faces(), and RTG.

Referenced by ged_decompose(), nmg_extrude_cleanup(), nmg_extrude_shell(), nmg_find_outer_and_void_shells(), nmg_fix_normals(), and nmg_hollow_shell().

Here is the call graph for this function:

void nmg_stash_model_to_file ( const char *  filename,
const struct model *  m,
const char *  title 
)

Store an NMG model as a separate .g file, for later examination. Don't free the model, as the caller may still have uses for it.

NON-PARALLEL because of rt_uniresource.

Definition at line 4500 of file nmg_misc.c.

References BU_CK_EXTERNAL, BU_EXTERNAL_INIT, bu_free_external(), bu_log(), db_flags_internal(), db_version(), db_wrap_v4_external(), rt_wdb::dbip, rt_functab::ft_export4, ID_NMG, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, nmg_vmodel(), OBJ, out, rt_db_cvt_to_external5(), RT_DB_INTERNAL_INIT, rt_uniresource, wdb_close(), wdb_export_external(), and wdb_fopen().

Referenced by cut_unimonotone(), nmg_check_radial(), nmg_loop_split_at_touching_jaunt(), nmg_triangulate_rm_holes(), and stash_shell().

Here is the call graph for this function:

void nmg_unbreak_handler ( uint32_t *  eup,
void *  state,
int  unused 
)

edgeuse visit routine for nmg_unbreak_region_edges.

checks if edgeuse "eu" and its successor are candidates to be unbroken. looks for two consecutive 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 4574 of file nmg_misc.c.

References bu_list_len(), BU_LIST_PNEXT_CIRC, bu_log(), eu1, eu2, nmg_unbreak_state::flags, and nmg_unbreak_state::unbroken.

Referenced by nmg_unbreak_region_edges().

Here is the call graph for this function:

int nmg_unbreak_region_edges ( uint32_t *  magic_p)

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 4650 of file nmg_misc.c.

References bu_calloc(), bu_free(), bu_log(), nmg_unbreak_state::flags, rt_g::NMG_debug, nmg_find_model(), nmg_unbreak_handler(), nmg_visit(), RTG, and nmg_unbreak_state::unbroken.

Referenced by nmg_crackshells(), nmg_isect_two_generic_faces(), nmg_triangulate_shell(), and rt_vol_tess().

Here is the call graph for this function:

int nmg_mv_shell_to_region ( struct shell *  s,
struct nmgregion *  r 
)

Move a shell from one nmgregion to another. Will bomb if shell and region aren't in the same model.

returns: 0 - all is well 1 - nmgregion that gave up the shell is now empty!

Definition at line 4690 of file nmg_misc.c.

References bu_bomb(), BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_IS_EMPTY, bu_log(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_find_model(), and RTG.

Referenced by ged_decompose(), nmg_extrude_cleanup(), nmg_extrude_shell(), nmg_fix_normals(), and nmg_hollow_shell().

Here is the call graph for this function:

int nmg_find_isect_faces ( const struct vertex *  new_v,
struct bu_ptbl faces,
int *  free_edges,
const struct bn_tol tol 
)

Find all faces that contain vertex "new_v" Put them in a bu_ptbl "faces"

returns: the number of faces that contain the vertex

and fills in the table with the faces. Counts edges at this vertex where radial is mate (free_edges)

Definition at line 4733 of file nmg_misc.c.

References BN_CK_TOL, bn_coplanar(), BU_CK_PTBL, BU_LIST_FOR, BU_LIST_PPREV_CIRC, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl_ins(), eu1, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_vu(), and RTG.

Referenced by nmg_in_vert(), and nmg_move_edge_thru_pt().

Here is the call graph for this function:

int nmg_simple_vertex_solve ( struct vertex *  new_v,
const struct bu_ptbl faces,
const struct bn_tol tol 
)

given a vertex and a list of faces (not more than three) that should intersect at the vertex, calculate a new location for the vertex.

returns: 0 - if everything is OK 1 - failure

and modifies the geometry of the vertex to the new location

Definition at line 4806 of file nmg_misc.c.

References BN_CK_TOL, bn_mkpoint_3planes(), BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, rt_g::NMG_debug, bn_tol::perp, RTG, and V3ARGS.

Referenced by nmg_in_vert(), and nmg_move_edge_thru_pt().

Here is the call graph for this function:

int nmg_ck_vert_on_fus ( const struct vertex *  v,
const struct bn_tol tol 
)

Check all uses of a vertex to see if it lies within tolerance of all faces where it is used

returns: 0 - All is well 1 - vertex is off face plane by at least tol->dist for at least one face

Definition at line 4928 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FOR, bu_log(), bn_tol::dist, nmg_find_fu_of_vu(), and V3ARGS.

Here is the call graph for this function:

HIDDEN void nmg_pr_inter ( const struct vertex *  new_v,
const struct bu_ptbl int_faces 
)

debug printing of the table of intersect_fus structs used by extruder

Definition at line 4997 of file nmg_misc.c.

References BN_TOL_MAGIC, BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, intersect_fus::dir, bn_tol::dist, bn_tol::dist_sq, intersect_fus::eu, intersect_fus::free_edge, intersect_fus::fu, bn_tol::magic, nmg_find_fu_of_eu(), bn_tol::para, bn_tol::perp, intersect_fus::pt, intersect_fus::start, V3ARGS, and intersect_fus::vp.

Referenced by nmg_calc_new_v(), nmg_fix_crossed_loops(), nmg_get_edge_lines(), nmg_get_max_edge_inters(), nmg_simplify_inter(), and nmg_split_edges_at_pts().

Here is the call graph for this function:

HIDDEN int nmg_get_edge_lines ( struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Fill in the intersect_fus structures for edges around new_v. Does not fill in "pt" or "vp".

returns: 0 - All is well 1 - Failure

Definition at line 5089 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_pt3_line3(), bn_isect_2planes(), BN_TOL_MAGIC, BU_ALLOC, bu_bomb(), BU_CK_PTBL, bu_free(), BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl_ins(), intersect_fus::dir, bn_tol::dist, bn_tol::dist_sq, intersect_fus::eu, eu1, intersect_fus::free_edge, intersect_fus::fu, intersect_fus::got_pt, bn_tol::magic, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_find_model(), nmg_pr_fu_briefly(), nmg_pr_inter(), bn_tol::para, bn_tol::perp, intersect_fus::pt, RTG, intersect_fus::start, V3ARGS, intersect_fus::vp, and VSET.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN int nmg_get_max_edge_inters ( const struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bu_ptbl faces,
const struct bn_tol tol 
)

Fill in the "pt" portion of the "intersect_fus" structure for edges around new_v by calculating the intersection with neighboring edges and selecting the furthest one from new_v.

Definition at line 5317 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_line3_line3(), bn_isect_line3_plane(), BU_CK_PTBL, BU_LIST_FIRST, bu_log(), BU_PTBL_END, BU_PTBL_GET, intersect_fus::dir, bn_tol::dist, intersect_fus::fu, intersect_fus::got_pt, MAX_FASTF, NEAR_ZERO, rt_g::NMG_debug, nmg_find_model(), nmg_pr_inter(), bn_tol::perp, intersect_fus::pt, RTG, and intersect_fus::start.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN void nmg_fuse_inters ( struct intersect_fus i_fus,
struct intersect_fus j_fus,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

eliminate "j_fus" from the table "int_faces" and adjust the info in "i_fus". This is done when the "vp" vertices of the two structures have been joined.

Definition at line 5483 of file nmg_misc.c.

References BN_CK_TOL, BU_CK_PTBL, bu_free(), BU_LIST_PPREV_CIRC, bu_log(), BU_PTBL_END, bu_ptbl_rm(), intersect_fus::eu, intersect_fus::free_edge, intersect_fus::fu, rt_g::NMG_debug, nmg_keu(), nmg_radial_join_eu(), and RTG.

Referenced by nmg_simplify_inter(), and nmg_split_edges_at_pts().

Here is the call graph for this function:

HIDDEN void nmg_split_edges_at_pts ( const struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Using the info in the table of intersect_fus structs, split the edgeuse (eu) in each struct at the point (pt) store the new vertices in the structure (vp) and assign the geometry.

Definition at line 5546 of file nmg_misc.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, intersect_fus::dir, intersect_fus::eu, intersect_fus::free_edge, intersect_fus::fu, rt_g::NMG_debug, nmg_fuse_inters(), nmg_pr_inter(), nmg_vertex_gv(), intersect_fus::pt, RTG, intersect_fus::start, and intersect_fus::vp.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN void nmg_remove_short_eus_inter ( struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

kill all zero length edgeuses in faces around new_v

Definition at line 5651 of file nmg_misc.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), BU_CK_PTBL, BU_LIST_FIRST, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PPREV_CIRC, bu_log(), BU_PTBL_END, BU_PTBL_GET, lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_lu(), nmg_find_fu_of_vu(), nmg_jv(), nmg_keu(), nmg_kfu(), nmg_klu(), RTG, V3ARGS, and intersect_fus::vp.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN void nmg_simplify_inter ( const struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Eliminates adjacent intersect_fus structs with collinear edges

Definition at line 5792 of file nmg_misc.c.

References bn_3pts_collinear(), BN_CK_TOL, bn_pt3_pt3_equal(), bu_bomb(), BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, bn_tol::dist_sq, intersect_fus::eu, intersect_fus::free_edge, rt_g::NMG_debug, nmg_fuse_inters(), nmg_jv(), nmg_pr_inter(), RTG, V3ARGS, and intersect_fus::vp.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

void nmg_make_faces_at_vert ( struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Make new faces around vertex new_v using info in the table of intersect_fu structures. Each structure contains a vertex on an edge departing new_v. Vertices from two consecutive edges are combined with new_v to form triangular faces around new_v

Definition at line 5927 of file nmg_misc.c.

References bn_3pts_collinear(), BN_CK_TOL, bu_bomb(), BU_CK_PTBL, BU_LIST_FOR, bu_log(), BU_PTBL_END, BU_PTBL_GET, intersect_fus::eu, intersect_fus::free_edge, intersect_fus::fu, lu, nmg_calc_face_g(), nmg_cut_loop(), rt_g::NMG_debug, nmg_face_bb(), nmg_jv(), nmg_mk_new_face_from_loop(), nmg_pr_fu_briefly(), RTG, V3ARGS, and intersect_fus::vp.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

void nmg_kill_cracks_at_vertex ( const struct vertex *  vp)

Look at all faces around vertex new_v and kill any two consecutive eu's that go from a vertex to a second then back to the original vertex

Definition at line 6148 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NEXT, BU_LIST_NOT_HEAD, BU_LIST_PPREV_CIRC, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins_unique(), lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_vu(), nmg_keu(), nmg_kfu(), nmg_klu(), and RTG.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN fastf_t nmg_dist_to_cross ( const struct intersect_fus i_fus,
const struct intersect_fus j_fus,
fastf_t new_pt,
const struct bn_tol tol 
)

Used by nmg_fix_crossed edges to calculate the point where two edges cross

returns: distance to intersection if edge intersect -1.0 if they don't

Definition at line 6250 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_line3_line3(), bn_isect_lseg3_lseg3(), bn_mkpoint_3planes(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), intersect_fus::eu, intersect_fus::free_edge, intersect_fus::fu, rt_g::NMG_debug, RTG, V3ARGS, intersect_fus::vp, and ZERO.

Referenced by nmg_fix_crossed_loops().

Here is the call graph for this function:

HIDDEN void nmg_fix_crossed_loops ( struct vertex *  new_v,
struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Detect situations where edges have been split, but new vertices are in wrong order. This typically happens as shown:

1 new face planes
2 |
3 |
4 \ \ / | /
5 \ \ /<--| /
6 \ X /
7 \ / \ /
8 \ /___\ /
9 \ /
10 \ /<- original face planes
11 \ /
12 \___/

This can be detected by checking if the edges leaving from the new vertices cross. If so, the middle face is deleted and the two vertices are fused.

Definition at line 6424 of file nmg_misc.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, bn_tol::dist, intersect_fus::free_edge, rt_g::NMG_debug, nmg_dist_to_cross(), nmg_pr_inter(), intersect_fus::pt, RTG, V3ARGS, and intersect_fus::vp.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

HIDDEN int nmg_calc_new_v ( struct vertex *  new_v,
const struct bu_ptbl int_faces,
const struct bn_tol tol 
)

Definition at line 6587 of file nmg_misc.c.

References BN_CK_TOL, bn_coplanar(), bn_dist_pt3_line3(), bn_isect_planes(), bn_mkpoint_3planes(), bu_calloc(), BU_CK_PTBL, bu_free(), bu_log(), BU_PTBL_END, BU_PTBL_GET, intersect_fus::dir, intersect_fus::fu, rt_g::NMG_debug, nmg_pr_inter(), RTG, intersect_fus::start, and V3ARGS.

Referenced by nmg_complex_vertex_solve().

Here is the call graph for this function:

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 
)

This is intended to handle the cases the "nmg_simple_vertex_solve" can't do (more than three faces intersecting at a vertex)

This routine may create new edges and/or faces and Modifies the location of "new_v"

if approximate is non-zero, the new geometry is approximated by calculating the point with minimum distance to all the intersecting faces

returns: 0 - if everything is OK 1 - failure

Definition at line 6705 of file nmg_misc.c.

References BN_CK_TOL, bn_isect_planes(), bu_calloc(), BU_CK_PTBL, bu_free(), BU_LIST_FOR, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), nmg_calc_new_v(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_fix_crossed_loops(), nmg_get_edge_lines(), nmg_get_max_edge_inters(), nmg_kill_cracks_at_vertex(), nmg_make_faces_at_vert(), nmg_remove_short_eus_inter(), nmg_simplify_inter(), nmg_split_edges_at_pts(), RTG, and V3ARGS.

Referenced by nmg_in_vert().

Here is the call graph for this function:

int nmg_bad_face_normals ( const struct shell *  s,
const struct bn_tol tol 
)

Look for faceuses in the shell with normals that do not agree with the geometry (i.e., in the wrong direction)

return: 1 - at least one faceuse with a bad normal was found 0 - no faceuses with bad normals were found

Definition at line 6882 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FOR, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), and nmg_loop_plane_area().

Referenced by nmg_extrude_cleanup().

Here is the call graph for this function:

int nmg_faces_are_radial ( const struct faceuse *  fu1,
const struct faceuse *  fu2 
)

checks if two faceuses are radial to each other

returns 1 - the two faceuses are radial to each other 0 - otherwise

Definition at line 6935 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, lu, NMG_EDGEUSE_MAGIC, and nmg_find_fu_of_eu().

Referenced by nmg_isect_shell_self(), and nmg_to_arb().

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 
)

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 6986 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(), eu1, lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, nmg_edge_g(), NMG_EDGE_G_LSEG_MAGIC, nmg_face_g(), nmg_find_fu_of_eu(), nmg_find_isect_faces(), nmg_find_model(), NMG_LOOPUSE_MAGIC, nmg_simple_vertex_solve(), nmg_vertex_gv(), NMG_VERTEXUSE_MAGIC, RTG, SQRT_SMALL_FASTF, and V3ARGS.

Here is the call graph for this function:

void nmg_vlist_to_wire_edges ( struct shell *  s,
const struct bu_list vhead 
)

Convert a vlist to NMG wire edges

Definition at line 7306 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, BN_VLIST_TRI_DRAW, BN_VLIST_TRI_END, BN_VLIST_TRI_MOVE, BN_VLIST_TRI_START, BU_LIST_FIRST, BU_LIST_FOR, bn_vlist::cmd, NMG_CK_SHELL(), nmg_edge_g(), nmg_me(), nmg_vertex_gv(), bn_vlist::nused, bn_vlist::pt, and SMALL_FASTF.

Here is the call graph for this function:

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 
)

Definition at line 7368 of file nmg_misc.c.

References BU_CK_PTBL, BU_LIST_FOR, bu_log(), bu_ptbl_ins(), bu_ptbl_locate(), bu_ptbl_rm(), eu1, NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_s_of_vu(), RTG, and V3ARGS.

Referenced by nmg_find_path().

Here is the call graph for this function:

HIDDEN struct bu_ptbl* nmg_find_path ( const struct vertex *  vpa,
const struct vertex *  vpb,
struct bu_ptbl bad_verts,
const struct shell *  s 
)

Definition at line 7468 of file nmg_misc.c.

References BU_CK_PTBL, BU_LIST_FOR, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_locate(), bu_ptbl_reset(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_s_of_vu(), nmg_follow_free_edges_to_vertex(), RTG, and V3ARGS.

Referenced by nmg_open_shells_connect().

Here is the call graph for this function:

void nmg_glue_face_in_shell ( const struct faceuse *  fu,
struct shell *  s,
const struct bn_tol tol 
)

Definition at line 7557 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, eu1, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, nmg_findeu(), and nmg_radial_join_eu().

Referenced by nmg_make_connect_faces().

Here is the call graph for this function:

HIDDEN int nmg_make_connect_faces ( struct shell *  dst,
struct vertex *  vpa,
struct vertex *  vpb,
struct bu_ptbl verts,
const struct bn_tol tol 
)

Definition at line 7588 of file nmg_misc.c.

References bn_3pts_collinear(), BN_CK_TOL, bu_bomb(), BU_CK_PTBL, BU_LIST_FIRST, bu_log(), BU_PTBL_END, BU_PTBL_GET, lu, nmg_cface(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_face_g(), nmg_glue_face_in_shell(), nmg_kfu(), nmg_loop_g(), nmg_loop_plane_area(), nmg_pr_lu_briefly(), RTG, OSL::Strings::v, and V3ARGS.

Referenced by nmg_open_shells_connect().

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 
)

Two open shells are connected along their free edges by building new faces. The resulting closed shell is in "dst", and "src" shell is destroyed. The "copy_tbl" is a translation table that provides a one-to-one translation between the vertices in the two shells, i.e., NMG_INDEX_GETP(vertex, copy_tbl, v), where v is a pointer to a vertex in "dst" shell, provides a pointer to the corresponding vertex in "src" shell

returns: 0 - All is well 1 - failure

Definition at line 7836 of file nmg_misc.c.

References dangle::bad_verts, BN_CK_TOL, bn_dist_pt3_lseg3(), bu_free(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_malloc(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_rm(), eu2, lu, dangle::needs_edge_breaking, nmg_check_closed_shell(), NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_path(), nmg_findeu(), nmg_gluefaces(), nmg_je(), nmg_js(), nmg_make_connect_faces(), NMG_VERTEXUSE_MAGIC, RTG, dangle::v1, dangle::v2, V3ARGS, dangle::va, and dangle::vb.

Referenced by nmg_hollow_shell().

Here is the call graph for this function:

int nmg_in_vert ( struct vertex *  new_v,
const int  approximate,
const struct bn_tol tol 
)

Move vertex so it is at the intersection of the newly created faces

This routine is used by "nmg_extrude_shell" to move vertices. Each plane has already been moved a distance inward and the surface normals have been reversed.

if approximate is non-zero, then the coordinates of the new vertex may be calculated as the point with minimum distance to all the faces that intersect at the vertex for vertices where more than three faces intersect.

Definition at line 8086 of file nmg_misc.c.

References BN_CK_TOL, bu_log(), bu_ptbl_free(), bu_ptbl_init(), nmg_complex_vertex_solve(), rt_g::NMG_debug, nmg_find_isect_faces(), nmg_simple_vertex_solve(), RTG, and V3ARGS.

Referenced by nmg_extrude_shell(), and nmg_hollow_shell().

Here is the call graph for this function:

void nmg_mirror_model ( struct model *  m)

mirror model across the y-axis this does not copy the model, it changes the model passed to it

Definition at line 8133 of file nmg_misc.c.

References bu_calloc(), bu_free(), BU_LIST_FOR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, nmg_vertex_tabulate(), orientation, s, OSL::Strings::v, and Y.

Here is the call graph for this function:

int nmg_kill_cracks ( struct shell *  s)

Definition at line 8187 of file nmg_misc.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), eu2, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_keu(), nmg_kfu(), nmg_klu(), nmg_lu_reorient(), nmg_pr_lu_briefly(), nmg_split_lu_at_vu(), and RTG.

Referenced by do_region_end(), gcv_region_end(), gcv_region_end_mc(), nmg_region_end(), and rt_dsp_tess().

Here is the call graph for this function:

int nmg_kill_zero_length_edgeuses ( struct model *  m)

Definition at line 8351 of file nmg_misc.c.

References BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_CIRC, bu_log(), lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_keu(), nmg_kfu(), nmg_klu(), nmg_kr(), nmg_ks(), RTG, and s.

Referenced by do_region_end(), gcv_region_end(), and gcv_region_end_mc().

Here is the call graph for this function:

void nmg_make_faces_within_tol ( struct shell *  s,
const struct bn_tol tol 
)

Check all vertices on faces of specified shell. Any face containing vertices more than tol->dist off the plane of the face will be triangulated and broken into separate faces

Definition at line 8463 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FOR, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_locate(), nmg_calc_face_plane(), nmg_ck_fu_verts(), NMG_CK_SHELL(), nmg_face_new_g(), nmg_split_loops_into_faces(), and nmg_triangulate_fu().

Referenced by ged_bot_fuse(), nmg_model_fuse(), rt_arb_tess(), and rt_dsp_tess().

Here is the call graph for this function:

void nmg_intersect_loops_self ( struct shell *  s,
const struct bn_tol tol 
)

Definition at line 8530 of file nmg_misc.c.

References BN_CK_TOL, bn_isect_lseg3_lseg3(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_reset(), code(), eu2, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, nmg_vertex_gv(), top(), OSL::Strings::v, and ZERO.

Here is the call graph for this function:

struct edge_g_cnurb* rt_join_cnurbs ( struct bu_list crv_head)

Join a list of cnurb structs into a single cnurb. The curves must have matching endpoints, otherwise nothing is done and (struct cnurb *)NULL is returned.

Returns a single cnurb structure that joins all the cnurbs on the list.

Definition at line 8636 of file nmg_misc.c.

References bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_NEXT, BU_LIST_NOT_HEAD, bu_log(), rt_nurb_c_print(), rt_nurb_new_cnurb(), and ZERO.

Referenced by rt_arc2d_to_cnurb().

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 
)

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 8803 of file nmg_misc.c.

References BN_CK_TOL, bn_isect_line3_line3(), BU_LIST_INIT, BU_LIST_INSERT, bu_log(), bn_tol::dist, rt_join_cnurbs(), rt_nurb_new_cnurb(), VSET, X, Y, and Z.

Here is the call graph for this function:

int nmg_break_edge_at_verts ( struct edge *  e,
struct bu_ptbl verts,
const struct bn_tol tol 
)

split an edge into multiple edges at specified vertices if they are within tolerance distance.

Returns the number of additional edges that were created.

Definition at line 8998 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_pt3_lseg3(), BU_CK_PTBL, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_rm(), and OSL::Strings::v.

Referenced by nmg_break_edges().

Here is the call graph for this function:

int nmg_break_edges ( uint32_t *  magic_p,
const struct bn_tol tol 
)

Definition at line 9071 of file nmg_misc.c.

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

Here is the call graph for this function:

HIDDEN int Shell_is_arb ( struct shell *  s,
struct bu_ptbl tab 
)

Definition at line 9100 of file nmg_misc.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_PTBL_END, bu_ptbl_free(), bu_ptbl::l, lu, bu_list::magic, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, NMG_FACE_G_PLANE_MAGIC, nmg_find_fu_of_eu(), nmg_next_radial_eu(), and nmg_vertex_tabulate().

Referenced by nmg_to_arb().

Here is the call graph for this function:

int nmg_to_arb ( const struct model *  m,
struct rt_arb_internal *  arb_int 
)

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 9282 of file nmg_misc.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_NEXT_NOT_HEAD, BU_LIST_PNEXT_CIRC, bu_ptbl_free(), BU_PTBL_GET, BU_PTBL_INIT_ZERO, eu1, lu, NMG_CK_SHELL(), nmg_faces_are_radial(), nmg_find_fu_of_eu(), RT_ARB_INTERNAL_MAGIC, s, Shell_is_arb(), and OSL::Strings::v.

Referenced by ged_nmg_simplify().

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 
)

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 9522 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, lu, MAX_FASTF, NEAR_ZERO, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, bn_tol::perp, RT_TGC_INTERNAL_MAGIC, s, and VSETALL.

Referenced by ged_nmg_simplify().

Here is the call graph for this function:

int nmg_lu_is_convex ( struct loopuse *  lu,
const struct bn_tol tol 
)

Checks if lu is convex

Returns: 1 - is loop is convex, or lu is a loop of a single vertex 0 - otherwise

Definition at line 9770 of file nmg_misc.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_PNEXT_CIRC, eu1, eu2, NMG_CK_LOOPUSE(), nmg_class_pt_lu_except(), NMG_EDGEUSE_MAGIC, and nmg_loop_g().

Referenced by nmg_to_poly().

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 
)

XXX This routine is deprecated in favor of BoTs

Definition at line 9824 of file nmg_misc.c.

References BN_CK_TOL, bu_calloc(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), lu, nmg_check_closed_shell(), NMG_CK_LOOPUSE(), rt_g::NMG_debug, nmg_dup_face(), NMG_EDGEUSE_MAGIC, nmg_km(), nmg_lu_is_convex(), nmg_mm(), nmg_mrsv(), nmg_triangulate_fu(), RT_PG_INTERNAL_MAGIC, RTG, and s.

Referenced by fix_halfs(), and ged_nmg_simplify().

Here is the call graph for this function:

int nmg_simplify_shell_edges ( struct shell *  s,
const struct bn_tol tol 
)

Definition at line 9975 of file nmg_misc.c.

References BN_CK_TOL, bn_dist_pt3_line3(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_IS_EMPTY, BU_LIST_NEXT, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_CIRC, lu, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, nmg_find_s_of_vu(), nmg_keu(), nmg_kfu(), nmg_klu(), and nmg_movevu().

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 10147 of file nmg_misc.c.

References bu_log().

Referenced by nmg_edge_collapse().

Here is the call graph for this function:

int nmg_edge_collapse ( struct model *  m,
const struct bn_tol tol,
const fastf_t  tol_coll,
const fastf_t  min_angle 
)

Routine to decimate an NMG model through edge collapse to obtain a model with less faces at a greater tolerance

tol_coll is the tolerance distance to be used for choosing edges to collapse

Model must already be triangulated (this is not checked for)

returns number of edges collapsed

Definition at line 10201 of file nmg_misc.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_LAST, BU_LIST_NEXT, BU_LIST_NOT_HEAD, BU_LIST_PNEXT_CIRC, bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_reset(), bu_ptbl_zero(), eu1, eu2, lu, MAX_FASTF, nmg_calc_face_g(), nmg_edge_g(), NMG_EDGE_G_LSEG_MAGIC, NMG_EDGE_MAGIC, nmg_edge_tabulate(), NMG_EDGEUSE_MAGIC, nmg_face_tabulate(), NMG_FACEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_keu(), nmg_kfu(), nmg_klu(), NMG_LOOPUSE_MAGIC, nmg_movevu(), nmg_orientation(), nmg_radial_join_eu_NEW(), nmg_select_collapse(), nmg_split_loops_into_faces(), and V3ARGS.

Referenced by ged_nmg_collapse().

Here is the call graph for this function:

struct rt_bot_internal* nmg_bot ( struct shell *  s,
const struct bn_tol tol 
)

Convert an NMG to a BOT solid

Definition at line 10826 of file nmg_misc.c.

References BN_CK_TOL, BU_ALLOC, bu_calloc(), bu_free(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bu_ptbl_free(), BU_PTBL_GET, BU_PTBL_LEN, bu_ptbl_locate(), bu_ptbl::l, lu, bu_list::magic, NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, nmg_face_tabulate(), nmg_triangulate_shell(), nmg_vertex_tabulate(), RT_BOT_INTERNAL_MAGIC, and OSL::Strings::v.

Referenced by add_solid(), evaluate(), ged_bot_fuse(), ged_facetize(), mk_bot_from_nmg(), and rt_ars_prep().

Here is the call graph for this function:

void nmg_vlist_to_eu ( struct bu_list vlist,
struct shell *  s 
)

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

Definition at line 10969 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, nmg_me(), nmg_vertex_gv(), bn_vlist::nused, bn_vlist::pt, and OSL::Strings::v.

Here is the call graph for this function: