BRL-CAD
#include "common.h"
#include <stddef.h>
#include <string.h>
#include <math.h>
#include "bio.h"
#include "bu/sort.h"
#include "vmath.h"
#include "nmg.h"
#include "raytrace.h"
#include "nurb.h"
Include dependency graph for nmg_fuse.c:

Go to the source code of this file.

Data Structures

struct  pt_list
 

Macros

#define CHECK_NUMBER   20
 
#define TOL_MULTIPLES   1.0
 

Functions

void nmg_split_trim (const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, fastf_t t, struct pt_list *pt0, struct pt_list *pt1, const struct bn_tol *tol)
 
int nmg_is_common_bigloop (const struct face *f1, const struct face *f2)
 
void nmg_region_v_unique (struct nmgregion *r1, const struct bn_tol *tol)
 
int nmg_ptbl_vfuse (struct bu_ptbl *t, const struct bn_tol *tol)
 
int nmg_region_both_vfuse (struct bu_ptbl *t1, struct bu_ptbl *t2, const struct bn_tol *tol)
 
int nmg_vertex_fuse (const uint32_t *magic_p, const struct bn_tol *tol)
 
int nmg_cnurb_is_linear (const struct edge_g_cnurb *cnrb)
 
int nmg_snurb_is_planar (const struct face_g_snurb *srf, const struct bn_tol *tol)
 
void nmg_eval_linear_trim_curve (const struct face_g_snurb *snrb, const fastf_t *uvw, fastf_t *xyz)
 
void nmg_eval_trim_curve (const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, const fastf_t t, fastf_t *xyz)
 
void nmg_eval_trim_to_tol (const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, const fastf_t t0, const fastf_t t1, struct bu_list *head, const struct bn_tol *tol)
 
void nmg_split_linear_trim (const struct face_g_snurb *snrb, const fastf_t *uvw1, const fastf_t *uvw2, struct pt_list *pt0, struct pt_list *pt1, const struct bn_tol *tol)
 
void nmg_eval_linear_trim_to_tol (const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, const fastf_t *uvw1, const fastf_t *uvw2, struct bu_list *head, const struct bn_tol *tol)
 
int nmg_cnurb_lseg_coincident (const struct edgeuse *eu1, const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, const fastf_t *pt1, const fastf_t *pt2, const struct bn_tol *tol)
 
int nmg_cnurb_is_on_crv (const struct edgeuse *eu, const struct edge_g_cnurb *cnrb, const struct face_g_snurb *snrb, const struct bu_list *head, const struct bn_tol *tol)
 
int nmg_edge_fuse (const uint32_t *magic_p, const struct bn_tol *tol)
 
int nmg_edge_g_fuse (const uint32_t *magic_p, const struct bn_tol *tol)
 
int nmg_ck_fu_verts (struct faceuse *fu1, struct face *f2, const struct bn_tol *tol)
 
int nmg_ck_fg_verts (struct faceuse *fu1, struct face *f2, const struct bn_tol *tol)
 
int nmg_two_face_fuse (struct face *f1, struct face *f2, const struct bn_tol *tol)
 
int nmg_model_face_fuse (struct model *m, const struct bn_tol *tol)
 
int nmg_break_all_es_on_v (uint32_t *magic_p, struct vertex *v, const struct bn_tol *tol)
 
int nmg_break_e_on_v (const uint32_t *magic_p, const struct bn_tol *tol)
 
int nmg_model_break_e_on_v (const uint32_t *magic_p, const struct bn_tol *tol)
 
int nmg_model_fuse (struct model *m, const struct bn_tol *tol)
 
void nmg_radial_sorted_list_insert (struct bu_list *hd, struct nmg_radial *rad)
 
void nmg_radial_verify_pointers (const struct bu_list *hd, const struct bn_tol *tol)
 
void nmg_radial_verify_monotone (const struct bu_list *hd, const struct bn_tol *tol)
 
void nmg_insure_radial_list_is_increasing (struct bu_list *hd, fastf_t amin, fastf_t amax)
 
void nmg_radial_build_list (struct bu_list *hd, struct bu_ptbl *shell_tbl, int existing, struct edgeuse *eu, const fastf_t *xvec, const fastf_t *yvec, const fastf_t *zvec, const struct bn_tol *tol)
 
void nmg_radial_merge_lists (struct bu_list *dest, struct bu_list *src, const struct bn_tol *tol)
 
int nmg_is_crack_outie (const struct edgeuse *eu, const struct bn_tol *tol)
 
struct nmg_radialnmg_find_radial_eu (const struct bu_list *hd, const struct edgeuse *eu)
 
const struct edgeuse * nmg_find_next_use_of_2e_in_lu (const struct edgeuse *eu, const struct edge *e1, const struct edge *e2)
 
void nmg_radial_mark_cracks (struct bu_list *hd, const struct edge *e1, const struct edge *e2, const struct bn_tol *tol)
 
struct nmg_radialnmg_radial_find_an_original (const struct bu_list *hd, const struct shell *s, const struct bn_tol *tol)
 
int nmg_radial_mark_flips (struct bu_list *hd, const struct shell *s, const struct bn_tol *tol)
 
int nmg_radial_check_parity (const struct bu_list *hd, const struct bu_ptbl *shells, const struct bn_tol *tol)
 
void nmg_radial_implement_decisions (struct bu_list *hd, const struct bn_tol *tol, struct edgeuse *eu1, fastf_t *xvec, fastf_t *yvec, fastf_t *zvec)
 
void nmg_pr_radial (const char *title, const struct nmg_radial *rad)
 
void nmg_pr_radial_list (const struct bu_list *hd, const struct bn_tol *tol)
 
void nmg_do_radial_flips (struct bu_list *hd)
 
void nmg_do_radial_join (struct bu_list *hd, struct edgeuse *eu1ref, fastf_t *xvec, fastf_t *yvec, fastf_t *zvec, const struct bn_tol *tol)
 
void nmg_radial_join_eu_NEW (struct edgeuse *eu1, struct edgeuse *eu2, const struct bn_tol *tol)
 
void nmg_radial_exchange_marked (struct bu_list *hd, const struct bn_tol *tol)
 
void nmg_s_radial_harmonize (struct shell *s, const struct bn_tol *tol)
 
void nmg_s_radial_check (struct shell *s, const struct bn_tol *tol)
 
void nmg_r_radial_check (const struct nmgregion *r, const struct bn_tol *tol)
 

Variables

int debug_file_count
 

Detailed Description

Routines to "fuse" entities together that are geometrically identical (within tolerance) into entities that share underlying geometry structures, so that the relationship is explicit.

Definition in file nmg_fuse.c.

Macro Definition Documentation

#define CHECK_NUMBER   20

Definition at line 773 of file nmg_fuse.c.

Referenced by nmg_cnurb_is_on_crv(), and nmg_cnurb_lseg_coincident().

#define TOL_MULTIPLES   1.0

Definition at line 1402 of file nmg_fuse.c.

Referenced by nmg_ck_fu_verts().

Function Documentation

void nmg_split_trim ( const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
fastf_t  t,
struct pt_list pt0,
struct pt_list pt1,
const struct bn_tol tol 
)

Definition at line 632 of file nmg_fuse.c.

References BN_CK_TOL, BU_ALLOC, bu_bomb(), BU_LIST_INSERT, bu_log(), bn_tol::dist_sq, pt_list::l, nmg_eval_trim_curve(), pt_list::t, and pt_list::xyz.

Referenced by nmg_eval_trim_to_tol().

Here is the call graph for this function:

int nmg_is_common_bigloop ( const struct face *  f1,
const struct face *  f2 
)

Do two faces share by topology at least one loop of 3 or more vertices?

Require that at least three distinct edge geometries be involved.

XXX Won't catch sharing of faces with only self-loops and no edge loops.

Definition at line 69 of file nmg_fuse.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, eu1, nmg_is_vertex_in_face(), and NMG_VERTEXUSE_MAGIC.

Here is the call graph for this function:

void nmg_region_v_unique ( struct nmgregion *  r1,
const struct bn_tol tol 
)

Ensure that all the vertices in r1 are still geometrically unique. This will be true after nmg_region_both_vfuse() has been called, and should remain true throughout the intersection process.

Definition at line 127 of file nmg_fuse.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), bu_bomb(), bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl::l, bu_list::magic, nmg_pr_v(), and nmg_vertex_tabulate().

Referenced by nmg_do_bool(), nmg_isect_two_generic_faces(), and nmg_mesh_shell_shell().

Here is the call graph for this function:

int nmg_ptbl_vfuse ( struct bu_ptbl t,
const struct bn_tol tol 
)

Working from the end to the front, scan for geometric duplications within a single list of vertex structures.

Exists primarily as a support routine for nmg_vertex_fuse().

Definition at line 186 of file nmg_fuse.c.

References BU_PTBL_BASEADDR, BU_PTBL_END, BU_PTBL_GET, BU_PTBL_LEN, BU_PTBL_SET, bu_sort(), bn_tol::dist_sq, nmg_jv(), X, Y, and Z.

Referenced by nmg_vertex_fuse().

Here is the call graph for this function:

int nmg_region_both_vfuse ( struct bu_ptbl t1,
struct bu_ptbl t2,
const struct bn_tol tol 
)

For every element in t1, scan t2 for geometric duplications.

Deleted elements in t2 are marked by a null vertex pointer, rather than bothering to do a BU_PTBL_RM, which will re-copy the list to compress it.

Exists as a support routine for nmg_two_region_vertex_fuse()

Definition at line 261 of file nmg_fuse.c.

References bn_pt3_pt3_equal(), BU_PTBL_END, BU_PTBL_GET, and nmg_jv().

Here is the call graph for this function:

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

Fuse together any vertices that are geometrically identical, within distance tolerance. This function may be passed a pointer to an NMG object or a pointer to a bu_ptbl structure containing a list of pointers to NMG vertex structures. If a bu_ptbl structure was passed into this function, the calling function must free this structure.

Definition at line 306 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), bu_log(), bu_ptbl_free(), BU_PTBL_GET, BU_PTBL_LEN, BU_PTBL_MAGIC, magic_p, rt_g::NMG_debug, nmg_ptbl_vfuse(), NMG_VERTEX_MAGIC, nmg_vertex_tabulate(), and RTG.

Referenced by ged_bot_fuse(), nmg_edge_fuse(), and nmg_model_fuse().

Here is the call graph for this function:

int nmg_cnurb_is_linear ( const struct edge_g_cnurb *  cnrb)

Checks if cnurb is linear

Returns: 1 - cnurb is linear 0 - either cnurb is not linear, or it's not obvious

Definition at line 363 of file nmg_fuse.c.

References bu_log(), OSL::Strings::linear, rt_g::NMG_debug, out, rt_nurb_c_print(), and RTG.

Here is the call graph for this function:

int nmg_snurb_is_planar ( const struct face_g_snurb *  srf,
const struct bn_tol tol 
)

Checks if snurb surface is planar

Returns: 0 - surface is not planar 1 - surface is planar (within tolerance)

Definition at line 421 of file nmg_fuse.c.

References BN_CK_TOL, bn_mat_determinant(), bn_mat_inv(), bu_bomb(), bu_log(), bn_tol::dist, rt_g::NMG_debug, out, rt_nurb_s_print(), RTG, VSET, X, Y, Z, and ZERO.

Here is the call graph for this function:

void nmg_eval_linear_trim_curve ( const struct face_g_snurb *  snrb,
const fastf_t uvw,
fastf_t xyz 
)

Definition at line 564 of file nmg_fuse.c.

References rt_nurb_s_eval().

Referenced by nmg_cnurb_is_on_crv(), nmg_cnurb_lseg_coincident(), nmg_eval_linear_trim_to_tol(), and nmg_split_linear_trim().

Here is the call graph for this function:

void nmg_eval_trim_curve ( const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
const fastf_t  t,
fastf_t xyz 
)

Definition at line 590 of file nmg_fuse.c.

References rt_nurb_c_eval(), and rt_nurb_s_eval().

Referenced by nmg_cnurb_is_on_crv(), nmg_cnurb_lseg_coincident(), nmg_eval_trim_to_tol(), and nmg_split_trim().

Here is the call graph for this function:

void nmg_eval_trim_to_tol ( const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
const fastf_t  t0,
const fastf_t  t1,
struct bu_list head,
const struct bn_tol tol 
)

Definition at line 670 of file nmg_fuse.c.

References BN_CK_TOL, BU_ALLOC, BU_LIST_INSERT, bu_log(), pt_list::l, rt_g::NMG_debug, nmg_eval_trim_curve(), nmg_split_trim(), RTG, pt_list::t, and pt_list::xyz.

Here is the call graph for this function:

void nmg_split_linear_trim ( const struct face_g_snurb *  snrb,
const fastf_t uvw1,
const fastf_t uvw2,
struct pt_list pt0,
struct pt_list pt1,
const struct bn_tol tol 
)

Definition at line 703 of file nmg_fuse.c.

References BN_CK_TOL, BU_ALLOC, BU_LIST_INSERT, bn_tol::dist_sq, pt_list::l, nmg_eval_linear_trim_curve(), pt_list::t, and pt_list::xyz.

Referenced by nmg_eval_linear_trim_to_tol().

Here is the call graph for this function:

void nmg_eval_linear_trim_to_tol ( const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
const fastf_t uvw1,
const fastf_t uvw2,
struct bu_list head,
const struct bn_tol tol 
)

Definition at line 738 of file nmg_fuse.c.

References BN_CK_TOL, BU_ALLOC, BU_LIST_INSERT, bu_log(), pt_list::l, rt_g::NMG_debug, nmg_eval_linear_trim_curve(), nmg_split_linear_trim(), RTG, pt_list::t, V3ARGS, and pt_list::xyz.

Here is the call graph for this function:

int nmg_cnurb_lseg_coincident ( const struct edgeuse *  eu1,
const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
const fastf_t pt1,
const fastf_t pt2,
const struct bn_tol tol 
)

Checks if CNURB is coincident with line segment from pt1 to pt2 by calculating a number of points along the CNURB and checking if they lie on the line between pt1 and pt2 (within tolerance). NOTE: eu1 must be the EU referencing cnrb!!!!

Returns: 0 - not coincident 1 - coincident

Definition at line 786 of file nmg_fuse.c.

References BN_CK_TOL, bn_dist_pt3_lseg3(), bu_bomb(), bu_log(), CHECK_NUMBER, rt_g::NMG_debug, nmg_eval_linear_trim_curve(), nmg_eval_trim_curve(), NMG_VERTEXUSE_A_CNURB_MAGIC, RTG, pt_list::t, V3ARGS, and OSL::Strings::xyz.

Here is the call graph for this function:

int nmg_cnurb_is_on_crv ( const struct edgeuse *  eu,
const struct edge_g_cnurb *  cnrb,
const struct face_g_snurb *  snrb,
const struct bu_list head,
const struct bn_tol tol 
)

Checks if CNURB eu lies on curve contained in list headed at "head" "Head" must contain a list of points (struct pt_list) each within tolerance of the next. (Just checks at "CHECK_NUMBER" points for now).

Returns: 0 - cnurb is not on curve; 1 - cnurb is on curve

Definition at line 914 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), CHECK_NUMBER, bn_tol::dist_sq, rt_g::NMG_debug, nmg_eval_linear_trim_curve(), nmg_eval_trim_curve(), NMG_VERTEXUSE_A_CNURB_MAGIC, RTG, pt_list::xyz, and OSL::Strings::xyz.

Here is the call graph for this function:

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

Note: If a bu_ptbl structure is passed into this function, the structure must contain edgeuse. Vertices will then be fused at the shell level. If an NMG structure is passed into this function, if the structure is an NMG region or model, vertices will be fused at the model level. If the NMG structure passed in is a shell or anything lower, vertices will be fused at the shell level.

Definition at line 1062 of file nmg_fuse.c.

References bu_bomb(), bu_calloc(), bu_free(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), BU_PTBL_MAGIC, bu_sort(), eu1, eu2, magic_p, NMG_EDGEUSE_MAGIC, nmg_edgeuse_tabulate(), nmg_find_shell(), NMG_MODEL_MAGIC, nmg_radial_join_eu(), NMG_REGION_MAGIC, nmg_vertex_fuse(), and s.

Referenced by ged_bot_fuse(), nmg_gluefaces(), nmg_model_fuse(), and rt_pipe_tess().

Here is the call graph for this function:

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

Fuse edge_g structs.

Definition at line 1199 of file nmg_fuse.c.

References bu_calloc(), bu_free(), BU_LIST_FIRST, BU_LIST_MAIN_PTR, bu_log(), bu_ptbl_free(), BU_PTBL_GET, BU_PTBL_LEN, BU_PTBL_SET, bu_sort(), bn_tol::dist, eu1, eu2, MAX_FASTF, nmg_2edgeuse_g_coincident(), rt_g::NMG_debug, NMG_EDGE_G_CNURB_MAGIC, nmg_edge_g_tabulate(), nmg_jeg(), RTG, UNLIKELY, X, Y, and Z.

Referenced by nmg_model_fuse(), and nmg_triangulate_shell().

Here is the call graph for this function:

int nmg_ck_fu_verts ( struct faceuse *  fu1,
struct face *  f2,
const struct bn_tol tol 
)

Check that all the vertices in fu1 are within tol->dist of fu2's surface. fu1 and fu2 may be the same face, or different.

This is intended to be a geometric check only, not a topology check. Topology may have become inappropriately shared.

Returns - 0 All is well, or all verts are within TOL_MULTIPLES*tol->dist of fu2 count Number of verts not on fu2's surface when at least one is more than TOL_MULTIPLES*tol->dist from fu2.

Definition at line 1416 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), bn_tol::dist, lu, NEAR_ZERO, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_VERTEXUSE_MAGIC, RTG, TOL_MULTIPLES, OSL::Strings::v, and VPRINT.

Referenced by nmg_ck_fg_verts(), nmg_fu_planeeqn(), nmg_isect_2faceuse(), nmg_make_faces_within_tol(), and nmg_shell_coplanar_face_merge().

Here is the call graph for this function:

int nmg_ck_fg_verts ( struct faceuse *  fu1,
struct face *  f2,
const struct bn_tol tol 
)

Similar to nmg_ck_fu_verts, but checks all vertices that use the same face geometry as fu1 fu1 and f2 may be the same face, or different.

This is intended to be a geometric check only, not a topology check. Topology may have become inappropriately shared.

Returns - 0 All is well. count Number of verts not on fu2's surface.

Definition at line 1526 of file nmg_fuse.c.

References BN_CK_TOL, BU_LIST_FOR, and nmg_ck_fu_verts().

Referenced by nmg_ck_geometry(), and nmg_two_face_fuse().

Here is the call graph for this function:

int nmg_two_face_fuse ( struct face *  f1,
struct face *  f2,
const struct bn_tol tol 
)

XXX A better algorithm would be to compare loop by loop. If the two faces share all the verts of at least one loop of 3 or more vertices, then they should be shared. Otherwise it will be awkward having shared loop(s) on non-shared faces!!

Compare the geometry of two faces, and fuse them if they are the same within tolerance. First compare the plane equations. If they are "similar" (within tol), then check all verts in f2 to make sure that they are within tol->dist of f1's geometry. If they are, then fuse the face geometry.

Returns - 0 Faces were not fused. >0 Faces were successfully fused.

Definition at line 1571 of file nmg_fuse.c.

References BU_LIST_FOR, bu_log(), bn_tol::dist, NEAR_ZERO, nmg_ck_fg_verts(), rt_g::NMG_debug, nmg_jfg(), RTG, and SMALL_FASTF.

Referenced by nmg_model_face_fuse(), and nmg_radial_join_eu().

Here is the call graph for this function:

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

A routine to find all face geometry structures in an nmg model that have the same plane equation, and have them share face geometry. (See also nmg_shell_coplanar_face_merge(), which actually moves the loops into one face).

The criteria for two face geometry structs being the "same" are: 1) The plane equations must be the same, within tolerance. 2) All the vertices on the 2nd face must lie within the distance tolerance of the 1st face's plane equation.

Definition at line 1677 of file nmg_fuse.c.

References bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, f1, f2, rt_g::NMG_debug, NMG_FACE_G_SNURB_MAGIC, nmg_face_tabulate(), nmg_two_face_fuse(), and RTG.

Referenced by ged_bot_fuse(), and nmg_model_fuse().

Here is the call graph for this function:

int nmg_break_all_es_on_v ( uint32_t *  magic_p,
struct vertex *  v,
const struct bn_tol tol 
)

Definition at line 1720 of file nmg_fuse.c.

References bn_isect_pt_lseg(), bn_pt3_pt3_equal(), bu_bomb(), bu_identify_magic(), bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, BU_STR_EQUAL, code(), rt_g::NMG_debug, NMG_EDGE_G_CNURB_MAGIC, nmg_edgeuse_tabulate(), RTG, and UNLIKELY.

Referenced by nmg_isect_eu_fu().

Here is the call graph for this function:

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

As the first step in evaluating a boolean formula, before starting to do face/face intersections, compare every edge in the model with every vertex in the model. If the vertex is within tolerance of the edge, break the edge, and enroll the new edge on a list of edges still to be processed.

A list of edges and a list of vertices are built, and then processed.

Space partitioning could improve the performance of this algorithm. For the moment, a brute-force approach is used.

Returns - Number of edges broken.

Definition at line 1802 of file nmg_fuse.c.

References BN_CK_TOL, bn_isect_pt_lseg(), bu_log(), BU_PTBL_BASEADDR, bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_ins(), BU_PTBL_LASTADDR, BU_PTBL_LEN, code(), bn_tol::dist, bu_ptbl::l, bu_list::magic, rt_g::NMG_debug, nmg_e_and_v_tabulate(), NMG_EDGE_G_CNURB_MAGIC, RTG, and OSL::Strings::v.

Referenced by ged_bot_fuse(), nmg_model_break_e_on_v(), and nmg_model_fuse().

Here is the call graph for this function:

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

Definition at line 1895 of file nmg_fuse.c.

References nmg_break_e_on_v().

Here is the call graph for this function:

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

This is the primary application interface to the geometry fusing support. Fuse together all data structures that are equal to each other, within tolerance.

The algorithm is three part: 1) Fuse together all vertices. 2) Fuse together all face geometry, where appropriate. 3) Fuse together all edges.

Edge fusing is handled last, because the difficult part there is sorting faces radially around the edge. It is important to know whether faces are shared or not at that point.

XXX It would be more efficient to build all the ptbl's at once, XXX with a single traversal of the model.

Definition at line 1919 of file nmg_fuse.c.

References BN_CK_TOL, BU_LIST_FOR, bu_log(), nmg_break_e_on_v(), rt_g::NMG_debug, nmg_edge_fuse(), nmg_edge_g_fuse(), nmg_make_faces_within_tol(), nmg_model_face_fuse(), nmg_vertex_fuse(), RTG, and s.

Referenced by fix_halfs(), nmg_find_edge_between_2fu(), nmg_find_eg_between_2fg(), rt_metaball_tess(), and rt_vol_tess().

Here is the call graph for this function:

void nmg_radial_sorted_list_insert ( struct bu_list hd,
struct nmg_radial rad 
)

Build sorted list, with 'ang' running from zero to 2*pi. New edgeuses with same angle as an edgeuse already on the list are added AFTER the last existing one, for lack of any better way to break the tie.

Definition at line 1988 of file nmg_fuse.c.

References nmg_radial::ang, BU_CK_LIST_HEAD, BU_LIST_APPEND, BU_LIST_FOR_BACKWARDS, BU_LIST_INSERT, BU_LIST_IS_EMPTY, BU_LIST_PREV, nmg_radial::fu, nmg_radial::l, and NMG_CK_RADIAL.

Referenced by nmg_radial_build_list(), and nmg_radial_merge_lists().

void nmg_radial_verify_pointers ( const struct bu_list hd,
const struct bn_tol tol 
)

Not only verity that list is monotone increasing, but that pointer integrity still exists.

Definition at line 2038 of file nmg_fuse.c.

References nmg_radial::ang, BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), nmg_radial::eu, nmg_radial::fu, and nmg_pr_radial_list().

Here is the call graph for this function:

void nmg_radial_verify_monotone ( const struct bu_list hd,
const struct bn_tol tol 
)

Verify that the angles are monotone increasing. Wire edgeuses are ignored.

Definition at line 2080 of file nmg_fuse.c.

References nmg_radial::ang, BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), nmg_radial::fu, and nmg_pr_radial_list().

Referenced by nmg_radial_join_eu_NEW().

Here is the call graph for this function:

void nmg_insure_radial_list_is_increasing ( struct bu_list hd,
fastf_t  amin,
fastf_t  amax 
)

Check if the passed bu_list is in increasing order. If not, reverse the order of the list. XXX Isn't the word "ensure"?

Definition at line 2108 of file nmg_fuse.c.

References nmg_radial::ang, BU_CK_LIST_HEAD, BU_LIST_FOR, bu_list_len(), bu_list_reverse(), nmg_radial::eu, nmg_radial::fu, MAX_FASTF, nmg_find_fu_of_eu(), and ZERO.

Here is the call graph for this function:

void nmg_radial_build_list ( struct bu_list hd,
struct bu_ptbl shell_tbl,
int  existing,
struct edgeuse *  eu,
const fastf_t xvec,
const fastf_t yvec,
const fastf_t zvec,
const struct bn_tol tol 
)

The coordinate system is expected to have been chosen in such a way that the radial list of faces around this edge are circularly increasing (CCW) in their angle. Put them in the list in exactly the order they occur around the edge. Then, at the end, move the list head to lie between the maximum and minimum angles, so that the list head is crossed as the angle goes around through zero. Now the list is monotone increasing.

The edgeuse's radial pointer takes us in the CCW direction.

If the list contains nmg_radial structures r1, r2, r3, r4, then going CCW around the edge we will encounter:

            (from i-1)                      (from i+1)

r1->eu->eumate_p r4->eu->radial_p r2->eu->eumate_p->radial_p->eumate_p r1->eu r4->eu->radial_p->eumate_p r2->eu->eumate_p->radial_p r2->eu->eumate_p r1->eu->radial_p r3->eu->eumate_p->radial_p->eumate_p r2->eu r1->eu->radial_p->eumate_p r3->eu->eumate_p->radial_p r3->eu->eumate_p r2->eu->radial_p r4->eu->eumate_p->radial_p->eumate_p r3->eu r2->eu->radial_p->eumate_p r4->eu->eumate_p->radial_p r4->eu->eumate_p r3->eu->radial_p r1->eu->eumate_p->radial_p->eumate_p r4->eu r3->eu->radial_p->eumate_p r1->eu->eumate_p->radial_p

Definition at line 2183 of file nmg_fuse.c.

References nmg_radial::ang, BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_CK_PTBL, BU_GET, BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), bu_ptbl_ins_unique(), nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::is_crack, nmg_radial::is_outie, nmg_radial::l, M_PI, bu_list::magic, nmg_radial::needs_flip, rt_g::NMG_debug, nmg_find_fu_of_eu(), nmg_find_s_of_eu(), nmg_measure_fu_angle(), nmg_pr_fu_around_eu_vecs(), nmg_pr_radial_list(), NMG_RADIAL_MAGIC, nmg_radial_sorted_list_insert(), RTG, nmg_radial::s, SMALL_FASTF, V3ARGS, and ZERO.

Referenced by nmg_radial_join_eu_NEW(), and nmg_s_radial_harmonize().

Here is the call graph for this function:

void nmg_radial_merge_lists ( struct bu_list dest,
struct bu_list src,
const struct bn_tol tol 
)

Merge all of the src list into the dest list, sorting by angles.

Definition at line 2349 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_LIST_DEQUEUE, BU_LIST_WHILE, nmg_radial::l, and nmg_radial_sorted_list_insert().

Referenced by nmg_radial_join_eu_NEW().

Here is the call graph for this function:

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

If there is more than one edgeuse of a loopuse along an edge, then it is a "topological crack". There are two kinds, an "innie", where the crack is a null-area incursion into the interior of the loop, and an "outie", where the crack is a null-area protrusion outside of the interior of the loop.

             "Outie"                 "Innie"
            *-------*               *-------*
            |       ^               |       ^
            v       |               v       |
    *<------*       |               *--->*  |
    *---M-->*       |               *<-M-*  |
            |       |               |       |
            v       |               v       |
            *------>*               *------>*

The algorithm used is to compute the geometric midpoint of the crack edge, "delete" that edge from the loop, and then classify the midpoint ("M") against the remainder of the loop. If the edge midpoint is inside the remains of the loop, then the crack is an "innie", otherwise it is an "outie".

When there are an odd number of edgeuses along the crack, then the situation is "nasty":

             "Nasty"
            *-------*
            |       ^
            v       |
    *<------*       |
    *------>*       |
    *<------*       |
    *------>*       |
    *<------*       |
    |               |
    |               |
    v               |
    *------------->*

The caller is responsible for making sure that the edgeuse is not a wire edgeuse (i.e. that the edgeuse is part of a loop).

In the "Nasty" case, all the edgeuse pairs are "outies" except for the last lone edgeuse, which should be handled as a "non-crack". Walk the loopuse's edgeuses list in edgeuse order to see which one is the last (non-crack) repeated edgeuse. For efficiency, detecting and dealing with this condition is left up to the caller, and is not checked for here.

Definition at line 2415 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), bu_log(), bn_tol::dist, bn_tol::dist_sq, lu, NMG_CK_LOOPUSE(), nmg_class_name(), nmg_class_pt_lu_except(), rt_g::NMG_debug, NMG_FACEUSE_MAGIC, nmg_loop_is_a_crack(), nmg_orientation(), nmg_pr_lu_briefly(), RTG, SMALL_FASTF, and V3ARGS.

Referenced by nmg_radial_mark_cracks().

Here is the call graph for this function:

struct nmg_radial* nmg_find_radial_eu ( const struct bu_list hd,
const struct edgeuse *  eu 
)

Definition at line 2499 of file nmg_fuse.c.

References bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), and nmg_radial::eu.

Referenced by nmg_radial_mark_cracks().

Here is the call graph for this function:

const struct edgeuse* nmg_find_next_use_of_2e_in_lu ( const struct edgeuse *  eu,
const struct edge *  e1,
const struct edge *  e2 
)

Find the next use of either of two edges in the loopuse. The second edge pointer may be NULL.

Definition at line 2522 of file nmg_fuse.c.

References BU_LIST_PNEXT_CIRC, and NMG_CK_LOOPUSE().

Referenced by nmg_radial_mark_cracks().

Here is the call graph for this function:

void nmg_radial_mark_cracks ( struct bu_list hd,
const struct edge *  e1,
const struct edge *  e2,
const struct bn_tol tol 
)

For every edgeuse, if there are other edgeuses around this edge from the same face, then mark them all as part of a "crack".

To be a crack the two edgeuses must be from the same loopuse.

If the count of repeated ("crack") edgeuses is even, then classify the entire crack as an "innie" or an "outie". If the count is odd, this is a "Nasty" – all but one edgeuse are marked as "outies", and the remaining one is marked as a non-crack. The "outie" edgeuses are marked off in pairs, in the loopuse's edgeuse order.

Definition at line 2558 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, bu_log(), nmg_radial::eu, nmg_radial::fu, nmg_radial::is_crack, nmg_radial::is_outie, lu, NMG_CK_RADIAL, rt_g::NMG_debug, nmg_find_next_use_of_2e_in_lu(), nmg_find_radial_eu(), nmg_is_crack_outie(), nmg_pr_lu_briefly(), nmg_pr_radial_list(), other, and RTG.

Here is the call graph for this function:

struct nmg_radial* nmg_radial_find_an_original ( const struct bu_list hd,
const struct shell *  s,
const struct bn_tol tol 
)

Returns - NULL No edgeuses from indicated shell on this list nmg_radial* An original, else first newbie, else a newbie crack.

Definition at line 2679 of file nmg_fuse.c.

References bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::is_outie, NMG_CK_RADIAL, NMG_CK_SHELL(), nmg_pr_radial_list(), and nmg_radial::s.

Referenced by nmg_radial_check_parity(), and nmg_radial_mark_flips().

Here is the call graph for this function:

int nmg_radial_mark_flips ( struct bu_list hd,
const struct shell *  s,
const struct bn_tol tol 
)

For a given shell, find an original edgeuse from that shell, and then mark parity violators with a "flip" flag.

Definition at line 2747 of file nmg_fuse.c.

References BN_CK_TOL, bu_bomb(), BU_CK_LIST_HEAD, BU_LIST_FOR_CIRC, bu_log(), nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::is_outie, nmg_radial::needs_flip, NMG_CK_RADIAL, NMG_CK_SHELL(), rt_g::NMG_debug, nmg_pr_radial_list(), nmg_radial_find_an_original(), RTG, and nmg_radial::s.

Referenced by nmg_s_radial_harmonize().

Here is the call graph for this function:

int nmg_radial_check_parity ( const struct bu_list hd,
const struct bu_ptbl shells,
const struct bn_tol tol 
)

For each shell, check orientation parity of edgeuses within that shell.

Definition at line 2820 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_CK_PTBL, BU_LIST_FOR_CIRC, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_LASTADDR, nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::is_outie, NMG_CK_RADIAL, NMG_CK_SHELL(), nmg_radial_find_an_original(), and nmg_radial::s.

Here is the call graph for this function:

void nmg_radial_implement_decisions ( struct bu_list hd,
const struct bn_tol tol,
struct edgeuse *  eu1,
fastf_t xvec,
fastf_t yvec,
fastf_t zvec 
)

For all non-original edgeuses in the list, place them in the proper place around the destination edge.

Definition at line 2877 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_LIST_FOR, BU_LIST_PPREV_CIRC, bu_log(), nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::needs_flip, rt_g::NMG_debug, nmg_find_fu_of_eu(), nmg_je(), nmg_pr_fu_around_eu_vecs(), nmg_pr_radial(), and RTG.

Here is the call graph for this function:

void nmg_pr_radial ( const char *  title,
const struct nmg_radial rad 
)

Definition at line 2945 of file nmg_fuse.c.

References nmg_radial::ang, bu_log(), nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, nmg_radial::is_crack, nmg_radial::is_outie, nmg_radial::needs_flip, NMG_CK_RADIAL, nmg_orientation(), and nmg_radial::s.

Referenced by nmg_do_radial_join(), nmg_pr_radial_list(), and nmg_radial_implement_decisions().

Here is the call graph for this function:

void nmg_pr_radial_list ( const struct bu_list hd,
const struct bn_tol tol 
)

Patterned after nmg_pr_fu_around_eu_vecs(), with similar format.

Definition at line 2980 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_LIST_FOR, bu_log(), NMG_CK_RADIAL, and nmg_pr_radial().

Referenced by nmg_do_radial_join(), nmg_radial_build_list(), nmg_radial_find_an_original(), nmg_radial_join_eu_NEW(), nmg_radial_mark_cracks(), nmg_radial_mark_flips(), nmg_radial_verify_monotone(), nmg_radial_verify_pointers(), and nmg_s_radial_harmonize().

Here is the call graph for this function:

void nmg_do_radial_flips ( struct bu_list hd)

This routine looks for nmg_radial structures with the same angle, and sorts them to match the order of nmg_radial structures that are not at that same angle

Definition at line 3004 of file nmg_fuse.c.

References nmg_radial::ang, BN_TOL_MAGIC, BU_CK_LIST_HEAD, BU_LIST_APPEND, BU_LIST_DEQUEUE, BU_LIST_FIRST, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bn_tol::dist, bn_tol::dist_sq, nmg_radial::fu, nmg_radial::l, bn_tol::magic, bn_tol::para, bn_tol::perp, nmg_radial::s, and ZERO.

Referenced by nmg_do_radial_join().

void nmg_do_radial_join ( struct bu_list hd,
struct edgeuse *  eu1ref,
fastf_t xvec,
fastf_t yvec,
fastf_t zvec,
const struct bn_tol tol 
)

Perform radial join of edges in list "hd" based on direction with respect to "eu1ref"

Definition at line 3095 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_LIST_FOR, BU_LIST_PPREV_CIRC, bu_log(), nmg_radial::eu, nmg_radial::existing_flag, nmg_radial::fu, rt_g::NMG_debug, nmg_do_radial_flips(), nmg_je(), nmg_pr_fu_around_eu_vecs(), nmg_pr_radial(), nmg_pr_radial_list(), RTG, SMALL_FASTF, top(), and V3ARGS.

Referenced by nmg_radial_join_eu_NEW().

Here is the call graph for this function:

void nmg_radial_join_eu_NEW ( struct edgeuse *  eu1,
struct edgeuse *  eu2,
const struct bn_tol tol 
)

A new routine, that uses "global information" about the edge to plan the operations to be performed.

Definition at line 3197 of file nmg_fuse.c.

References BN_CK_TOL, bn_pt3_pt3_equal(), bu_bomb(), BU_LIST_DEQUEUE, BU_LIST_INIT, BU_LIST_WHILE, bu_log(), bu_ptbl_free(), bu_ptbl_init(), BU_PUT, eu1, eu2, nmg_radial::l, rt_g::NMG_debug, nmg_do_radial_join(), nmg_edge_g(), nmg_eu_2vecs_perp(), nmg_euprint(), NMG_FACE_G_SNURB_MAGIC, nmg_find_fu_of_eu(), nmg_find_ot_same_eu_of_e(), nmg_find_s_of_eu(), nmg_je(), nmg_jeg(), nmg_pr_fu_around_eu_vecs(), nmg_pr_ptbl(), nmg_pr_radial_list(), nmg_radial_build_list(), nmg_radial_merge_lists(), nmg_radial_verify_monotone(), nmg_use_edge_g(), RTG, and V3ARGS.

Referenced by nmg_edge_collapse(), and nmg_radial_join_eu().

Here is the call graph for this function:

void nmg_radial_exchange_marked ( struct bu_list hd,
const struct bn_tol tol 
)

Exchange eu and eu->eumate_p on the radial list, where marked.

Definition at line 3326 of file nmg_fuse.c.

References BN_CK_TOL, BU_CK_LIST_HEAD, BU_LIST_FOR, nmg_radial::eu, nmg_radial::fu, nmg_radial::needs_flip, and nmg_find_fu_of_eu().

Referenced by nmg_s_radial_harmonize().

Here is the call graph for this function:

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

Visit each edge in this shell exactly once. Where the radial edgeuse parity has become disrupted due to a boolean operation or whatever, fix it.

Definition at line 3375 of file nmg_fuse.c.

References BN_CK_TOL, BU_LIST_DEQUEUE, BU_LIST_INIT, BU_LIST_WHILE, bu_log(), BU_PTBL_BASEADDR, bu_ptbl_free(), BU_PTBL_LASTADDR, BU_PUT, bu_ptbl::l, nmg_radial::l, bu_list::magic, NMG_CK_SHELL(), rt_g::NMG_debug, nmg_edge_tabulate(), nmg_eu_2vecs_perp(), nmg_find_ot_same_eu_of_e(), nmg_pr_fu_around_eu_vecs(), nmg_pr_radial_list(), nmg_radial_build_list(), nmg_radial_exchange_marked(), nmg_radial_mark_flips(), and RTG.

Referenced by nmg_js().

Here is the call graph for this function:

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

Visit each edge in this shell exactly once, and check it.

Definition at line 3433 of file nmg_fuse.c.

References BN_CK_TOL, bu_log(), BU_PTBL_BASEADDR, bu_ptbl_free(), BU_PTBL_LASTADDR, bu_ptbl::l, bu_list::magic, NMG_CK_SHELL(), rt_g::NMG_debug, nmg_edge_tabulate(), and RTG.

Referenced by nmg_r_radial_check().

Here is the call graph for this function:

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

Definition at line 3457 of file nmg_fuse.c.

References BN_CK_TOL, BU_LIST_FOR, bu_log(), NMG_CK_SHELL(), rt_g::NMG_debug, nmg_s_radial_check(), RTG, and s.

Referenced by nmg_booltree_evaluate().

Here is the call graph for this function: