BRL-CAD
#include "common.h"
#include <stddef.h>
#include <string.h>
#include "bio.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
Include dependency graph for nmg_ck.c:

Go to the source code of this file.

Data Structures

struct  v_ck_state
 

Functions

void nmg_vvg (const struct vertex_g *vg)
 
void nmg_vvertex (const struct vertex *v, const struct vertexuse *vup)
 
void nmg_vvua (const uint32_t *vua)
 
void nmg_vvu (const struct vertexuse *vu, const uint32_t *up_magic_p)
 
void nmg_veg (const uint32_t *eg)
 
void nmg_vedge (const struct edge *e, const struct edgeuse *eup)
 
void nmg_veu (const struct bu_list *hp, const uint32_t *up_magic_p)
 
void nmg_vlg (const struct loop_g *lg)
 
void nmg_vloop (const struct loop *l, const struct loopuse *lup)
 
void nmg_vlu (const struct bu_list *hp, const uint32_t *up)
 
void nmg_vfg (const struct face_g_plane *fg)
 
void nmg_vface (const struct face *f, const struct faceuse *fup)
 
void nmg_vfu (const struct bu_list *hp, const struct shell *s)
 
void nmg_vsshell (const struct shell *s, const struct nmgregion *r)
 
void nmg_vshell (const struct bu_list *hp, const struct nmgregion *r)
 
void nmg_vregion (const struct bu_list *hp, const struct model *m)
 
void nmg_vmodel (const struct model *m)
 
void nmg_ck_e (const struct edgeuse *eu, const struct edge *e, const char *str)
 
void nmg_ck_vu (const uint32_t *parent, const struct vertexuse *vu, const char *str)
 
void nmg_ck_eu (const uint32_t *parent, const struct edgeuse *eu, const char *str)
 
void nmg_ck_lg (const struct loop *l, const struct loop_g *lg, const char *str)
 
void nmg_ck_l (const struct loopuse *lu, const struct loop *l, const char *str)
 
void nmg_ck_lu (const uint32_t *parent, const struct loopuse *lu, const char *str)
 
void nmg_ck_fg (const struct face *f, const struct face_g_plane *fg, const char *str)
 
void nmg_ck_f (const struct faceuse *fu, const struct face *f, const char *str)
 
void nmg_ck_fu (const struct shell *s, const struct faceuse *fu, const char *str)
 
int nmg_ck_eg_verts (const struct edge_g_lseg *eg, const struct bn_tol *tol)
 
int nmg_ck_geometry (const struct model *m, const struct bn_tol *tol)
 
int nmg_ck_face_worthless_edges (const struct faceuse *fu)
 
void nmg_ck_lueu (const struct loopuse *cklu, const char *s)
 
int nmg_check_radial (const struct edgeuse *eu, const struct bn_tol *tol)
 
int nmg_eu_2s_orient_bad (const struct edgeuse *eu, const struct shell *s1, const struct shell *s2, const struct bn_tol *tol)
 
int nmg_ck_closed_surf (const struct shell *s, const struct bn_tol *tol)
 
int nmg_ck_closed_region (const struct nmgregion *r, const struct bn_tol *tol)
 
void nmg_ck_v_in_2fus (const struct vertex *vp, const struct faceuse *fu1, const struct faceuse *fu2, const struct bn_tol *tol)
 
HIDDEN void nmg_ck_v_in_fus (uint32_t *vp, void *state, int unused)
 
void nmg_ck_vs_in_region (const struct nmgregion *r, const struct bn_tol *tol)
 

Detailed Description

Validators and consistency checkers for NMG data structures.

Definition in file nmg_ck.c.

Function Documentation

void nmg_vvg ( const struct vertex_g *  vg)

Verify vertex geometry

Definition at line 50 of file nmg_ck.c.

Referenced by nmg_vvertex().

void nmg_vvertex ( const struct vertex *  v,
const struct vertexuse *  vup 
)

Verify a vertex

Definition at line 60 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FOR, and nmg_vvg().

Referenced by nmg_vvu().

Here is the call graph for this function:

void nmg_vvua ( const uint32_t *  vua)

Definition at line 82 of file nmg_ck.c.

Referenced by nmg_vvu().

void nmg_vvu ( const struct vertexuse *  vu,
const uint32_t *  up_magic_p 
)

Verify vertexuse

Definition at line 92 of file nmg_ck.c.

References bu_bomb(), bu_identify_magic(), BU_LIST_FIRST_MAGIC, BU_LIST_HEAD_MAGIC, BU_LIST_PNEXT_PLAST, bu_log(), magic, NMG_VERTEXUSE_MAGIC, nmg_vvertex(), and nmg_vvua().

Referenced by nmg_veu(), and nmg_vlu().

Here is the call graph for this function:

void nmg_veg ( const uint32_t *  eg)

Definition at line 122 of file nmg_ck.c.

References bu_ck_list_magic(), BU_LIST_FOR, BU_LIST_MAIN_PTR, bu_log(), eu2, NMG_EDGE_G_CNURB_MAGIC, NMG_EDGE_G_LSEG_MAGIC, and NMG_EDGEUSE2_MAGIC.

Referenced by nmg_veu().

Here is the call graph for this function:

void nmg_vedge ( const struct edge *  e,
const struct edgeuse *  eup 
)

Verify edge

Definition at line 157 of file nmg_ck.c.

References bu_bomb(), and bu_log().

Referenced by nmg_veu().

Here is the call graph for this function:

void nmg_veu ( const struct bu_list hp,
const uint32_t *  up_magic_p 
)

Verify edgeuse list.

Definition at line 222 of file nmg_ck.c.

References bu_bomb(), bu_ck_list_magic(), BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), NMG_EDGEUSE_MAGIC, NMG_LOOPUSE_MAGIC, nmg_pr_lu_briefly(), NMG_SHELL_MAGIC, nmg_vedge(), nmg_veg(), nmg_vvu(), and V3ARGS.

Referenced by nmg_vlu(), and nmg_vsshell().

Here is the call graph for this function:

void nmg_vlg ( const struct loop_g *  lg)

Verify loop geometry

Definition at line 350 of file nmg_ck.c.

References bu_bomb().

Referenced by nmg_vloop().

Here is the call graph for this function:

void nmg_vloop ( const struct loop *  l,
const struct loopuse *  lup 
)

Verify loop

Definition at line 366 of file nmg_ck.c.

References bu_bomb(), NMG_CK_LOOPUSE(), and nmg_vlg().

Referenced by nmg_vlu().

Here is the call graph for this function:

void nmg_vlu ( const struct bu_list hp,
const uint32_t *  up 
)

Verify loopuse

Definition at line 382 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_PLAST, bu_log(), lu, NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, NMG_LOOPUSE_MAGIC, NMG_VERTEXUSE_MAGIC, nmg_veu(), nmg_vloop(), and nmg_vvu().

Referenced by nmg_vfu(), and nmg_vsshell().

Here is the call graph for this function:

void nmg_vfg ( const struct face_g_plane *  fg)

Verify face geometry

Definition at line 441 of file nmg_ck.c.

References bu_bomb(), bu_log(), NMG_FACE_G_PLANE_MAGIC, NMG_FACE_G_SNURB_MAGIC, SMALL_FASTF, X, Y, Z, and ZERO.

Referenced by nmg_vface().

Here is the call graph for this function:

void nmg_vface ( const struct face *  f,
const struct faceuse *  fup 
)

Verify face

Definition at line 462 of file nmg_ck.c.

References bu_bomb(), bu_log(), nmg_vfg(), and V3ARGS.

Referenced by nmg_vfu().

Here is the call graph for this function:

void nmg_vfu ( const struct bu_list hp,
const struct shell *  s 
)

Validate a list of faceuses

Definition at line 488 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), NMG_CK_SHELL(), NMG_FACEUSE_MAGIC, nmg_vface(), and nmg_vlu().

Referenced by nmg_face_state_transition(), and nmg_vsshell().

Here is the call graph for this function:

void nmg_vsshell ( const struct shell *  s,
const struct nmgregion *  r 
)

validate a single shell and all elements under it

Definition at line 541 of file nmg_ck.c.

References bu_bomb(), BU_LIST_NON_EMPTY, bu_log(), NMG_CK_SHELL(), nmg_veu(), nmg_vfu(), and nmg_vlu().

Referenced by nmg_triangulate_shell(), and nmg_vshell().

Here is the call graph for this function:

void nmg_vshell ( const struct bu_list hp,
const struct nmgregion *  r 
)

Validate a list of shells and all elements under them.

Definition at line 591 of file nmg_ck.c.

References BU_LIST_FOR, nmg_vsshell(), and s.

Referenced by nmg_booltree_evaluate(), nmg_booltree_leaf_tess(), nmg_booltree_leaf_tnurb(), nmg_crackshells(), nmg_eval_shell(), nmg_js(), and nmg_vregion().

Here is the call graph for this function:

void nmg_vregion ( const struct bu_list hp,
const struct model *  m 
)

validate a list of nmgregions and all elements under them

Definition at line 607 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FOR, BU_LIST_PNEXT_PLAST, bu_log(), and nmg_vshell().

Referenced by nmg_vmodel().

Here is the call graph for this function:

void nmg_vmodel ( const struct model *  m)

validate an NMG model and all elements in it.

Definition at line 635 of file nmg_ck.c.

References nmg_vregion().

Referenced by ged_bev(), nmg_hollow_shell(), nmg_isect_shell_self(), nmg_stash_model_to_file(), nmg_triangulate_model_mc(), rt_nmg_export4(), and rt_nmg_import4().

Here is the call graph for this function:

void nmg_ck_e ( const struct edgeuse *  eu,
const struct edge *  e,
const char *  str 
)

Definition at line 649 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), and bu_strlcat.

Referenced by nmg_ck_eu().

Here is the call graph for this function:

void nmg_ck_vu ( const uint32_t *  parent,
const struct vertexuse *  vu,
const char *  str 
)

Definition at line 681 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), and bu_strlcat.

Referenced by nmg_ck_eu(), and nmg_ck_lu().

Here is the call graph for this function:

void nmg_ck_eu ( const uint32_t *  parent,
const struct edgeuse *  eu,
const char *  str 
)

Definition at line 699 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_strlcat, nmg_ck_e(), nmg_ck_vu(), NMG_LOOPUSE_MAGIC, and NMG_SHELL_MAGIC.

Referenced by nmg_ck_lu().

Here is the call graph for this function:

void nmg_ck_lg ( const struct loop *  l,
const struct loop_g *  lg,
const char *  str 
)

Definition at line 777 of file nmg_ck.c.

References bu_calloc(), and bu_free().

Referenced by nmg_ck_l().

Here is the call graph for this function:

void nmg_ck_l ( const struct loopuse *  lu,
const struct loop *  l,
const char *  str 
)

Definition at line 793 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), bu_strlcat, nmg_ck_lg(), and NMG_CK_LOOPUSE().

Referenced by nmg_ck_lu().

Here is the call graph for this function:

void nmg_ck_lu ( const uint32_t *  parent,
const struct loopuse *  lu,
const char *  str 
)

Definition at line 816 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_strlcat, nmg_ck_eu(), nmg_ck_l(), NMG_CK_LOOPUSE(), nmg_ck_vu(), NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, NMG_SHELL_MAGIC, and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_ck_fu().

Here is the call graph for this function:

void nmg_ck_fg ( const struct face *  f,
const struct face_g_plane *  fg,
const char *  str 
)

Definition at line 884 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), SMALL_FASTF, X, Y, Z, and ZERO.

Referenced by nmg_ck_f().

Here is the call graph for this function:

void nmg_ck_f ( const struct faceuse *  fu,
const struct face *  f,
const char *  str 
)

Definition at line 905 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), bu_strlcat, and nmg_ck_fg().

Referenced by nmg_ck_fu().

Here is the call graph for this function:

void nmg_ck_fu ( const struct shell *  s,
const struct faceuse *  fu,
const char *  str 
)

Definition at line 928 of file nmg_ck.c.

References bu_bomb(), bu_calloc(), bu_free(), BU_LIST_FOR, BU_LIST_PLAST_PNEXT, BU_LIST_PNEXT_PLAST, bu_strlcat, lu, nmg_ck_f(), NMG_CK_LOOPUSE(), nmg_ck_lu(), and NMG_CK_SHELL().

Here is the call graph for this function:

int nmg_ck_eg_verts ( const struct edge_g_lseg *  eg,
const struct bn_tol tol 
)

Check if vertices from edgeuses using this edge geometry actually lie on the edge geometry.

"eg" must be LSEG returns number of vertices not on edge line

Definition at line 990 of file nmg_ck.c.

References BN_CK_TOL, BU_LIST_FOR, BU_LIST_MAIN_PTR, bu_log(), bn_tol::dist_sq, eu2, and V3ARGS.

Referenced by nmg_ck_geometry().

Here is the call graph for this function:

int nmg_ck_geometry ( const struct model *  m,
const struct bn_tol tol 
)

Check that vertices actually lie on geometry for faces and edges

returns number of vertices that do not lie on geometry

Definition at line 1045 of file nmg_ck.c.

References BN_CK_TOL, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl_reset(), nmg_ck_eg_verts(), nmg_ck_fg_verts(), NMG_EDGE_G_CNURB_MAGIC, NMG_EDGE_G_LSEG_MAGIC, nmg_edge_g_tabulate(), and nmg_face_tabulate().

Here is the call graph for this function:

int nmg_ck_face_worthless_edges ( const struct faceuse *  fu)

Search for null ("worthless") edges in a face. Such edges are legitimate to have, but can be troublesome for the boolean routines.

Often used to see if breaking an edge at a given vertex results in a null edge being created.

Definition at line 1103 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bu_log(), lu, NMG_CK_LOOPUSE(), and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_isect_line2_edge2p(), and nmg_isect_two_generic_faces().

Here is the call graph for this function:

void nmg_ck_lueu ( const struct loopuse *  cklu,
const char *  s 
)

check all the edgeuses of a loopuse to make sure these children know who their parent really is.

Definition at line 1138 of file nmg_ck.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), nmg_pr_lu(), and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_cut_loop().

Here is the call graph for this function:

int nmg_check_radial ( const struct edgeuse *  eu,
const struct bn_tol tol 
)

check to see if all radial uses of an edge (within a shell) are properly oriented with respect to each other. NOTE that ONLY edgeuses belonging to the shell of eu are checked.

Can't check faceuse orientation parity for things from more than one shell; parity is conserved only within faces from a single shell.

Return 0 OK 1 bad edgeuse mate 2 unclosed space

Definition at line 1210 of file nmg_ck.c.

References BN_CK_TOL, bu_bomb(), bu_log(), eu1, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_face_lu_plot(), nmg_find_fu_of_eu(), nmg_find_model(), nmg_find_s_of_eu(), nmg_orientation(), nmg_pr_fu_around_eu(), nmg_stash_model_to_file(), RTG, and s.

Referenced by nmg_ck_closed_surf().

Here is the call graph for this function:

int nmg_eu_2s_orient_bad ( const struct edgeuse *  eu,
const struct shell *  s1,
const struct shell *  s2,
const struct bn_tol tol 
)

Given an edgeuse, check that the proper orientation "parity" of same/opposite/opposite/same is preserved, for all non-wire edgeuses within shell s1. If s2 is non-null, then ensure that the parity of all edgeuses in BOTH s1 and s2 are correct, and mutually compatible.

This routine does not care if a face is "dangling" or not.

If the edgeuse specified is a wire edgeuse, skip forward to a non-wire.

Returns - 0 OK !0 Bad orientation parity.

Definition at line 1336 of file nmg_ck.c.

References BN_CK_TOL, bu_bomb(), bu_log(), eu1, NMG_CK_LOOPUSE(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_find_fu_of_eu(), nmg_pr_fu_around_eu(), out, RTG, and s.

Here is the call graph for this function:

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

Verify that shell is closed. Do this by verifying that it is not possible to get from outside to inside the solid by crossing any face edge.

Returns - 0 OK !0 Problem.

Definition at line 1448 of file nmg_ck.c.

References BN_CK_TOL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), lu, nmg_check_radial(), NMG_CK_LOOPUSE(), NMG_CK_SHELL(), NMG_EDGEUSE_MAGIC, and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_ck_closed_region().

Here is the call graph for this function:

int nmg_ck_closed_region ( const struct nmgregion *  r,
const struct bn_tol tol 
)

Check all the shells in a region for being closed.

Returns - 0 OK !0 status code from nmg_check_radial()

Definition at line 1493 of file nmg_ck.c.

References BN_CK_TOL, BU_LIST_FOR, nmg_ck_closed_surf(), and s.

Referenced by nmg_booltree_evaluate().

Here is the call graph for this function:

void nmg_ck_v_in_2fus ( const struct vertex *  vp,
const struct faceuse *  fu1,
const struct faceuse *  fu2,
const struct bn_tol tol 
)

accepts a vertex pointer, two faceuses, and a tolerance. Checks if the vertex is in both faceuses (topologically and geometrically within tolerance of plane).

Calls bu_bomb if vertex is not in the faceuses topology or out of tolerance of either face.

Definition at line 1519 of file nmg_ck.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FOR, bu_vls_addr(), BU_VLS_INIT_ZERO, bu_vls_printf(), bn_tol::dist, NEAR_ZERO, nmg_find_fu_of_vu(), and V3ARGS.

Referenced by nmg_enlist_one_vu(), and nmg_enlist_vu().

Here is the call graph for this function:

HIDDEN void nmg_ck_v_in_fus ( uint32_t *  vp,
void *  state,
int  unused 
)

Definition at line 1585 of file nmg_ck.c.

References BU_LIST_FOR, bu_log(), bn_tol::dist, NEAR_ZERO, NMG_FACE_G_PLANE_MAGIC, nmg_find_fu_of_vu(), v_ck_state::tol, OSL::Strings::v, V3ARGS, and v_ck_state::visited.

Referenced by nmg_ck_vs_in_region().

Here is the call graph for this function:

void nmg_ck_vs_in_region ( const struct nmgregion *  r,
const struct bn_tol tol 
)

Definition at line 1624 of file nmg_ck.c.

References BN_CK_TOL, bu_calloc(), bu_free(), bu_ptbl_free(), bu_ptbl_init(), nmg_ck_v_in_fus(), nmg_visit(), v_ck_state::tabl, v_ck_state::tol, and v_ck_state::visited.

Referenced by nmg_crackshells().

Here is the call graph for this function: