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

Go to the source code of this file.

Data Structures

struct  fen2d_state
 
struct  vf_state
 
struct  edge_line_state
 
struct  e_and_v_state
 

Functions

struct model * nmg_find_model (const uint32_t *magic_p_arg)
 
struct shell * nmg_find_shell (const uint32_t *magic_p)
 
void nmg_model_bb (fastf_t *min_pt, fastf_t *max_pt, const struct model *m)
 
int nmg_shell_is_empty (register const struct shell *s)
 
struct shell * nmg_find_s_of_lu (const struct loopuse *lu)
 
struct shell * nmg_find_s_of_eu (const struct edgeuse *eu)
 
struct shell * nmg_find_s_of_vu (const struct vertexuse *vu)
 
struct faceuse * nmg_find_fu_of_eu (const struct edgeuse *eu)
 
struct faceuse * nmg_find_fu_of_lu (const struct loopuse *lu)
 
struct faceuse * nmg_find_fu_of_vu (const struct vertexuse *vu)
 
struct faceuse * nmg_find_fu_with_fg_in_s (const struct shell *s1, const struct faceuse *fu2)
 
double nmg_measure_fu_angle (const struct edgeuse *eu, const fastf_t *xvec, const fastf_t *yvec, const fastf_t *zvec)
 
struct loopuse * nmg_find_lu_of_vu (const struct vertexuse *vu)
 
int nmg_loop_is_a_crack (const struct loopuse *lu)
 
int nmg_loop_is_ccw (const struct loopuse *lu, const fastf_t *norm, const struct bn_tol *tol)
 
const struct vertexuse * nmg_loop_touches_self (const struct loopuse *lu)
 
struct edgeuse * nmg_find_matching_eu_in_s (const struct edgeuse *eu1, const struct shell *s2)
 
struct edgeuse * nmg_findeu (const struct vertex *v1, const struct vertex *v2, const struct shell *s, const struct edgeuse *eup, int dangling_only)
 
struct edgeuse * nmg_find_eu_in_face (const struct vertex *v1, const struct vertex *v2, const struct faceuse *fu, const struct edgeuse *eup, int dangling_only)
 
struct edgeuse * nmg_find_e (const struct vertex *v1, const struct vertex *v2, const struct shell *s, const struct edge *ep)
 
struct edgeuse * nmg_find_eu_of_vu (const struct vertexuse *vu)
 
struct edgeuse * nmg_find_eu_with_vu_in_lu (const struct loopuse *lu, const struct vertexuse *vu)
 
const struct edgeuse * nmg_faceradial (const struct edgeuse *eu)
 
const struct edgeuse * nmg_radial_face_edge_in_shell (const struct edgeuse *eu)
 
const struct edgeuse * nmg_find_edge_between_2fu (const struct faceuse *fu1, const struct faceuse *fu2, const struct bn_tol *tol)
 
struct edge * nmg_find_e_nearest_pt2 (uint32_t *magic_p, const fastf_t *pt2, const fastf_t *mat, const struct bn_tol *tol)
 
void nmg_eu_2vecs_perp (fastf_t *xvec, fastf_t *yvec, fastf_t *zvec, const struct edgeuse *eu, const struct bn_tol *tol)
 
int nmg_find_eu_leftvec (fastf_t *left, const struct edgeuse *eu)
 
int nmg_find_eu_left_non_unit (fastf_t *left, const struct edgeuse *eu)
 
struct edgeuse * nmg_find_ot_same_eu_of_e (const struct edge *e)
 
struct vertexuse * nmg_find_v_in_face (const struct vertex *v, const struct faceuse *fu)
 
struct vertexuse * nmg_find_v_in_shell (const struct vertex *v, const struct shell *s, int edges_only)
 
struct vertexuse * nmg_find_pt_in_lu (const struct loopuse *lu, const fastf_t *pt, const struct bn_tol *tol)
 
struct vertexuse * nmg_find_pt_in_face (const struct faceuse *fu, const fastf_t *pt, const struct bn_tol *tol)
 
struct vertex * nmg_find_pt_in_shell (const struct shell *s, const fastf_t *pt, const struct bn_tol *tol)
 
struct vertex * nmg_find_pt_in_model (const struct model *m, const fastf_t *pt, const struct bn_tol *tol)
 
int nmg_is_vertex_in_edgelist (register const struct vertex *v, const struct bu_list *hd)
 
int nmg_is_vertex_in_looplist (register const struct vertex *v, const struct bu_list *hd, int singletons)
 
struct vertexuse * nmg_is_vertex_in_face (const struct vertex *v, const struct face *f)
 
int nmg_is_vertex_a_selfloop_in_shell (const struct vertex *v, const struct shell *s)
 
int nmg_is_vertex_in_facelist (register const struct vertex *v, const struct bu_list *hd)
 
int nmg_is_edge_in_edgelist (const struct edge *e, const struct bu_list *hd)
 
int nmg_is_edge_in_looplist (const struct edge *e, const struct bu_list *hd)
 
int nmg_is_edge_in_facelist (const struct edge *e, const struct bu_list *hd)
 
int nmg_is_loop_in_facelist (const struct loop *l, const struct bu_list *fu_hd)
 
void nmg_vertex_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_vertexuse_normal_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_edgeuse_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_edge_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_edge_g_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_face_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p)
 
void nmg_edgeuse_with_eg_tabulate (struct bu_ptbl *tab, const struct edge_g_lseg *eg)
 
void nmg_edgeuse_on_line_tabulate (struct bu_ptbl *tab, const uint32_t *magic_p, const fastf_t *pt, const fastf_t *dir, const struct bn_tol *tol)
 
void nmg_e_and_v_tabulate (struct bu_ptbl *eutab, struct bu_ptbl *vtab, const uint32_t *magic_p)
 
int nmg_2edgeuse_g_coincident (const struct edgeuse *eu1, const struct edgeuse *eu2, const struct bn_tol *tol)
 

Detailed Description

A companion module to nmg_mod.c which contains routines to answer questions about n-Manifold Geometry data structures. None of these routines will modify the NMG structures in any way.

Definition in file nmg_info.c.

Function Documentation

struct model* nmg_find_model ( const uint32_t *  magic_p_arg)

Given a pointer to the magic number in any NMG data structure, return a pointer to the model structure that contains that NMG item.

The reason for the register variable is to leave the argument variable unmodified; this may aid debugging in event of a core dump.

Definition at line 57 of file nmg_info.c.

References bu_bomb(), bu_identify_magic(), BU_LIST_FIRST, bu_log(), magic_p, NMG_EDGE_MAGIC, NMG_EDGEUSE_MAGIC, NMG_FACE_MAGIC, NMG_FACEUSE_MAGIC, NMG_LOOP_MAGIC, NMG_LOOPUSE_MAGIC, NMG_MODEL_MAGIC, NMG_REGION_MAGIC, NMG_SHELL_MAGIC, NMG_VERTEX_MAGIC, NMG_VERTEXUSE_MAGIC, and top().

Referenced by cut_unimonotone(), nmg_2face_plot(), nmg_check_radial(), nmg_class_ray_vs_shell(), nmg_cut_lu_into_coplanar_and_non(), nmg_dup_face(), nmg_dup_shell(), nmg_e_and_v_tabulate(), nmg_edge_g(), nmg_edge_g_cnurb(), nmg_edge_g_cnurb_plinear(), nmg_edge_g_tabulate(), nmg_edge_tabulate(), nmg_edgeuse_on_line_tabulate(), nmg_edgeuse_tabulate(), nmg_extrude_cleanup(), nmg_extrude_shell(), nmg_face_g(), nmg_face_g_snurb(), nmg_face_lu_plot(), nmg_face_new_g(), nmg_face_plot(), nmg_face_tabulate(), nmg_find_e_nearest_pt2(), nmg_find_edge_between_2fu(), nmg_find_eg_between_2fg(), nmg_get_edge_lines(), nmg_get_max_edge_inters(), nmg_has_dangling_faces(), nmg_hollow_shell(), nmg_isect2d_prep(), nmg_isect_edge2p_edge2p(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_isect_fu_jra(), nmg_isect_shell_self(), nmg_loop_g(), nmg_loop_split_at_touching_jaunt(), nmg_me(), nmg_meonvu(), nmg_mf(), nmg_ml(), nmg_mlv(), nmg_move_edge_thru_pt(), nmg_mv_shell_to_region(), nmg_pl_2fu(), nmg_pl_comb_fu(), nmg_pl_lu_around_eu(), nmg_plot_lu_around_eu(), nmg_plot_lu_ray(), nmg_shell_a(), nmg_shell_is_void(), nmg_show_broken_classifier_stuff(), nmg_split_loops_into_faces(), nmg_triangulate_rm_holes(), nmg_unbreak_region_edges(), nmg_unglueedge(), nmg_vertex_gv(), nmg_vertex_tabulate(), nmg_vertexuse_a_cnurb(), nmg_vertexuse_normal_tabulate(), nmg_vertexuse_nv(), pleu(), and vertex_neighborhood().

Here is the call graph for this function:

struct shell* nmg_find_shell ( const uint32_t *  magic_p)

Given a pointer to the magic number in any NMG data structure, return a pointer to the shell structure that contains that NMG item.

The reason for the register variable is to leave the argument variable unmodified; this may aid debugging in event of a core dump.

Definition at line 119 of file nmg_info.c.

References bu_bomb(), bu_identify_magic(), BU_LIST_FIRST, bu_log(), magic_p, NMG_EDGE_MAGIC, NMG_EDGEUSE_MAGIC, NMG_FACE_MAGIC, NMG_FACEUSE_MAGIC, NMG_LOOP_MAGIC, NMG_LOOPUSE_MAGIC, NMG_SHELL_MAGIC, NMG_VERTEX_MAGIC, NMG_VERTEXUSE_MAGIC, and top().

Referenced by nmg_edge_fuse().

Here is the call graph for this function:

void nmg_model_bb ( fastf_t min_pt,
fastf_t max_pt,
const struct model *  m 
)

Definition at line 166 of file nmg_info.c.

References BU_LIST_FOR, and MAX_FASTF.

Referenced by nmg_class_pt_s(), rt_nmg_bbox(), and vertex_neighborhood().

int nmg_shell_is_empty ( register const struct shell *  s)

See if this is an invalid shell i.e., one that has absolutely nothing in it, not even a lone vertexuse.

Returns - 1 yes, it is completely empty 0 no, not empty

Definition at line 203 of file nmg_info.c.

References BU_LIST_NON_EMPTY, and NMG_CK_SHELL().

Referenced by nmg_demote_eu(), nmg_do_bool(), nmg_keu(), nmg_kfu(), nmg_klu(), nmg_kvu(), and nmg_simplify_shell().

Here is the call graph for this function:

struct shell* nmg_find_s_of_lu ( const struct loopuse *  lu)

return parent shell for loopuse formerly nmg_lups().

Definition at line 220 of file nmg_info.c.

References bu_bomb(), NMG_FACEUSE_MAGIC, and NMG_SHELL_MAGIC.

Referenced by nmg_demote_lu(), nmg_find_s_of_eu(), nmg_find_s_of_vu(), and nmg_find_v_in_shell().

Here is the call graph for this function:

struct shell* nmg_find_s_of_eu ( const struct edgeuse *  eu)
struct shell* nmg_find_s_of_vu ( const struct vertexuse *  vu)

Return parent shell of vertexuse

Definition at line 249 of file nmg_info.c.

References nmg_find_s_of_eu(), nmg_find_s_of_lu(), and NMG_LOOPUSE_MAGIC.

Referenced by nmg_enlist_one_vu(), nmg_enlist_vu(), nmg_find_path(), nmg_follow_free_edges_to_vertex(), nmg_isect_two_ptbls(), nmg_mk_model_from_region(), and nmg_simplify_shell_edges().

Here is the call graph for this function:

struct faceuse* nmg_find_fu_of_lu ( const struct loopuse *  lu)

Definition at line 283 of file nmg_info.c.

References bu_bomb(), bu_log(), NMG_FACEUSE_MAGIC, and NMG_SHELL_MAGIC.

Referenced by nmg_find_fu_of_vu(), and nmg_remove_short_eus_inter().

Here is the call graph for this function:

struct faceuse* nmg_find_fu_of_vu ( const struct vertexuse *  vu)

return a pointer to the parent faceuse of the vertexuse or a null pointer if vu is not a child of a faceuse.

Definition at line 304 of file nmg_info.c.

References bu_log(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_fu_of_lu(), NMG_LOOPUSE_MAGIC, NMG_SHELL_MAGIC, and RTG.

Referenced by nmg_ck_v_in_2fus(), nmg_ck_v_in_fus(), nmg_ck_vert_on_fus(), nmg_ck_vu_ptbl(), nmg_cut_lu_into_coplanar_and_non(), nmg_enlist_vu(), nmg_face_cutjoin(), nmg_find_isect_faces(), nmg_isect_fu_jra(), nmg_kill_cracks_at_vertex(), nmg_remove_short_eus_inter(), pick_edges(), rt_ehy_tess(), rt_ell_tess(), rt_epa_tess(), rt_eto_tess(), rt_hyp_tess(), rt_part_tess(), rt_rhc_tess(), rt_rpc_tess(), rt_tgc_tess(), rt_tor_tess(), and vertex_neighborhood().

Here is the call graph for this function:

struct faceuse* nmg_find_fu_with_fg_in_s ( const struct shell *  s1,
const struct faceuse *  fu2 
)

Find a faceuse in shell s1 that shares the face_g_plane structure with fu2 and has the same orientation. This may be an OT_OPPOSITE faceuse, depending on orientation. Returns NULL if no such faceuse can be found in s1. fu2 may be in s1, or in some other shell.

Definition at line 341 of file nmg_info.c.

References BU_LIST_FOR, f1, f2, and NMG_CK_SHELL().

Referenced by nmg_js().

Here is the call graph for this function:

double nmg_measure_fu_angle ( const struct edgeuse *  eu,
const fastf_t xvec,
const fastf_t yvec,
const fastf_t zvec 
)

Return the angle in radians from the interior portion of the faceuse associated with edgeuse 'eu', measured in the coordinate system defined by xvec and yvec, which are known to be perpendicular to each other, and to the edge vector.

This is done by finding the "left-ward" vector for the edge in the face, which points into the interior of the face, and measuring the angle it forms relative to xvec and yvec.

Wire edges are indicated by always returning angle of -pi. That will be the only case for negative returns.

Definition at line 391 of file nmg_info.c.

References bn_angle_measure(), M_PI, nmg_find_eu_leftvec(), and NMG_LOOPUSE_MAGIC.

Referenced by nmg_check_radial_angles(), nmg_pr_one_eu_vecs(), nmg_radial_build_list(), and nmg_radial_join_eu().

Here is the call graph for this function:

int nmg_loop_is_a_crack ( const struct loopuse *  lu)

A "crack" is defined as a loop which has no area.

Example of a non-trivial "crack" loop:

                  <---- eu4 -----
                C ############### D
              | # ^ ---- eu3 --->
              | # |
            eu5 # eu2
              | # |
   <--- eu6 --V # |
 A ############ B
   --- eu1 ---->

Returns - 0 Loop is not a "crack" !0 Loop is a "crack"

Definition at line 449 of file nmg_info.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, NMG_LOOPUSE_MAGIC, out, and RTG.

Referenced by nmg_cut_lu_into_coplanar_and_non(), nmg_face_state_transition(), nmg_get_interior_pt(), nmg_is_crack_outie(), nmg_loop_plane_area(), and nmg_loop_plane_newell().

Here is the call graph for this function:

int nmg_loop_is_ccw ( const struct loopuse *  lu,
const fastf_t norm,
const struct bn_tol tol 
)

Determine if loop proceeds counterclockwise (CCW) around the provided normal vector (which may be either the face normal, or the anti-normal).

Returns - +1 Loop is CCW, should be exterior loop. -1 Loop is CW, should be interior loop. 0 Unable to tell, error.

Definition at line 533 of file nmg_info.c.

References bu_log(), DEBUG_MATH, bn_tol::dist_sq, NEAR_ZERO, rt_g::NMG_debug, nmg_loop_plane_area2(), nmg_pr_lu_briefly(), out, RT_G_DEBUG, RTG, SMALL_FASTF, and UNLIKELY.

Referenced by cut_unimonotone(), nmg_brep_face(), and nmg_triangulate_fu().

Here is the call graph for this function:

const struct vertexuse* nmg_loop_touches_self ( const struct loopuse *  lu)

Search through all the vertices in a loop. If there are two distinct uses of one vertex in the loop, return true. This is useful for detecting "accordian pleats" unexpectedly showing up in a loop. Derived from nmg_split_touchingloops().

Returns - vu Yes, the loop touches itself at least once, at this vu. 0 No, the loop does not touch itself.

Definition at line 578 of file nmg_info.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, NMG_EDGEUSE_MAGIC, NMG_LOOPUSE_MAGIC, and OSL::Strings::v.

Referenced by nmg_extrude_cleanup(), and nmg_fu_touchingloops().

struct edgeuse* nmg_find_matching_eu_in_s ( const struct edgeuse *  eu1,
const struct shell *  s2 
)

If shell s2 has an edge that connects the same vertices as eu1 connects, return the matching edgeuse in s2. This routine works properly regardless of whether eu1 is in s2 or not. A convenient wrapper for nmg_findeu().

Definition at line 641 of file nmg_info.c.

References BU_LIST_PNEXT_CIRC, eu2, NMG_CK_SHELL(), nmg_find_v_in_shell(), and nmg_findeu().

Referenced by nmg_isect_face3p_shell_int().

Here is the call graph for this function:

struct edgeuse* nmg_findeu ( const struct vertex *  v1,
const struct vertex *  v2,
const struct shell *  s,
const struct edgeuse *  eup,
int  dangling_only 
)

Find an edgeuse in a shell between a given pair of vertex structs.

If a given shell "s" is specified, then only edgeuses in that shell will be considered, otherwise all edgeuses in the model are fair game.

If a particular edgeuse "eup" is specified, then that edgeuse and its mate will not be returned as a match.

If "dangling_only" is true, then an edgeuse will be matched only if there are no other edgeuses on the edge, i.e. the radial edgeuse is the same as the mate edgeuse.

Returns - edgeuse* Edgeuse which matches the criteria NULL Unable to find matching edgeuse

Definition at line 682 of file nmg_info.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_fu_of_eu(), nmg_find_s_of_eu(), NMG_LOOPUSE_MAGIC, out, and RTG.

Referenced by nmg_cmface(), nmg_face_state_transition(), nmg_fcut_face(), nmg_find_matching_eu_in_s(), nmg_glue_face_in_shell(), nmg_open_shells_connect(), and nmg_repair_v_near_v().

Here is the call graph for this function:

struct edgeuse* nmg_find_eu_in_face ( const struct vertex *  v1,
const struct vertex *  v2,
const struct faceuse *  fu,
const struct edgeuse *  eup,
int  dangling_only 
)

An analog to nmg_findeu(), only restricted to searching a faceuse, rather than to a whole shell.

Definition at line 778 of file nmg_info.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_fu_of_eu(), NMG_LOOPUSE_MAGIC, out, and RTG.

Referenced by nmg_fcut_face().

Here is the call graph for this function:

struct edgeuse* nmg_find_e ( const struct vertex *  v1,
const struct vertex *  v2,
const struct shell *  s,
const struct edge *  ep 
)

Find an edge between a given pair of vertices.

If a given shell "s" is specified, then only edges in that shell will be considered, otherwise all edges in the model are fair game.

If a particular edge "ep" is specified, then that edge will not be returned as a match.

Returns - edgeuse* Edgeuse of an edge which matches the criteria NULL Unable to find matching edge

Definition at line 882 of file nmg_info.c.

References bu_bomb(), BU_LIST_FOR, bu_log(), NMG_CK_SHELL(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_s_of_eu(), NMG_LOOPUSE_MAGIC, out, and RTG.

Referenced by nmg_close_shell().

Here is the call graph for this function:

struct edgeuse* nmg_find_eu_of_vu ( const struct vertexuse *  vu)

Return a pointer to the edgeuse which is the parent of this vertexuse.

A simple helper routine, which replaces the amazingly bad sequence of: nmg_find_eu_with_vu_in_lu(nmg_find_lu_of_vu(vu), vu) that was being used in several places.

Definition at line 955 of file nmg_info.c.

References NMG_EDGEUSE_MAGIC.

Referenced by nmg_face_state_transition().

struct edgeuse* nmg_find_eu_with_vu_in_lu ( const struct loopuse *  lu,
const struct vertexuse *  vu 
)

Find an edgeuse starting at a given vertexuse within a loopuse.

Definition at line 970 of file nmg_info.c.

References bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, NMG_CK_LOOPUSE(), and NMG_EDGEUSE_MAGIC.

Referenced by nmg_assess_vu(), nmg_face_coincident_vu_sort(), and nmg_vu_angle_measure().

Here is the call graph for this function:

const struct edgeuse* nmg_faceradial ( const struct edgeuse *  eu)

Looking radially around an edge, find another edge in the same face as the current edge. (this could be the mate to the current edge)

Definition at line 995 of file nmg_info.c.

References NMG_FACEUSE_MAGIC, and NMG_LOOPUSE_MAGIC.

const struct edgeuse* nmg_radial_face_edge_in_shell ( const struct edgeuse *  eu)

looking radially around an edge, find another edge which is a part of a face in the same shell

Definition at line 1021 of file nmg_info.c.

References NMG_FACEUSE_MAGIC, nmg_find_s_of_eu(), NMG_LOOPUSE_MAGIC, and s.

Referenced by nmg_dangling_face(), and nmg_plot_open_edges().

Here is the call graph for this function:

const struct edgeuse* nmg_find_edge_between_2fu ( const struct faceuse *  fu1,
const struct faceuse *  fu2,
const struct bn_tol tol 
)

Perform a topology search to determine if two faces (specified by their faceuses) share an edge in common. If so, return an edgeuse in fu1 of that edge.

If there are multiple edgeuses in common, ensure that they all refer to the same edge_g_lseg geometry structure. The intersection of two planes (non-coplanar) must be a single line.

Calling this routine when the two faces share face geometry and have more than one edge in common gives a NULL return, as there is no unique answer.

NULL is also returned if no common edge could be found.

Definition at line 1060 of file nmg_info.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, nmg_2edgeuse_g_coincident(), rt_g::NMG_debug, NMG_FACEUSE_MAGIC, nmg_find_model(), nmg_jeg(), NMG_LOOPUSE_MAGIC, nmg_model_fuse(), nmg_pr_eg(), nmg_pr_eu_endpoints(), NMG_VERTEXUSE_MAGIC, and RTG.

Here is the call graph for this function:

struct edge* nmg_find_e_nearest_pt2 ( uint32_t *  magic_p,
const fastf_t pt2,
const fastf_t mat,
const struct bn_tol tol 
)

A geometric search routine to find the edge that is nearest to the given point, when all edges are projected into 2D using the matrix 'mat'. Useful for finding the edge nearest a mouse click, for example.

Definition at line 1189 of file nmg_info.c.

References BN_CK_TOL, bu_calloc(), bu_free(), fen2d_state::ep, fen2d_state::mat, fen2d_state::mindist, nmg_find_model(), nmg_visit(), fen2d_state::pt2, fen2d_state::tol, and fen2d_state::visited.

Here is the call graph for this function:

void nmg_eu_2vecs_perp ( fastf_t xvec,
fastf_t yvec,
fastf_t zvec,
const struct edgeuse *  eu,
const struct bn_tol tol 
)

Given an edgeuse, return two arbitrary unit-length vectors which are perpendicular to each other and to the edgeuse, such that they can be considered the +X and +Y axis, and the edgeuse is +Z. That is, X cross Y = Z.

Useful for erecting a coordinate system around an edge suitable for measuring the angles of other edges and faces with.

Definition at line 1237 of file nmg_info.c.

References BN_CK_TOL, bn_vec_perp(), and bu_bomb().

Referenced by nmg_pr_fu_around_eu(), nmg_radial_join_eu(), nmg_radial_join_eu_NEW(), nmg_s_radial_harmonize(), and nmg_vlblock_around_eu().

Here is the call graph for this function:

int nmg_find_eu_leftvec ( fastf_t left,
const struct edgeuse *  eu 
)

Given an edgeuse, if it is part of a faceuse, return the inward pointing "left" vector which points into the interior of this loop, and lies in the plane of the face. The left vector is unitized.

This routine depends on the vertex ordering in an OT_SAME loopuse being properly CCW for exterior loops, and CW for interior (hole) loops.

Returns - -1 if edgeuse is not part of a faceuse. 0 if left vector successfully computed into caller's array.

Definition at line 1274 of file nmg_info.c.

References bu_bomb(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), lu, NEAR_ZERO, rt_g::NMG_debug, NMG_FACEUSE_MAGIC, NMG_LOOPUSE_MAGIC, nmg_pr_fu_briefly(), RTG, V3ARGS, and VSETALL.

Referenced by edge_hit_ray_state(), nmg_check_radial_angles(), nmg_class_pt_euvu(), nmg_classify_lu_lu(), nmg_get_interior_pt(), nmg_measure_fu_angle(), nmg_vlblock_euleft(), pick_eu(), and vertex_neighborhood().

Here is the call graph for this function:

int nmg_find_eu_left_non_unit ( fastf_t left,
const struct edgeuse *  eu 
)

Given an edgeuse, if it is part of a faceuse, return the inward pointing "left" vector which points into the interior of this loop, and lies in the plane of the face. The left vector is not unitized.

This routine depends on the vertex ordering in an OT_SAME loopuse being properly CCW for exterior loops, and CW for interior (hole) loops.

Returns - -1 if edgeuse is not part of a faceuse. 0 if left vector successfully computed into caller's array.

Definition at line 1408 of file nmg_info.c.

References lu, NMG_FACEUSE_MAGIC, and NMG_LOOPUSE_MAGIC.

struct edgeuse* nmg_find_ot_same_eu_of_e ( const struct edge *  e)

If there is an edgeuse of an OT_SAME faceuse on this edge, return it. Only return a wire edgeuse if that is all there is. Useful for selecting a "good" edgeuse to pass to nmg_eu_2vecs_perp().

Definition at line 1441 of file nmg_info.c.

References eu1, and nmg_find_fu_of_eu().

Referenced by nmg_radial_join_eu_NEW(), and nmg_s_radial_harmonize().

Here is the call graph for this function:

struct vertexuse* nmg_find_v_in_face ( const struct vertex *  v,
const struct faceuse *  fu 
)

Perform a topological search to determine if the given vertex is contained in the given faceuse. If it is, return a pointer to the vertexuse which was found in the faceuse.

Returns NULL if not found.

Definition at line 1478 of file nmg_info.c.

References BU_LIST_FOR, lu, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, and NMG_LOOPUSE_MAGIC.

Referenced by nmg_is_vertex_on_inter(), nmg_isect_eu_fu(), and nmg_make_dualvu().

struct vertexuse* nmg_find_v_in_shell ( const struct vertex *  v,
const struct shell *  s,
int  edges_only 
)

Search shell "s" for a vertexuse that refers to vertex "v". For efficiency, the search is done on the uses of "v".

If "edges_only" is set, only a vertexuse from an edgeuse will be returned, otherwise, vu's from self-loops and lone-shell-vu's are also candidates.

Definition at line 1514 of file nmg_info.c.

References bu_bomb(), BU_LIST_FOR, NMG_EDGEUSE_MAGIC, nmg_find_s_of_eu(), nmg_find_s_of_lu(), NMG_LOOPUSE_MAGIC, and NMG_SHELL_MAGIC.

Referenced by nmg_enlist_vu(), nmg_find_matching_eu_in_s(), and nmg_kill_non_common_cracks().

Here is the call graph for this function:

struct vertexuse* nmg_find_pt_in_lu ( const struct loopuse *  lu,
const fastf_t pt,
const struct bn_tol tol 
)

Conduct a geometric search for a vertex in loopuse 'lu' which is "identical" to the given point, within the specified tolerance. The loopuse may be part of a face, or it may be wires.

Returns - NULL No vertex matched (struct vertexuse *) A matching vertexuse from that loopuse.

Definition at line 1555 of file nmg_info.c.

References bn_pt3_pt3_equal(), bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, NMG_EDGEUSE_MAGIC, and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_find_pt_in_face(), and nmg_find_pt_in_shell().

Here is the call graph for this function:

struct vertexuse* nmg_find_pt_in_face ( const struct faceuse *  fu,
const fastf_t pt,
const struct bn_tol tol 
)

Conduct a geometric search for a vertex in face 'fu' which is "identical" to the given point, within the specified tolerance.

Returns - NULL No vertex matched (struct vertexuse *) A matching vertexuse from that face.

Definition at line 1601 of file nmg_info.c.

References BN_CK_TOL, BU_LIST_FOR, lu, and nmg_find_pt_in_lu().

Referenced by nmg_cut_lu_into_coplanar_and_non(), and nmg_find_pt_in_shell().

Here is the call graph for this function:

struct vertex* nmg_find_pt_in_shell ( const struct shell *  s,
const fastf_t pt,
const struct bn_tol tol 
)

Given a point in 3-space and a shell pointer, try to find a vertex anywhere in the shell which is within sqrt(tol_sq) distance of the given point.

The algorithm is a brute force, and should be used sparingly. Mike Gigante's NUgrid technique would work well here, if searching was going to be needed for more than a few points.

Returns - pointer to vertex with matching geometry NULL

XXX Why does this return a vertex, while its helpers return a vertexuse?

Definition at line 1634 of file nmg_info.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), BU_LIST_FIRST, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_PNEXT, lu, NMG_CK_SHELL(), nmg_find_pt_in_face(), nmg_find_pt_in_lu(), and OSL::Strings::v.

Referenced by nmg_break_crossed_loops(), nmg_find_pt_in_model(), and rt_pg_tess().

Here is the call graph for this function:

struct vertex* nmg_find_pt_in_model ( const struct model *  m,
const fastf_t pt,
const struct bn_tol tol 
)

Brute force search of the entire model to find a vertex that matches this point. XXX Shouldn't this return the closest match, not just the XXX first match within tolerance?

Definition at line 1708 of file nmg_info.c.

References BN_CK_TOL, BU_LIST_FOR, nmg_find_pt_in_shell(), s, and OSL::Strings::v.

Referenced by nmg_cut_lu_into_coplanar_and_non(), nmg_isect_edge2p_edge2p(), nmg_isect_eu_eu(), nmg_isect_eu_fu(), nmg_isect_line2_edge2p(), and nmg_isect_line2_face2pNEW().

Here is the call graph for this function:

int nmg_is_vertex_in_edgelist ( register const struct vertex *  v,
const struct bu_list hd 
)

Returns - 1 If found 0 If not found

Definition at line 1735 of file nmg_info.c.

References BU_LIST_FOR.

Referenced by nmg_is_vertex_in_looplist(), and nmg_rm_redundancies().

int nmg_is_vertex_in_looplist ( register const struct vertex *  v,
const struct bu_list hd,
int  singletons 
)

Returns - 1 If found 0 If not found

Definition at line 1754 of file nmg_info.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, lu, NMG_EDGEUSE_MAGIC, nmg_is_vertex_in_edgelist(), and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_is_vertex_in_facelist(), and nmg_rm_redundancies().

Here is the call graph for this function:

struct vertexuse* nmg_is_vertex_in_face ( const struct vertex *  v,
const struct face *  f 
)

Returns - vu One use of vertex 'v' in face 'f'. NULL If there are no uses of 'v' in 'f'.

Definition at line 1786 of file nmg_info.c.

References BU_LIST_FOR, lu, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, and NMG_LOOPUSE_MAGIC.

Referenced by nmg_is_common_bigloop().

int nmg_is_vertex_a_selfloop_in_shell ( const struct vertex *  v,
const struct shell *  s 
)

Check to see if a given vertex is used within a shell by a wire loopuse which is a loop of a single vertex. The search could either be by the shell lu_hd, or the vu_hd.

Returns - 0 vertex is not part of that kind of loop in the shell. 1 vertex is part of a selfloop in the given shell.

Definition at line 1820 of file nmg_info.c.

References BU_LIST_FOR, lu, NMG_CK_SHELL(), NMG_LOOPUSE_MAGIC, and NMG_SHELL_MAGIC.

Referenced by nmg_demote_eu().

Here is the call graph for this function:

int nmg_is_vertex_in_facelist ( register const struct vertex *  v,
const struct bu_list hd 
)

Returns - 1 If found 0 If not found

Definition at line 1848 of file nmg_info.c.

References BU_LIST_FOR, and nmg_is_vertex_in_looplist().

Referenced by nmg_rm_redundancies().

Here is the call graph for this function:

int nmg_is_edge_in_edgelist ( const struct edge *  e,
const struct bu_list hd 
)

Returns - 1 If found 0 If not found

Definition at line 1867 of file nmg_info.c.

References BU_LIST_FOR.

Referenced by nmg_is_edge_in_looplist().

int nmg_is_edge_in_looplist ( const struct edge *  e,
const struct bu_list hd 
)

Returns - 1 If found 0 If not found

Definition at line 1885 of file nmg_info.c.

References bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, lu, NMG_EDGEUSE_MAGIC, nmg_is_edge_in_edgelist(), and NMG_VERTEXUSE_MAGIC.

Referenced by nmg_is_edge_in_facelist(), and nmg_rm_redundancies().

Here is the call graph for this function:

int nmg_is_edge_in_facelist ( const struct edge *  e,
const struct bu_list hd 
)

Returns - 1 If found 0 If not found

Definition at line 1914 of file nmg_info.c.

References BU_LIST_FOR, and nmg_is_edge_in_looplist().

Referenced by nmg_rm_redundancies().

Here is the call graph for this function:

int nmg_is_loop_in_facelist ( const struct loop *  l,
const struct bu_list fu_hd 
)

Returns - 1 If found 0 If not found

Definition at line 1933 of file nmg_info.c.

References BU_LIST_FOR, and lu.

Referenced by nmg_rm_redundancies().

void nmg_vertex_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every vertex pointer from there on "down" in the model, each one listed exactly once.

Definition at line 1985 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Referenced by nmg_2_vrml(), nmg_bot(), nmg_break_edges(), nmg_calc_face_plane(), nmg_classify_s_vs_s(), nmg_extrude_shell(), nmg_faces_can_be_intersected(), nmg_isect_fu_jra(), nmg_mirror_model(), nmg_mk_model_from_region(), nmg_region_v_unique(), nmg_vertex_fuse(), rt_ehy_tess(), rt_hyp_tess(), rt_nmg_get(), rt_nmg_mirror(), and Shell_is_arb().

Here is the call graph for this function:

void nmg_vertexuse_normal_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every vertexuse normal pointer from there on "down" in the model, each one listed exactly once.

Definition at line 2038 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Here is the call graph for this function:

void nmg_edgeuse_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every edgeuse pointer from there on "down" in the model, each one listed exactly once.

Definition at line 2088 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Referenced by nmg_break_all_es_on_v(), nmg_edge_fuse(), nmg_find_zero_length_edges(), and nmg_isect_fu_jra().

Here is the call graph for this function:

void nmg_edge_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every edge pointer from there on "down" in the model, each one listed exactly once.

Definition at line 2138 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Referenced by Eplot(), nmg_break_edges(), nmg_check_radial_angles(), nmg_disconnect_shells(), nmg_edge_collapse(), nmg_mark_edges_real(), nmg_mk_model_from_region(), nmg_s_radial_check(), and nmg_s_radial_harmonize().

Here is the call graph for this function:

void nmg_edge_g_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every edge pointer from there on "down" in the model, each one listed exactly once.

Definition at line 2197 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Referenced by nmg_ck_geometry(), nmg_edge_g_fuse(), nmg_isect_line2_face2pNEW(), and nmg_translate_face().

Here is the call graph for this function:

void nmg_face_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which has every face pointer from there on "down" in the model, each one listed exactly once.

Definition at line 2247 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), nmg_find_model(), nmg_visit(), vf_state::tabl, and vf_state::visited.

Referenced by ged_nmg_collapse(), ged_nmg_simplify(), nmg_bot(), nmg_ck_geometry(), nmg_crackshells(), nmg_edge_collapse(), nmg_model_face_fuse(), nmg_plot_open_edges(), rt_nmg_centroid(), rt_nmg_mirror(), rt_nmg_surf_area(), and rt_nmg_volume().

Here is the call graph for this function:

void nmg_edgeuse_with_eg_tabulate ( struct bu_ptbl tab,
const struct edge_g_lseg *  eg 
)

Build an bu_ptbl list which cites every edgeuse pointer that uses edge geometry "eg".

Definition at line 2277 of file nmg_info.c.

References bu_bomb(), BU_LIST_FOR, BU_LIST_MAIN_PTR, bu_ptbl_init(), and bu_ptbl_ins_unique().

Referenced by nmg_break_eg_on_v().

Here is the call graph for this function:

void nmg_edgeuse_on_line_tabulate ( struct bu_ptbl tab,
const uint32_t *  magic_p,
const fastf_t pt,
const fastf_t dir,
const struct bn_tol tol 
)

Given a pointer to any nmg data structure, build an bu_ptbl list which cites every edgeuse pointer from there on "down" in the model that has both vertices within tolerance of the given line.

XXX This routine is a potential source of major trouble. XXX If there are "nearby" edges that "should" be on the list but XXX don't make it, then the intersection calculations might XXX miss important intersections. As an admittedly grubby workaround, use 10X the distance tol here, just to get more candidates onto the list. The caller will have to wrestle with the added fuzz.

Definition at line 2360 of file nmg_info.c.

References BN_CK_TOL, bu_calloc(), bu_free(), bu_ptbl_init(), edge_line_state::dir, nmg_find_model(), nmg_visit(), edge_line_state::pt, edge_line_state::tabl, edge_line_state::tol, and edge_line_state::visited.

Referenced by nmg_find_eg_on_line().

Here is the call graph for this function:

void nmg_e_and_v_tabulate ( struct bu_ptbl eutab,
struct bu_ptbl vtab,
const uint32_t *  magic_p 
)

Build lists of all edges (represented by one edgeuse on that edge) and all vertices found underneath the NMG entity indicated by magic_p.

Definition at line 2442 of file nmg_info.c.

References bu_calloc(), bu_free(), bu_ptbl_init(), e_and_v_state::edges, nmg_find_model(), nmg_visit(), e_and_v_state::verts, and e_and_v_state::visited.

Referenced by nmg_break_e_on_v().

Here is the call graph for this function:

int nmg_2edgeuse_g_coincident ( const struct edgeuse *  eu1,
const struct edgeuse *  eu2,
const struct bn_tol tol 
)

Given two edgeuses, determine if they share the same edge geometry, either topologically, or within tolerance.

Returns - 0 two edge geometries are not coincident 1 edges geometries are everywhere coincident. (For linear edge_g_lseg, the 2 are the same line, within tol.)

Definition at line 2480 of file nmg_info.c.

References bn_distsq_line3_pt3(), and bn_tol::dist_sq.

Referenced by nmg_edge_g_fuse(), nmg_find_edge_between_2fu(), and nmg_find_eg_between_2fg().

Here is the call graph for this function: