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

Go to the source code of this file.

Data Structures

struct  ee_2d_state
 

Macros

#define ISECT_NONE   0
 
#define ISECT_SHARED_V   1
 
#define ISECT_SPLIT1   2
 
#define ISECT_SPLIT2   4
 
#define VDIST(a, b)   sqrt((a[X]-b[X])*(a[X]-b[X]) + (a[Y]-b[Y])*(a[Y]-b[Y]) + (a[Z]-b[Z])*(a[Z]-b[Z]))
 
#define VDIST_SQ(a, b)   ((a[X]-b[X])*(a[X]-b[X]) + (a[Y]-b[Y])*(a[Y]-b[Y]) + (a[Z]-b[Z])*(a[Z]-b[Z]))
 
#define MAX_FACES   200
 

Functions

struct vertexuse * nmg_make_dualvu (struct vertex *v, struct faceuse *fu, const struct bn_tol *tol)
 
struct vertexuse * nmg_enlist_vu (struct nmg_inter_struct *is, const struct vertexuse *vu, struct vertexuse *dualvu, fastf_t dist)
 
void nmg_isect2d_prep (struct nmg_inter_struct *is, const uint32_t *assoc_use)
 
void nmg_isect2d_cleanup (struct nmg_inter_struct *is)
 
void nmg_isect2d_final_cleanup (void)
 
void nmg_isect_vert2p_face2p (struct nmg_inter_struct *is, struct vertexuse *vu1, struct faceuse *fu2)
 
struct edgeuse * nmg_break_eu_on_v (struct edgeuse *eu1, struct vertex *v2, struct faceuse *fu, struct nmg_inter_struct *is)
 
void nmg_break_eg_on_v (const struct edge_g_lseg *eg, struct vertex *v, const struct bn_tol *tol)
 
int nmg_isect_2colinear_edge2p (struct edgeuse *eu1, struct edgeuse *eu2, struct faceuse *fu, struct nmg_inter_struct *is, struct bu_ptbl *l1, struct bu_ptbl *l2)
 
int nmg_isect_edge2p_edge2p (struct nmg_inter_struct *is, struct edgeuse *eu1, struct edgeuse *eu2, struct faceuse *fu1, struct faceuse *fu2)
 
int nmg_isect_construct_nice_ray (struct nmg_inter_struct *is, struct faceuse *fu2)
 
void nmg_enlist_one_vu (struct nmg_inter_struct *is, const struct vertexuse *vu, fastf_t dist)
 
int nmg_isect_line2_edge2p (struct nmg_inter_struct *is, struct bu_ptbl *list, struct edgeuse *eu1, struct faceuse *fu1, struct faceuse *fu2)
 
void nmg_isect_line2_vertex2 (struct nmg_inter_struct *is, struct vertexuse *vu1, struct faceuse *fu1)
 
int nmg_isect_two_ptbls (struct nmg_inter_struct *is, const struct bu_ptbl *t1, const struct bu_ptbl *t2)
 
struct edge_g_lseg * nmg_find_eg_on_line (const uint32_t *magic_p, const fastf_t *pt, const fastf_t *dir, const struct bn_tol *tol)
 
int nmg_k0eu (struct vertex *v)
 
struct vertex * nmg_repair_v_near_v (struct vertex *hit_v, struct vertex *v, const struct edge_g_lseg *eg1, const struct edge_g_lseg *eg2, int bomb, const struct bn_tol *tol)
 
struct vertex * nmg_search_v_eg (const struct edgeuse *eu, int second, const struct edge_g_lseg *eg1, const struct edge_g_lseg *eg2, register struct vertex *hit_v, const struct bn_tol *tol)
 
struct vertex * nmg_common_v_2eg (struct edge_g_lseg *eg1, struct edge_g_lseg *eg2, const struct bn_tol *tol)
 
int nmg_is_vertex_on_inter (struct vertex *v, struct faceuse *fu1, struct faceuse *fu2, struct nmg_inter_struct *is)
 
void nmg_isect_eu_verts (struct edgeuse *eu, struct vertex_g *vg1, struct vertex_g *vg2, struct bu_ptbl *verts, struct bu_ptbl *inters, const struct bn_tol *tol)
 
void nmg_isect_eu_eu (struct edgeuse *eu1, struct vertex_g *vg1a, struct vertex_g *vg1b, fastf_t *dir1, struct edgeuse *eu2, struct bu_ptbl *verts, struct bu_ptbl *inters, const struct bn_tol *tol)
 
void nmg_isect_eu_fu (struct nmg_inter_struct *is, struct bu_ptbl *verts, struct edgeuse *eu, struct faceuse *fu)
 
void nmg_isect_fu_jra (struct nmg_inter_struct *is, struct faceuse *fu1, struct faceuse *fu2, struct bu_ptbl *eu1_list, struct bu_ptbl *eu2_list)
 
void nmg_isect_line2_face2pNEW (struct nmg_inter_struct *is, struct faceuse *fu1, struct faceuse *fu2, struct bu_ptbl *eu1_list, struct bu_ptbl *eu2_list)
 
int nmg_is_eu_on_line3 (const struct edgeuse *eu, const fastf_t *pt, const fastf_t *dir, const struct bn_tol *tol)
 
struct edge_g_lseg * nmg_find_eg_between_2fg (const struct faceuse *ofu1, const struct faceuse *fu2, const struct bn_tol *tol)
 
struct edgeuse * nmg_does_fu_use_eg (const struct faceuse *fu1, const uint32_t *eg)
 
int rt_line_on_plane (const fastf_t *pt, const fastf_t *dir, const fastf_t *plane, const struct bn_tol *tol)
 
void nmg_cut_lu_into_coplanar_and_non (struct loopuse *lu, fastf_t *pl, struct nmg_inter_struct *is)
 
void nmg_check_radial_angles (char *str, struct shell *s, const struct bn_tol *tol)
 
int nmg_faces_can_be_intersected (struct nmg_inter_struct *bs, const struct faceuse *fu1, const struct faceuse *fu2, const struct bn_tol *tol)
 
int nmg_no_isect_fu_pl (struct faceuse *fu1, struct faceuse *fu2, const struct bn_tol *tol)
 
void nmg_isect_two_generic_faces (struct faceuse *fu1, struct faceuse *fu2, const struct bn_tol *tol)
 
void nmg_crackshells (struct shell *s1, struct shell *s2, const struct bn_tol *tol)
 
int nmg_fu_touchingloops (const struct faceuse *fu)
 
int nmg_isect_2faceuse (point_t pt, vect_t dir, struct faceuse *fu1, struct faceuse *fu2, const struct bn_tol *tol)
 Given two faceuse, find the line of intersection between them, if one exists. The line of intersection is returned in parametric line (point & direction vector) form. More...
 

Detailed Description

Routines to intersect two NMG regions. When complete, all loops in each region have a single classification w.r.t. the other region, i.e. all geometric intersections of the two regions have explicit topological representations.

The intersector makes sure that all geometric intersections gets recorded with explicit geometry and topology that is shared between both regions. Primary examples of this are (a) the line of intersection between two planes (faces), and (b) the point of intersection where two edges cross.

Entities of one region that are INSIDE, but not ON the other region do not become shared during the intersection process.

All point -vs- point comparisons should be done in 3D, for consistency.

Method -

Find all the points of intersection between the two regions, and insert vertices at those points, breaking edges on those new vertices as appropriate.

Call the face cutter to construct and delete edges and loops along the line of intersection, as appropriate.

There are no "user interface" routines in here.

Definition in file nmg_inter.c.

Macro Definition Documentation

#define ISECT_NONE   0

Definition at line 68 of file nmg_inter.c.

Referenced by nmg_isect_edge2p_edge2p().

#define ISECT_SHARED_V   1

Definition at line 69 of file nmg_inter.c.

Referenced by nmg_isect_edge2p_edge2p().

#define ISECT_SPLIT1   2

Definition at line 70 of file nmg_inter.c.

Referenced by nmg_isect_edge2p_edge2p().

#define ISECT_SPLIT2   4

Definition at line 71 of file nmg_inter.c.

Referenced by nmg_isect_edge2p_edge2p().

#define VDIST (   a,
 
)    sqrt((a[X]-b[X])*(a[X]-b[X]) + (a[Y]-b[Y])*(a[Y]-b[Y]) + (a[Z]-b[Z])*(a[Z]-b[Z]))

Definition at line 3398 of file nmg_inter.c.

Referenced by nmg_isect_fu_jra(), and nmg_isect_line2_face2pNEW().

#define VDIST_SQ (   a,
 
)    ((a[X]-b[X])*(a[X]-b[X]) + (a[Y]-b[Y])*(a[Y]-b[Y]) + (a[Z]-b[Z])*(a[Z]-b[Z]))

Definition at line 3399 of file nmg_inter.c.

#define MAX_FACES   200

Definition at line 5462 of file nmg_inter.c.

Referenced by nmg_check_radial_angles().

Function Documentation

struct vertexuse* nmg_make_dualvu ( struct vertex *  v,
struct faceuse *  fu,
const struct bn_tol tol 
)

Definition at line 90 of file nmg_inter.c.

References BN_CK_TOL, bn_dist_pt3_lseg3(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), code(), lu, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_find_v_in_face(), nmg_loop_g(), nmg_mlv(), RTG, and V3ARGS.

Referenced by nmg_enlist_vu(), and nmg_isect_eu_fu().

Here is the call graph for this function:

struct vertexuse* nmg_enlist_vu ( struct nmg_inter_struct is,
const struct vertexuse *  vu,
struct vertexuse *  dualvu,
fastf_t  dist 
)

Given a vu which represents a point of intersection between shells s1 and s2, insert it and its dual into lists l1 and l2. First, determine whether the vu came from s1 or s2, and insert in the corresponding list.

Second, try and find a dual of that vertex in the other shell's faceuse (fu1 or fu2) (if the entity in the other shell is not a wire), and enlist the dual. If there is no dual, make a self-loop over there, and enlist that.

If 'dualvu' is provided, don't search, just use that.

While it is true that in most cases the calling routine will know which shell the vu came from, it's cheap to re-determine it here. This "all in one" packaging, which handles both lists automatically is vastly superior to the previous version, which pushed 10-20 lines of bookkeeping up into every place an intersection vu was created.

Returns a pointer to vu's dual.

"Join the Army, young vertexuse".

Definition at line 194 of file nmg_inter.c.

References bu_bomb(), bu_calloc(), BU_LIST_FIRST, bu_log(), BU_PTBL_END, bu_ptbl_ins_unique(), bu_ptbl_locate(), bu_realloc(), nmg_inter_struct::fu1, nmg_inter_struct::fu2, bu_ptbl::l, nmg_inter_struct::l1, nmg_inter_struct::l2, lu, nmg_inter_struct::mag1, nmg_inter_struct::mag2, nmg_inter_struct::mag_len, bu_list::magic, MAX_FASTF, NMG_CK_INTER_STRUCT, nmg_ck_v_in_2fus(), rt_g::NMG_debug, nmg_find_fu_of_vu(), nmg_find_s_of_vu(), nmg_find_v_in_shell(), nmg_loop_g(), nmg_make_dualvu(), nmg_mlv(), RTG, nmg_inter_struct::s1, nmg_inter_struct::s2, and nmg_inter_struct::tol.

Referenced by nmg_isect_2colinear_edge2p(), nmg_isect_edge2p_edge2p(), nmg_isect_line2_edge2p(), nmg_isect_line2_face2pNEW(), nmg_isect_line2_vertex2(), nmg_isect_two_ptbls(), and nmg_isect_vert2p_face2p().

Here is the call graph for this function:

void nmg_isect2d_prep ( struct nmg_inter_struct is,
const uint32_t *  assoc_use 
)

To intersect two co-planar faces, project all vertices from those faces into 2D. At the moment, use a memory intensive strategy which allocates a (3d) point_t for each "index" item, and subscripts the resulting array by the vertices index number. Since additional vertices can be created as the intersection process operates, 2*maxindex items are originally allocated, as a (generous) upper bound on the amount of intersecting that might happen.

In the array, the third double of each projected vertex is set to -1 when that slot has not been filled yet, and 0 when it has been.

Definition at line 525 of file nmg_inter.c.

References bn_mat_fromto(), bu_bomb(), bu_log(), bu_malloc(), e_p, eu1, f1, nmg_inter_struct::maxindex, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, NMG_FACEUSE_MAGIC, nmg_find_model(), nmg_isect2d_cleanup(), nmg_inter_struct::proj, RTG, nmg_inter_struct::tol, nmg_inter_struct::twod, nmg_inter_struct::vert2d, VSET, and Z.

Referenced by nmg_isect_line2_face2pNEW(), and nmg_isect_vert2p_face2p().

Here is the call graph for this function:

void nmg_isect2d_cleanup ( struct nmg_inter_struct is)

Common routine to zap 2d vertex cache, and release dynamic storage.

Definition at line 625 of file nmg_inter.c.

References bu_free(), NMG_CK_INTER_STRUCT, nmg_inter_struct::twod, and nmg_inter_struct::vert2d.

Referenced by nmg_crackshells(), nmg_isect2d_final_cleanup(), nmg_isect2d_prep(), and nmg_isect_two_generic_faces().

Here is the call graph for this function:

void nmg_isect2d_final_cleanup ( void  )

XXX Hack routine used for storage reclamation by G-JACK for XXX calculation of the reportcard without gobbling lots of memory XXX on bu_bomb() longjmp()s. Can be called by the longjmp handler with impunity. If a pointer to busy dynamic memory is still handy, it will be freed. If not, no harm done.

Definition at line 647 of file nmg_inter.c.

References nmg_inter_struct::magic, NMG_INTER_STRUCT_MAGIC, and nmg_isect2d_cleanup().

Referenced by gcv_region_end(), and gcv_region_end_mc().

Here is the call graph for this function:

void nmg_isect_vert2p_face2p ( struct nmg_inter_struct is,
struct vertexuse *  vu1,
struct faceuse *  fu2 
)

Handle the complete intersection of a vertex which lies on the plane of a face. every intersection is performed.

If already part of the topology of the face, do nothing more. If it intersects one of the edges of the face, break the edge there. Otherwise, add a self-loop into the face as a marker.

All vertexuse pairs are enlisted on the intersection line. Assuming that there is one (is->l1 non null).

Called by - nmg_isect_3vertex_3face() nmg_isect_two_face2p()

Definition at line 670 of file nmg_inter.c.

References bn_pt3_pt3_equal(), BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu2, nmg_inter_struct::l1, nmg_inter_struct::magic, MAX_FASTF, nmg_break_eu_on_v(), NMG_CK_INTER_STRUCT, NMG_CK_LOOPUSE(), rt_g::NMG_debug, nmg_enlist_vu(), nmg_isect2d_prep(), nmg_jv(), nmg_loop_g(), nmg_mlv(), NMG_VERTEXUSE_MAGIC, RTG, nmg_inter_struct::tol, and VPRINT.

Here is the call graph for this function:

struct edgeuse* nmg_break_eu_on_v ( struct edgeuse *  eu1,
struct vertex *  v2,
struct faceuse *  fu,
struct nmg_inter_struct is 
)

The vertex 'v2' is known to lie in the plane of eu1's face. If v2 lies between the two endpoints of eu1, break eu1 and return the new edgeuse pointer.

If an edgeuse vertex is joined with v2, v2 remains as the survivor, as the caller is working on it explicitly, and the edgeuse vertices are dealt with implicitly (by dereferencing the eu pointers). Otherwise, we will invalidate our caller's v2 pointer.

Note that no "intersection line" stuff is done, the goal here is just to get the edge appropriately broken.

Either faceuse can be passed in, but it needs to be consistent with the faceuse used to establish the 2d vertex cache.

Returns - new_eu if edge is broken 0 otherwise

Definition at line 1001 of file nmg_inter.c.

References bn_isect_pt2_lseg2(), BU_LIST_PNEXT_CIRC, bu_log(), code(), nmg_inter_struct::magic, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_jv(), out, RTG, and nmg_inter_struct::tol.

Referenced by nmg_isect_2colinear_edge2p(), nmg_isect_line2_face2pNEW(), and nmg_isect_vert2p_face2p().

Here is the call graph for this function:

void nmg_break_eg_on_v ( const struct edge_g_lseg *  eg,
struct vertex *  v,
const struct bn_tol tol 
)

Given a vertex 'v' which is already known to have geometry that lies on the line defined by 'eg', break all the edgeuses along 'eg' which cross 'v'.

Calculation is done in 1 dimension: parametric distance along 'eg'. Edge direction vector needs to be made unit length so that tol->dist makes sense.

Definition at line 1079 of file nmg_inter.c.

References bn_between(), BN_CK_TOL, bn_dist_pt3_along_line3(), bn_pt3_pt3_equal(), bu_bomb(), bu_log(), BU_PTBL_BASEADDR, bu_ptbl_free(), BU_PTBL_LASTADDR, bn_tol::dist, rt_g::NMG_debug, nmg_edgeuse_with_eg_tabulate(), nmg_jv(), and RTG.

Referenced by nmg_isect_line2_face2pNEW().

Here is the call graph for this function:

int nmg_isect_2colinear_edge2p ( struct edgeuse *  eu1,
struct edgeuse *  eu2,
struct faceuse *  fu,
struct nmg_inter_struct is,
struct bu_ptbl l1,
struct bu_ptbl l2 
)

Perform edge mutual breaking only on two collinear edgeuses. This can result in 2 new edgeuses showing up in either loop (case A & D). The vertexuse lists are updated to have all participating vu's and their duals.

Two collinear line segments (eu1 and eu2, or just "1" and "2" in the diagram) can overlap each other in one of 9 configurations, labeled A through I:

 A  B       C       D       E       F       G       H       I

vu1b, vu2b

  • * * * * * * * *=* 1 1 2 2 1 2 1 2 1 2 1=* 1 2 *=2 1=* *=2 * * 1 2 1 2 *=* *=* 1 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 * * 1 2 1=* 2 1 *=2 *=2 1=* 2 1 1 2 1 * * 2 2 1 * * 1 2
  • * * * *=* vu1a, vu2a

To ensure nothing is missed, break every edgeuse on all 4 vertices. If a new edgeuse is created, add it to the list of edgeuses still to be broken. Brute force, but certain not to miss anything.

There is nothing to prevent eu1 and eu2 from being edgeuses in the same loop. This creates interesting patterns if one is NEXT of the other, such as vu[1] == vu[2]. Just handle it gracefully.

Returns the number of edgeuses that resulted, which is always at least the original 2.

Definition at line 1175 of file nmg_inter.c.

References BU_CK_PTBL, BU_LIST_PNEXT_CIRC, bu_log(), bu_ptbl_ins_unique(), e_p, eu1, eu2, MAX_FASTF, nmg_break_eu_on_v(), NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_enlist_vu(), nmg_radial_join_eu(), RTG, and nmg_inter_struct::tol.

Referenced by nmg_isect_edge2p_edge2p().

Here is the call graph for this function:

int nmg_isect_edge2p_edge2p ( struct nmg_inter_struct is,
struct edgeuse *  eu1,
struct edgeuse *  eu2,
struct faceuse *  fu1,
struct faceuse *  fu2 
)

Actual 2d edge/edge intersector

One or both of the edges may be wire edges, i.e. either or both of the fu1 and fu2 args may be null. If so, the vert_list's are unimport4ant.

Returns a bit vector - ISECT_NONE no intersection ISECT_SHARED_V intersection was at (at least one) shared vertex ISECT_SPLIT1 eu1 was split at (geometric) intersection. ISECT_SPLIT2 eu2 was split at (geometric) intersection.

Definition at line 1271 of file nmg_inter.c.

References bn_isect_line2_lseg2(), bu_bomb(), BU_LIST_PNEXT_CIRC, bu_log(), ISECT_NONE, ISECT_SHARED_V, ISECT_SPLIT1, ISECT_SPLIT2, nmg_inter_struct::magic, MAX_FASTF, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_enlist_vu(), nmg_find_model(), nmg_find_pt_in_model(), nmg_isect_2colinear_edge2p(), nmg_jv(), nmg_radial_join_eu(), nmg_vertex_gv(), out, RTG, nmg_inter_struct::tol, VPRINT, and ZERO.

Here is the call graph for this function:

int nmg_isect_construct_nice_ray ( struct nmg_inter_struct is,
struct faceuse *  fu2 
)

Construct a nice ray for is->pt, is->dir which contains the line of intersection, is->on_eg.

See the comment in nmg_isect_two_generics_faces() for details on the constraints on this ray, and the algorithm.

XXX Danger? The ray -vs- RPP check is being done in 3D. It really ought to be done in 2D, to ensure that long edge lines on nearly axis-aligned faces don't get discarded prematurely! XXX Can't just comment out the code, I think the selection XXX of is->pt is significant: 1) All intersections are at positive distances on the ray, 2) dir cross N will point "left".

Returns - 0 OK 1 ray misses fu2 bounding box

Definition at line 2025 of file nmg_inter.c.

References bu_log(), nmg_inter_struct::dir, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_inter_struct::on_eg, nmg_inter_struct::pt, xray::r_dir, xray::r_max, xray::r_min, xray::r_pt, rt_in_rpp(), RTG, and VPRINT.

Here is the call graph for this function:

void nmg_enlist_one_vu ( struct nmg_inter_struct is,
const struct vertexuse *  vu,
fastf_t  dist 
)
int nmg_isect_line2_edge2p ( struct nmg_inter_struct is,
struct bu_ptbl list,
struct edgeuse *  eu1,
struct faceuse *  fu1,
struct faceuse *  fu2 
)

A parallel to nmg_isect_edge2p_edge2p().

Intersect the line with eu1, from fu1. The resulting vu's are added to "list", not is->l1 or is->l2. fu2 is the "other" face on this intersect line, and is used only when searching for existing vertex structs suitable for re-use.

Returns - Number of times edge is broken (0 or 1).

Definition at line 2852 of file nmg_inter.c.

References bn_between(), bn_isect_line2_lseg2(), bn_isect_pt_lseg(), bn_pt3_pt3_equal(), bu_bomb(), BU_CK_PTBL, BU_LIST_PNEXT_CIRC, bu_log(), code(), nmg_inter_struct::dir, nmg_inter_struct::dir2d, nmg_inter_struct::magic, MAX_FASTF, nmg_ck_face_worthless_edges(), NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_enlist_vu(), nmg_find_pt_in_model(), nmg_vertex_gv(), out, nmg_inter_struct::pt, nmg_inter_struct::pt2d, RTG, nmg_inter_struct::tol, VPRINT, X, Y, Z, and ZERO.

Here is the call graph for this function:

void nmg_isect_line2_vertex2 ( struct nmg_inter_struct is,
struct vertexuse *  vu1,
struct faceuse *  fu1 
)

If this lone vertex lies along the intersect line, then add it to the lists.

Called from nmg_isect_line2_face2p().

Definition at line 3015 of file nmg_inter.c.

References bn_distsq_line3_pt3(), bu_log(), nmg_inter_struct::dir, bn_tol::dist_sq, MAX_FASTF, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_enlist_vu(), nmg_inter_struct::pt, RTG, and nmg_inter_struct::tol.

Here is the call graph for this function:

int nmg_isect_two_ptbls ( struct nmg_inter_struct is,
const struct bu_ptbl t1,
const struct bu_ptbl t2 
)

Given two pointer tables filled with edgeuses representing two different edge geometry lines, see if there is a common vertex of intersection. If so, enlist the intersection.

Returns - 1 intersection found 0 no intersection

Definition at line 3048 of file nmg_inter.c.

References BU_CK_PTBL, BU_LIST_PNEXT_CIRC, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_LASTADDR, eu1, eu2, MAX_FASTF, NMG_CK_INTER_STRUCT, rt_g::NMG_debug, nmg_enlist_vu(), nmg_find_s_of_vu(), and RTG.

Here is the call graph for this function:

struct edge_g_lseg* nmg_find_eg_on_line ( const uint32_t *  magic_p,
const fastf_t pt,
const fastf_t dir,
const struct bn_tol tol 
)

Do a geometric search to find an edge_g_lseg on the given line. If the fuser did its job, there should be only one.

Definition at line 3123 of file nmg_inter.c.

References BN_CK_TOL, bu_log(), BU_PTBL_BASEADDR, bu_ptbl_free(), BU_PTBL_LASTADDR, rt_g::NMG_debug, nmg_edgeuse_on_line_tabulate(), and RTG.

Here is the call graph for this function:

int nmg_k0eu ( struct vertex *  v)

Kill all 0-length edgeuses that start and end on this vertex.

Returns - 0 If none were found count Number of 0-length edgeuses killed (not counting mates)

Definition at line 3173 of file nmg_inter.c.

References BU_LIST_FOR, bu_log(), NMG_EDGEUSE_MAGIC, nmg_keu(), nmg_pr_eu_briefly(), and top().

Referenced by nmg_repair_v_near_v().

Here is the call graph for this function:

struct vertex* nmg_repair_v_near_v ( struct vertex *  hit_v,
struct vertex *  v,
const struct edge_g_lseg *  eg1,
const struct edge_g_lseg *  eg2,
int  bomb,
const struct bn_tol tol 
)

Attempt to join two vertices which both claim to be the intersection of two lines. If they are close enough, repair the damage.

Returns - hit_v If repair succeeds. vertex 'v' is now invalid. NULL If repair fails. If 'bomb' is non-zero, bu_bomb() is called.

Definition at line 3212 of file nmg_inter.c.

References bn_2line3_colinear(), BN_CK_TOL, bn_dist_line3_pt3(), bn_dist_pt3_pt3(), bn_pt3_pt3_equal(), bu_bomb(), bu_log(), bn_tol::dist, nmg_findeu(), nmg_jv(), nmg_k0eu(), nmg_pr_eg(), out, and VPRINT.

Referenced by nmg_isect_line2_face2pNEW(), and nmg_search_v_eg().

Here is the call graph for this function:

struct vertex* nmg_search_v_eg ( const struct edgeuse *  eu,
int  second,
const struct edge_g_lseg *  eg1,
const struct edge_g_lseg *  eg2,
register struct vertex *  hit_v,
const struct bn_tol tol 
)

Search all edgeuses referring to this vu's vertex. If the vertex is used by edges on both eg1 and eg2, then it's a "hit" between the two edge geometries. If a new hit happens at a different vertex from a previous hit, that is a fatal error.

This routine exists only as a support routine for nmg_common_v_2eg().

XXX This is a lame name.

Definition at line 3286 of file nmg_inter.c.

References BN_CK_TOL, bn_distsq_line3_pt3(), bu_bomb(), BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bu_log(), bn_tol::dist_sq, eu1, rt_g::NMG_debug, NMG_EDGEUSE_MAGIC, nmg_pr_eg(), nmg_pr_eu(), nmg_repair_v_near_v(), RTG, OSL::Strings::v, and VPRINT.

Referenced by nmg_common_v_2eg().

Here is the call graph for this function:

struct vertex* nmg_common_v_2eg ( struct edge_g_lseg *  eg1,
struct edge_g_lseg *  eg2,
const struct bn_tol tol 
)

Perform a topology search for a common vertex between two edge geometry lines.

Definition at line 3367 of file nmg_inter.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FOR, BU_LIST_MAIN_PTR, bu_log(), eu1, rt_g::NMG_debug, NMG_EDGEUSE2_MAGIC, nmg_search_v_eg(), and RTG.

Referenced by nmg_isect_line2_face2pNEW().

Here is the call graph for this function:

int nmg_is_vertex_on_inter ( struct vertex *  v,
struct faceuse *  fu1,
struct faceuse *  fu2,
struct nmg_inter_struct is 
)

Definition at line 3402 of file nmg_inter.c.

References bn_distsq_line3_pt3(), code(), nmg_inter_struct::dir, bn_tol::dist, bn_tol::dist_sq, NMG_CK_INTER_STRUCT, nmg_class_pt_fu_except(), nmg_find_v_in_face(), nmg_inter_struct::pt, and nmg_inter_struct::tol.

Referenced by nmg_isect_fu_jra().

Here is the call graph for this function:

void nmg_isect_eu_verts ( struct edgeuse *  eu,
struct vertex_g *  vg1,
struct vertex_g *  vg2,
struct bu_ptbl verts,
struct bu_ptbl inters,
const struct bn_tol tol 
)

Definition at line 3455 of file nmg_inter.c.

References BN_CK_TOL, bn_dist_pt3_lseg3(), BU_CK_PTBL, BU_PTBL_END, BU_PTBL_GET, bu_ptbl_ins_unique(), code(), and OSL::Strings::v.

Referenced by nmg_isect_eu_fu().

Here is the call graph for this function:

void nmg_isect_eu_eu ( struct edgeuse *  eu1,
struct vertex_g *  vg1a,
struct vertex_g *  vg1b,
fastf_t dir1,
struct edgeuse *  eu2,
struct bu_ptbl verts,
struct bu_ptbl inters,
const struct bn_tol tol 
)

Definition at line 3496 of file nmg_inter.c.

References bn_isect_lseg3_lseg3(), bu_log(), bu_ptbl_ins_unique(), code(), bn_tol::dist, rt_g::NMG_debug, nmg_find_model(), nmg_find_pt_in_model(), nmg_vertex_gv(), RTG, SMALL_FASTF, V3ARGS, and ZERO.

Referenced by nmg_isect_eu_fu().

Here is the call graph for this function:

void nmg_isect_fu_jra ( struct nmg_inter_struct is,
struct faceuse *  fu1,
struct faceuse *  fu2,
struct bu_ptbl eu1_list,
struct bu_ptbl eu2_list 
)
void nmg_isect_line2_face2pNEW ( struct nmg_inter_struct is,
struct faceuse *  fu1,
struct faceuse *  fu2,
struct bu_ptbl eu1_list,
struct bu_ptbl eu2_list 
)

HEART

For each distinct edge_g_lseg LINE on the face (composed of potentially many edgeuses and many different edges), intersect with the edge_g_lseg LINE which represents the face/face intersection line.

Note that the geometric intersection of the two faces is stored in is->pt and is->dir. If is->on_eg is set, it is the callers' responsibility to make sure it is not much different than the original geometric one.

Go to great pains to ensure that two non-collinear lines intersect at either 0 or 1 points, and no more.

Called from - nmg_isect_edge2p_face2p() nmg_isect_two_face3p()

Definition at line 4026 of file nmg_inter.c.

References bn_2line3_colinear(), bn_dist_line3_pt3(), bn_dist_pt3_line3(), bn_distsq_line3_pt3(), bn_isect_line2_line2(), bn_isect_line3_line3(), bn_isect_pt2_lseg2(), bu_bomb(), BU_CK_PTBL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_ins_unique(), BU_PTBL_LASTADDR, nmg_inter_struct::dir, nmg_inter_struct::dir2d, bn_tol::dist, bn_tol::dist_sq, eu1, eu2, nmg_inter_struct::fu1, nmg_inter_struct::fu2, bu_ptbl::l, bu_list::magic, nmg_inter_struct::magic, MAX_FASTF, NEAR_ZERO, nmg_break_eg_on_v(), nmg_break_eu_on_v(), NMG_CK_INTER_STRUCT, nmg_class_name(), nmg_class_pt_fu_except(), nmg_common_v_2eg(), rt_g::NMG_debug, nmg_edge_g_tabulate(), NMG_EDGEUSE_MAGIC, nmg_enlist_vu(), nmg_find_pt_in_model(), nmg_isect2d_prep(), nmg_jeg(), nmg_pr_eg(), nmg_pr_fu_briefly(), nmg_repair_v_near_v(), nmg_vertex_gv(), NMG_VERTEXUSE_MAGIC, nmg_inter_struct::on_eg, pdv_3cont(), pdv_3ray(), pl_color(), nmg_inter_struct::proj, nmg_inter_struct::pt, nmg_inter_struct::pt2d, RTG, nmg_inter_struct::tol, V2PRINT, V3ARGS, VDIST, and VPRINT.

Here is the call graph for this function:

int nmg_is_eu_on_line3 ( const struct edgeuse *  eu,
const fastf_t pt,
const fastf_t dir,
const struct bn_tol tol 
)

Definition at line 4649 of file nmg_inter.c.

References BN_CK_TOL, bn_distsq_line3_pt3(), and bn_tol::dist_sq.

Here is the call graph for this function:

struct edge_g_lseg* nmg_find_eg_between_2fg ( const struct faceuse *  ofu1,
const struct faceuse *  fu2,
const struct bn_tol tol 
)

Perform a topology search to determine if two face geometries (specified by their faceuses) share an edge geometry in common. The edge_g is returned, even if there are no existing uses of it in either fu1 or fu2. It still represents the intersection line between the two face geometries, found topologically.

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

Calling this routine when the two faces share face geometry is illegal.

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

Definition at line 4696 of file nmg_inter.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, f1, nmg_2edgeuse_g_coincident(), NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_FACEUSE_MAGIC, nmg_find_model(), nmg_jeg(), NMG_LOOPUSE_MAGIC, nmg_model_fuse(), nmg_pl_lu_around_eu(), nmg_pr_eg(), nmg_pr_eu_briefly(), nmg_pr_eu_endpoints(), nmg_pr_fu_around_eu(), nmg_pr_fus_in_fg(), nmg_radial_join_eu(), NMG_VERTEXUSE_MAGIC, and RTG.

Here is the call graph for this function:

struct edgeuse* nmg_does_fu_use_eg ( const struct faceuse *  fu1,
const uint32_t *  eg 
)

See if any edgeuse in the given faceuse lies on the indicated edge geometry (edge_g). This is a topology check only.

Returns - NULL No eu Yes, here is one edgeuse that does. There may be more.

Definition at line 4836 of file nmg_inter.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bu_log(), eu1, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_VERTEXUSE_MAGIC, out, and RTG.

Here is the call graph for this function:

int rt_line_on_plane ( const fastf_t pt,
const fastf_t dir,
const fastf_t plane,
const struct bn_tol tol 
)

Returns - 1 line is on plane, within tol 0 line does not lie on the plane

Definition at line 4873 of file nmg_inter.c.

References BN_CK_TOL, bn_tol::dist, NEAR_ZERO, and bn_tol::para.

void nmg_check_radial_angles ( char *  str,
struct shell *  s,
const struct bn_tol tol 
)

Definition at line 5464 of file nmg_inter.c.

References BN_CK_TOL, bu_bomb(), bu_log(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, bu_ptbl_init(), bu_ptbl::l, bu_list::magic, MAX_FACES, NMG_CK_SHELL(), nmg_edge_tabulate(), nmg_find_eu_leftvec(), nmg_find_fu_of_eu(), nmg_measure_fu_angle(), and ZERO.

Here is the call graph for this function:

int nmg_faces_can_be_intersected ( struct nmg_inter_struct bs,
const struct faceuse *  fu1,
const struct faceuse *  fu2,
const struct bn_tol tol 
)

Check if two faceuses can be intersected normally, by looking at the line of intersection and determining if the vertices from each face are all above the other face on one side of the intersection line and below it on the other side of the intersection line.

return: 1 - faceuses meet criteria and can be intersected normally 0 - must use nmg_isect_nearly_coplanar_faces

Definition at line 5576 of file nmg_inter.c.

References BN_CK_TOL, bn_dist_pt3_line3(), bn_mkpoint_3planes(), BU_PTBL_END, bu_ptbl_free(), BU_PTBL_GET, code(), nmg_inter_struct::dir, bn_tol::dist, f1, f2, bu_ptbl::l, bu_list::magic, nmg_vertex_tabulate(), nmg_inter_struct::pt, SMALL_FASTF, and OSL::Strings::v.

Here is the call graph for this function:

int nmg_no_isect_fu_pl ( struct faceuse *  fu1,
struct faceuse *  fu2,
const struct bn_tol tol 
)

Test if the face of faceuse fu2 is above, below, or intersects the plane of faceuse fu1. If fu2 is completely above or below the plane then fu2 do not intersect fu1. If fu2 intersects the plane of fu1, we need more testing to determine if fu1 intersects fu2.

Returns:

1 = fu1 and fu2 do not intersect 0 = inconclusive

Definition at line 5750 of file nmg_inter.c.

References BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bn_tol::dist, hit(), lu, NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, and out.

Referenced by nmg_isect_two_generic_faces().

Here is the call graph for this function:

void nmg_isect_two_generic_faces ( struct faceuse *  fu1,
struct faceuse *  fu2,
const struct bn_tol tol 
)
void nmg_crackshells ( struct shell *  s1,
struct shell *  s2,
const struct bn_tol tol 
)
int nmg_fu_touchingloops ( const struct faceuse *  fu)

Definition at line 6500 of file nmg_inter.c.

References BU_LIST_FOR, bu_log(), lu, NMG_CK_LOOPUSE(), rt_g::NMG_debug, nmg_loop_touches_self(), nmg_pr_lu_briefly(), and RTG.

Referenced by nmg_face_state_transition(), and nmg_isect_two_generic_faces().

Here is the call graph for this function:

int nmg_isect_2faceuse ( point_t  pt,
vect_t  dir,
struct faceuse *  fu1,
struct faceuse *  fu2,
const struct bn_tol tol 
)

Given two faceuse, find the line of intersection between them, if one exists. The line of intersection is returned in parametric line (point & direction vector) form.

Returns
0 OK, line of intersection stored in `pt' and `dir'.
-1 FAIL, faceuse are coplanar
-2 FAIL, faceuse are parallel but not coplanar
-3 FAIL, unable to find line of intersection
Parameters
[out]ptStarting point of line of intersection
[out]dirDirection vector of line of intersection (unit length)
[in]fu1faceuse 1
[in]fu2faceuse 2
[in]toltolerance values

Definition at line 6548 of file nmg_inter.c.

References bn_mkpoint_3planes(), bu_bomb(), BU_LIST_FIRST_MAGIC, BU_LIST_FOR, bn_tol::dist, f1, f2, lu, MAX_FASTF, NEAR_ZERO, nmg_ck_fu_verts(), NMG_CK_LOOPUSE(), NMG_EDGEUSE_MAGIC, SMALL_FASTF, VSET, VSETALL, X, Y, and Z.

Referenced by nmg_isect_two_generic_faces().

Here is the call graph for this function: