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

Go to the source code of this file.

Data Structures

struct  nmg_ray_state
 
struct  loop_cuts
 
struct  nmg_vu_stuff
 
struct  nmg_loop_stuff
 
struct  state_transitions
 

Macros

#define PLOT_BOTH_FACES   1
 
#define NMG_STATE_ERROR   0
 
#define NMG_STATE_OUT   1
 
#define NMG_STATE_ON_L   2
 
#define NMG_STATE_ON_R   3
 
#define NMG_STATE_ON_B   4
 
#define NMG_STATE_ON_N   5
 
#define NMG_STATE_IN   6
 
#define NMG_E_ASSESSMENT_LEFT   0
 
#define NMG_E_ASSESSMENT_RIGHT   1
 
#define NMG_E_ASSESSMENT_ON_FORW   2
 
#define NMG_E_ASSESSMENT_ON_REV   3
 
#define NMG_E_ASSESSMENT_ERROR   4 /* risky */
 
#define NMG_V_ASSESSMENT_LONE   16
 
#define NMG_V_ASSESSMENT_ERROR   17
 
#define NMG_V_COMB(_p, _n)   (((_p)<<2)|(_n))
 
#define NMG_V_ASSESSMENT_PREV(_a)   (((_a)>>2)&3)
 
#define NMG_V_ASSESSMENT_NEXT(_a)   ((_a)&3)
 
#define NMG_LEFT_LEFT   NMG_V_COMB(NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_LEFT)
 
#define NMG_LEFT_RIGHT   NMG_V_COMB(NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_RIGHT)
 
#define NMG_LEFT_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_ON_FORW)
 
#define NMG_LEFT_ON_REV   NMG_V_COMB(NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_ON_REV)
 
#define NMG_RIGHT_LEFT   NMG_V_COMB(NMG_E_ASSESSMENT_RIGHT, NMG_E_ASSESSMENT_LEFT)
 
#define NMG_RIGHT_RIGHT   NMG_V_COMB(NMG_E_ASSESSMENT_RIGHT, NMG_E_ASSESSMENT_RIGHT)
 
#define NMG_RIGHT_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_RIGHT, NMG_E_ASSESSMENT_ON_FORW)
 
#define NMG_RIGHT_ON_REV   NMG_V_COMB(NMG_E_ASSESSMENT_RIGHT, NMG_E_ASSESSMENT_ON_REV)
 
#define NMG_ON_FORW_LEFT   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_LEFT)
 
#define NMG_ON_FORW_RIGHT   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_RIGHT)
 
#define NMG_ON_FORW_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_FORW)
 
#define NMG_ON_FORW_ON_REV   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV)
 
#define NMG_ON_REV_LEFT   NMG_V_COMB(NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_LEFT)
 
#define NMG_ON_REV_RIGHT   NMG_V_COMB(NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_RIGHT)
 
#define NMG_ON_REV_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_ON_FORW)
 
#define NMG_ON_REV_ON_REV   NMG_V_COMB(NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_ON_REV)
 
#define NMG_LONE   NMG_V_ASSESSMENT_LONE
 
#define NMG_ACTION_ERROR   0
 
#define NMG_ACTION_NONE   1
 
#define NMG_ACTION_NONE_OPTIM   2
 
#define NMG_ACTION_VFY_EXT   3
 
#define NMG_ACTION_VFY_MULTI   4
 
#define NMG_ACTION_LONE_V_ESPLIT   5
 
#define NMG_ACTION_LONE_V_JAUNT   6
 
#define NMG_ACTION_CUTJOIN   7
 
#define NMG_RAYSTATE_MAGIC   0x54322345
 
#define NMG_CK_RAYSTATE(_p)   NMG_CKMAG(_p, NMG_RAYSTATE_MAGIC, "nmg_ray_state")
 
#define RADIAN_TWEEK   1.0e-14 /* low bits of double prec., re: 6.28... */
 
#define WEDGE_LEFT   0
 
#define WEDGE_CROSS   1
 
#define WEDGE_RIGHT   2
 
#define WEDGE_ON   3
 
#define WEDGECLASS2STR(_cl)   nmg_wedgeclass_string[(_cl)]
 
#define WEDGE2_TO_STRING(_class2)   (nmg_wedge2_string[(_class2)+2])
 
#define WEDGE2_OVERLAP   -2
 
#define WEDGE2_NO_OVERLAP   -1
 
#define WEDGE2_AB_IN_CD   0
 
#define WEDGE2_CD_IN_AB   1
 
#define WEDGE2_IDENTICAL   2
 
#define WEDGE2_TOUCH_AT_BC   3
 
#define WEDGE2_TOUCH_AT_DA   4
 
#define WEDGE_ANG_TOL   0.001 /* XXX Angular tolerance, in degrees */
 
#define ANG_SMASH(_a)
 
#define A_LT_B   {ret = -1; goto out;}
 
#define AB_EQUAL   {ret = 0; goto out;}
 
#define A_GT_B   {ret = 1; goto out;}
 
#define VAVERAGE(a, b, c)
 

Functions

int nmg_face_state_transition (struct nmg_ray_state *rs, int pos, int multi, int other_rs_state)
 
HIDDEN void ptbl_vsort (struct bu_ptbl *b, fastf_t *pt, fastf_t *dir, fastf_t *mag, fastf_t dist_tol)
 
int nmg_ck_vu_ptbl (struct bu_ptbl *p, struct faceuse *fu)
 
double nmg_vu_angle_measure (struct vertexuse *vu, fastf_t *x_dir, fastf_t *y_dir, int assessment, int in)
 
int nmg_is_v_on_rs_list (const struct nmg_ray_state *rs, const struct vertex *v)
 
int nmg_assess_eu (struct edgeuse *eu, int forw, struct nmg_ray_state *rs, int pos)
 
int nmg_assess_vu (struct nmg_ray_state *rs, int pos)
 
void nmg_pr_vu_stuff (const struct nmg_vu_stuff *vs)
 
int nmg_wedge_class (int ass, double a, double b)
 
int nmg_face_coincident_vu_sort (struct nmg_ray_state *rs, int start, int end)
 
void nmg_sanitize_fu (struct faceuse *fu)
 
void nmg_face_rs_init (struct nmg_ray_state *rs, struct bu_ptbl *b, struct faceuse *fu1, struct faceuse *fu2, fastf_t *pt, fastf_t *dir, struct edge_g_lseg *eg, const struct bn_tol *tol)
 
void nmg_edge_geom_isect_line (struct edgeuse *eu, struct nmg_ray_state *rs, const char *reason)
 
HIDDEN void nmg_fcut_face (struct nmg_ray_state *rs)
 
void nmg_unlist_v (struct bu_ptbl *b, fastf_t *mag, struct vertex *v)
 
int nmg_onon_fix (struct nmg_ray_state *rs, struct bu_ptbl *b, struct bu_ptbl *ob, fastf_t *mag, fastf_t *omag)
 
struct edge_g_lseg * nmg_face_cutjoin (struct bu_ptbl *b1, struct bu_ptbl *b2, fastf_t *mag1, fastf_t *mag2, struct faceuse *fu1, struct faceuse *fu2, fastf_t *pt, fastf_t *dir, struct edge_g_lseg *eg, const struct bn_tol *tol)
 
void nmg_fcut_face_2d (struct bu_ptbl *vu_list, fastf_t *mag, struct faceuse *fu1, struct faceuse *fu2, struct bn_tol *tol)
 

Detailed Description

After two faces have been intersected, cut or join loops crossed by the line of intersection. (Formerly nmg_comb.c)

The main external routine here is nmg_face_cutjoin().

The line of intersection ("ray") will divide the face into two sets of loops. No one loop may cross the ray after this routine is finished. (Current optimization may remove this property).

Intersection points of significance to the other face but not yet part of the current face's geometry are denoted by a vu on the ray list, which points to a loop of a single vertex. These points need to be incorporated into the final face.

Definition in file nmg_fcut.c.

Macro Definition Documentation

#define PLOT_BOTH_FACES   1

Definition at line 55 of file nmg_fcut.c.

#define NMG_STATE_ERROR   0

Definition at line 59 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_STATE_OUT   1

Definition at line 60 of file nmg_fcut.c.

Referenced by nmg_face_rs_init(), and nmg_face_state_transition().

#define NMG_STATE_ON_L   2

Definition at line 61 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_STATE_ON_R   3

Definition at line 62 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_STATE_ON_B   4

Definition at line 63 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_STATE_ON_N   5

Definition at line 64 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_STATE_IN   6

Definition at line 65 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_E_ASSESSMENT_LEFT   0

Definition at line 78 of file nmg_fcut.c.

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

#define NMG_E_ASSESSMENT_RIGHT   1

Definition at line 79 of file nmg_fcut.c.

Referenced by nmg_assess_eu(), and nmg_vu_angle_measure().

#define NMG_E_ASSESSMENT_ON_FORW   2
#define NMG_E_ASSESSMENT_ON_REV   3
#define NMG_E_ASSESSMENT_ERROR   4 /* risky */

Definition at line 82 of file nmg_fcut.c.

Referenced by nmg_assess_eu().

#define NMG_V_ASSESSMENT_LONE   16

Definition at line 84 of file nmg_fcut.c.

Referenced by nmg_assess_vu().

#define NMG_V_ASSESSMENT_ERROR   17

Definition at line 85 of file nmg_fcut.c.

Referenced by nmg_assess_vu().

#define NMG_V_COMB (   _p,
  _n 
)    (((_p)<<2)|(_n))

Definition at line 86 of file nmg_fcut.c.

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

#define NMG_V_ASSESSMENT_PREV (   _a)    (((_a)>>2)&3)

Definition at line 89 of file nmg_fcut.c.

Referenced by nmg_face_state_transition(), and nmg_vu_angle_measure().

#define NMG_V_ASSESSMENT_NEXT (   _a)    ((_a)&3)

Definition at line 90 of file nmg_fcut.c.

Referenced by nmg_face_state_transition(), and nmg_vu_angle_measure().

Definition at line 126 of file nmg_fcut.c.

Definition at line 127 of file nmg_fcut.c.

Definition at line 128 of file nmg_fcut.c.

Definition at line 129 of file nmg_fcut.c.

Definition at line 130 of file nmg_fcut.c.

Definition at line 131 of file nmg_fcut.c.

Definition at line 132 of file nmg_fcut.c.

Definition at line 133 of file nmg_fcut.c.

Definition at line 134 of file nmg_fcut.c.

Definition at line 135 of file nmg_fcut.c.

#define NMG_ON_FORW_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_FORW)

Definition at line 136 of file nmg_fcut.c.

#define NMG_ON_FORW_ON_REV   NMG_V_COMB(NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV)

Definition at line 137 of file nmg_fcut.c.

Referenced by nmg_assess_vu().

Definition at line 138 of file nmg_fcut.c.

Definition at line 139 of file nmg_fcut.c.

#define NMG_ON_REV_ON_FORW   NMG_V_COMB(NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_ON_FORW)

Definition at line 140 of file nmg_fcut.c.

Referenced by nmg_assess_vu().

Definition at line 141 of file nmg_fcut.c.

#define NMG_LONE   NMG_V_ASSESSMENT_LONE

Definition at line 142 of file nmg_fcut.c.

#define NMG_ACTION_ERROR   0

Definition at line 157 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_NONE   1

Definition at line 158 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_NONE_OPTIM   2

Definition at line 159 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_VFY_EXT   3

Definition at line 160 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_VFY_MULTI   4

Definition at line 161 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_LONE_V_ESPLIT   5

Definition at line 162 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_LONE_V_JAUNT   6

Definition at line 163 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_ACTION_CUTJOIN   7

Definition at line 164 of file nmg_fcut.c.

Referenced by nmg_face_state_transition().

#define NMG_RAYSTATE_MAGIC   0x54322345

Definition at line 197 of file nmg_fcut.c.

Referenced by nmg_face_rs_init().

#define NMG_CK_RAYSTATE (   _p)    NMG_CKMAG(_p, NMG_RAYSTATE_MAGIC, "nmg_ray_state")
#define RADIAN_TWEEK   1.0e-14 /* low bits of double prec., re: 6.28... */

Referenced by nmg_vu_angle_measure().

#define WEDGE_LEFT   0

Definition at line 796 of file nmg_fcut.c.

Referenced by nmg_face_coincident_vu_sort(), and nmg_wedge_class().

#define WEDGE_CROSS   1

Definition at line 797 of file nmg_fcut.c.

Referenced by nmg_wedge_class().

#define WEDGE_RIGHT   2

Definition at line 798 of file nmg_fcut.c.

Referenced by nmg_face_coincident_vu_sort(), and nmg_wedge_class().

#define WEDGE_ON   3

Definition at line 799 of file nmg_fcut.c.

Referenced by nmg_wedge_class().

#define WEDGECLASS2STR (   _cl)    nmg_wedgeclass_string[(_cl)]

Definition at line 800 of file nmg_fcut.c.

Referenced by nmg_face_coincident_vu_sort(), nmg_pr_vu_stuff(), and nmg_wedge_class().

#define WEDGE2_TO_STRING (   _class2)    (nmg_wedge2_string[(_class2)+2])

Definition at line 922 of file nmg_fcut.c.

#define WEDGE2_OVERLAP   -2

Definition at line 924 of file nmg_fcut.c.

#define WEDGE2_NO_OVERLAP   -1

Definition at line 925 of file nmg_fcut.c.

#define WEDGE2_AB_IN_CD   0

Definition at line 926 of file nmg_fcut.c.

#define WEDGE2_CD_IN_AB   1

Definition at line 927 of file nmg_fcut.c.

#define WEDGE2_IDENTICAL   2

Definition at line 928 of file nmg_fcut.c.

#define WEDGE2_TOUCH_AT_BC   3

Definition at line 929 of file nmg_fcut.c.

#define WEDGE2_TOUCH_AT_DA   4

Definition at line 930 of file nmg_fcut.c.

#define WEDGE_ANG_TOL   0.001 /* XXX Angular tolerance, in degrees */
#define ANG_SMASH (   _a)
Value:
{\
if (_a <= WEDGE_ANG_TOL) _a = 0; \
else if (NEAR_EQUAL(_a, 180, WEDGE_ANG_TOL)) _a = 180; \
else if (_a >= 360 - WEDGE_ANG_TOL) _a = 360; }
if(share_geom)
Definition: nmg_mod.c:3829
else
Definition: nmg_mod.c:3872
#define WEDGE_ANG_TOL
#define A_LT_B   {ret = -1; goto out;}

Support routine for nmg_face_coincident_vu_sort(), via bu_sort().

It is important to note that an edge on the LEFT side of the ray will have a "lo" angle which is numerically LARGER than the "hi" angle. However, all are measured in the usual units: 0 = ON_REV, 90 = RIGHT, 180 = ON_FORW, 270 = LEFT.

Returns - -1 when A < B 0 when A == B +1 when A > B

Definition at line 1276 of file nmg_fcut.c.

#define AB_EQUAL   {ret = 0; goto out;}

Definition at line 1277 of file nmg_fcut.c.

#define A_GT_B   {ret = 1; goto out;}

Definition at line 1278 of file nmg_fcut.c.

#define VAVERAGE (   a,
  b,
 
)
Value:
{ \
(a)[X] = ((b)[X] + (c)[X]) * 0.5;\
(a)[Y] = ((b)[Y] + (c)[Y]) * 0.5;\
(a)[Z] = ((b)[Z] + (c)[Z]) * 0.5;\
}
Definition: color.c:49
Definition: color.c:51
Definition: color.c:50

Definition at line 1987 of file nmg_fcut.c.

Referenced by nmg_fcut_face().

Function Documentation

int nmg_face_state_transition ( struct nmg_ray_state rs,
int  pos,
int  multi,
int  other_rs_state 
)

Given current (old) state, assess the current vertexuse, and pull the appropriate action and new state from the tables. Then perform the indicated action.

The real work happens in the nmg_assess_vu() and in the tables.

Explicit Returns - Nothing useful yet.

Implicit Returns - Modifications to the NMG shell being operated on. Updated state etc. in nmg_ray_state structure.

Definition at line 3365 of file nmg_fcut.c.

References state_transitions::action, state_transitions::assessment, BN_CK_TOL, bu_bomb(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), bu_vls_addr(), BU_VLS_INIT_ZERO, bu_vls_printf(), nmg_ray_state::eg_p, nmg_ray_state::fu1, nmg_ray_state::fu2, nmg_ray_state::last_action, nmg_ray_state::left, lu, state_transitions::new_state, NMG_ACTION_CUTJOIN, NMG_ACTION_ERROR, NMG_ACTION_LONE_V_ESPLIT, NMG_ACTION_LONE_V_JAUNT, NMG_ACTION_NONE, NMG_ACTION_NONE_OPTIM, NMG_ACTION_VFY_EXT, NMG_ACTION_VFY_MULTI, nmg_assess_eu(), nmg_assess_vu(), NMG_CK_LOOPUSE(), NMG_CK_RAYSTATE, nmg_cut_loop(), rt_g::NMG_debug, NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV, nmg_edge_geom_isect_line(), NMG_EDGEUSE_MAGIC, nmg_find_eu_of_vu(), nmg_find_lu_of_vu(), nmg_findeu(), nmg_fu_touchingloops(), nmg_join_2loops(), nmg_join_2singvu_loops(), nmg_join_singvu_loop(), nmg_klu(), nmg_loop_g(), nmg_loop_is_a_crack(), NMG_LOOPUSE_MAGIC, nmg_lu_reorient(), nmg_orientation(), nmg_plot_lu_ray(), nmg_pr_eu_endpoints(), nmg_pr_lu(), nmg_pr_lu_briefly(), nmg_pr_vu_briefly(), nmg_radial_join_eu(), nmg_set_lu_orientation(), nmg_split_lu_at_vu(), NMG_STATE_ERROR, NMG_STATE_IN, NMG_STATE_ON_B, NMG_STATE_ON_L, NMG_STATE_ON_N, NMG_STATE_ON_R, NMG_STATE_OUT, NMG_V_ASSESSMENT_NEXT, NMG_V_ASSESSMENT_PREV, nmg_vfu(), nmg_ray_state::nvu, RT_G_DEBUG, RTG, nmg_ray_state::state, nmg_ray_state::tol, and nmg_ray_state::vu.

Here is the call graph for this function:

HIDDEN void ptbl_vsort ( struct bu_ptbl b,
fastf_t pt,
fastf_t dir,
fastf_t mag,
fastf_t  dist_tol 
)

Sort list of hit points (vertexuse's) in fu1 (bu_ptbl 'b') on plane of fu2 (defined by pt+dir), by increasing distance, vertex ptr, and vu ptr. Eliminate duplications of vu at same distance. (Actually, a given vu should show up at exactly 1 distance!) The line of intersection is pt + t * dir.

For now, a bubble-sort is used, because the list should not have more than a few hundred entries on it.

Definition at line 222 of file nmg_fcut.c.

References bn_dist_line3_pt3(), bu_bomb(), bu_log(), bu_ptbl::buffer, bu_ptbl::end, if(), MAX_FASTF, rt_g::NMG_debug, RTG, SMALL_FASTF, VPRINT, and ZERO.

Referenced by nmg_face_cutjoin().

Here is the call graph for this function:

int nmg_ck_vu_ptbl ( struct bu_ptbl p,
struct faceuse *  fu 
)

As an automatic check for the intersector failing to find all intersections, check all the vertices on the intersection line. For each one, find all the other uses in this faceuse, and if they are not also listed on the line, they were overlooked.

This does not catch all possible mistakes, but does catch some.

Definition at line 345 of file nmg_fcut.c.

References bu_bomb(), BU_CK_PTBL, bu_identify_magic(), BU_LIST_FOR, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl_ins(), bu_ptbl_locate(), bu_ptbl::l, bu_list::magic, nmg_find_fu_of_vu(), nmg_pr_ptbl(), top(), and OSL::Strings::v.

Referenced by nmg_face_cutjoin().

Here is the call graph for this function:

double nmg_vu_angle_measure ( struct vertexuse *  vu,
fastf_t x_dir,
fastf_t y_dir,
int  assessment,
int  in 
)

Given a vertexuse from a loop which lies in a plane, compute the vector 'vec' from the previous vertex to this one. Using two perpendicular vectors (x_dir and y_dir) which both lie in the plane of the loop, return the angle (in radians) of 'vec' from x_dir, going CCW around the perpendicular x_dir CROSS y_dir.

x_dir is -ray_dir y_dir points right.

Returns - vec == x_dir returns 0, vec == y_dir returns pi/2, vec == -x_dir returns pi, vec == -y_dir returns 3*pi/2. 0.0 if unable to compute 'vec'

Definition at line 418 of file nmg_fcut.c.

References bn_angle_measure(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), lu, M_PI, NMG_CK_LOOPUSE(), rt_g::NMG_debug, NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_RIGHT, nmg_find_eu_with_vu_in_lu(), nmg_find_lu_of_vu(), NMG_LOOPUSE_MAGIC, NMG_V_ASSESSMENT_NEXT, NMG_V_ASSESSMENT_PREV, RADIAN_TWEEK, RTG, V3ARGS, and ZERO.

Referenced by nmg_face_coincident_vu_sort().

Here is the call graph for this function:

int nmg_is_v_on_rs_list ( const struct nmg_ray_state rs,
const struct vertex *  v 
)

Definition at line 528 of file nmg_fcut.c.

References nmg_ray_state::nvu, and nmg_ray_state::vu.

Referenced by nmg_assess_eu().

int nmg_assess_eu ( struct edgeuse *  eu,
int  forw,
struct nmg_ray_state rs,
int  pos 
)

The current vertex (eu->vu_p) is on the line of intersection. Assess the indicated edge, to see if it lies on the line of intersection, or departs towards the left or right.

There is no need to look more than one edge forward or backward. Even if there are edges which loop around to the same vertex (with a different vertexuse), that (0-length) edge is ON the ray.

Definition at line 551 of file nmg_fcut.c.

References BN_CK_TOL, bu_bomb(), BU_LIST_PNEXT_CIRC, BU_LIST_PPREV_CIRC, bu_log(), nmg_ray_state::left, NMG_CK_RAYSTATE, rt_g::NMG_debug, NMG_E_ASSESSMENT_ERROR, NMG_E_ASSESSMENT_LEFT, NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV, NMG_E_ASSESSMENT_RIGHT, nmg_is_v_on_rs_list(), nmg_pr_eu(), nmg_pr_vu_briefly(), out, RTG, SMALL_FASTF, nmg_ray_state::tol, OSL::Strings::v, V3ARGS, VSETALL, and nmg_ray_state::vu.

Referenced by nmg_assess_vu(), nmg_face_state_transition(), and nmg_onon_fix().

Here is the call graph for this function:

int nmg_assess_vu ( struct nmg_ray_state rs,
int  pos 
)
void nmg_pr_vu_stuff ( const struct nmg_vu_stuff vs)

Definition at line 811 of file nmg_fcut.c.

References bu_log(), nmg_vu_stuff::hi_ang, nmg_vu_stuff::in_vu_angle, nmg_vu_stuff::lo_ang, nmg_vu_stuff::loop_index, nmg_vu_stuff::lsp, nmg_vu_stuff::min_vu_dot, nmg_vu_stuff::out_vu_angle, nmg_vu_stuff::seq, nmg_vu_stuff::vu, nmg_vu_stuff::wedge_class, and WEDGECLASS2STR.

Here is the call graph for this function:

int nmg_wedge_class ( int  ass,
double  a,
double  b 
)

0 degrees is to the rear (ON_REV), 90 degrees is to the RIGHT, 180 is ON_FORW, 270 is to the LEFT. Determine if the given wedge is entirely to the left or right of the ray, or if it crosses.

"halfway X" (ha, hb) have these properties: < 0 (==> X < 180) RIGHT

0 (==> X > 180) LEFT

==0 (==> X == 180) ON_FORW

Returns - WEDGE_LEFT WEDGE_CROSSING WEDGE_RIGHT WEDGE_ON

Definition at line 841 of file nmg_fcut.c.

References bu_log(), NEAR_ZERO, rt_g::NMG_debug, NMG_E_ASSESSMENT_ON_FORW, NMG_E_ASSESSMENT_ON_REV, NMG_V_COMB, out, RTG, WEDGE_CROSS, WEDGE_LEFT, WEDGE_ON, WEDGE_RIGHT, and WEDGECLASS2STR.

Referenced by nmg_face_coincident_vu_sort().

Here is the call graph for this function:

void nmg_sanitize_fu ( struct faceuse *  fu)

Eliminate any OT_BOOLPLACE self-loops that remain behind in this face.

Definition at line 1860 of file nmg_fcut.c.

References bu_bomb(), BU_LIST_FIRST, BU_LIST_NOT_HEAD, BU_LIST_PNEXT, lu, NMG_CK_LOOPUSE(), and nmg_klu().

Here is the call graph for this function:

void nmg_face_rs_init ( struct nmg_ray_state rs,
struct bu_ptbl b,
struct faceuse *  fu1,
struct faceuse *  fu2,
fastf_t pt,
fastf_t dir,
struct edge_g_lseg *  eg,
const struct bn_tol tol 
)

Set up nmg_ray_state structure. "left" is a vector that lies in the plane of the face which contains the loops being operated on. It points in the direction "left" of the ray, such that the first OT_SAME loop in the first OT_SAME fact that it crosses will cross the ray in a left-to-right manner consistent with the CCW loop rule. There are some special conditions placed on the "dir" argument to make this happen; see the comments in nmg_inter.c for details, or Mike's notes "The 'Left' Vector Choice" dated 27-Aug-93, page 1.

Definition at line 1892 of file nmg_fcut.c.

References nmg_ray_state::ang_x_dir, nmg_ray_state::ang_y_dir, BN_CK_TOL, bu_bomb(), BU_CK_PTBL, BU_LIST_FIRST, BU_LIST_FIRST_MAGIC, BU_LIST_FOR, BU_LIST_PNEXT_CIRC, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl::buffer, nmg_ray_state::dir, nmg_ray_state::eg_p, bu_ptbl::end, nmg_ray_state::fu1, nmg_ray_state::fu2, HPRINT, nmg_ray_state::left, lu, nmg_ray_state::magic, memset(), rt_g::NMG_debug, nmg_orientation(), nmg_pr_eu_briefly(), nmg_pr_vu_briefly(), NMG_RAYSTATE_MAGIC, NMG_STATE_OUT, NMG_VERTEXUSE_MAGIC, nmg_ray_state::nvu, nmg_ray_state::pt, RTG, nmg_ray_state::sA, nmg_ray_state::sB, nmg_ray_state::state, nmg_ray_state::tol, V3ARGS, VPRINT, and nmg_ray_state::vu.

Referenced by nmg_face_cutjoin(), and nmg_fcut_face_2d().

Here is the call graph for this function:

void nmg_edge_geom_isect_line ( struct edgeuse *  eu,
struct nmg_ray_state rs,
const char *  reason 
)

Force the geometry structure for a given edge to be that of the intersection line between the two faces.

Note that sometimes a vertex can appear to lie on more than one line. It is important to refer to geometry here, to make sure that the edgeuse is not mistakenly fused to the wrong edge geometry.

XXX This has the byproduct that not all edgeuses "on" the line XXX of intersection will share rs->eg_p.

See the comments in nmg_radial_join_eu() for the rationale.

Definition at line 2006 of file nmg_fcut.c.

References bu_log(), nmg_ray_state::dir, nmg_ray_state::eg_p, NMG_CK_RAYSTATE, rt_g::NMG_debug, nmg_edge_g(), nmg_jeg(), nmg_use_edge_g(), out, nmg_ray_state::pt, and RTG.

Referenced by nmg_face_state_transition().

Here is the call graph for this function:

void nmg_unlist_v ( struct bu_ptbl b,
fastf_t mag,
struct vertex *  v 
)

Definition at line 2931 of file nmg_fcut.c.

References BU_CK_PTBL, BU_PTBL_END, BU_PTBL_GET, and MAX_FASTF.

Referenced by nmg_onon_fix().

int nmg_onon_fix ( struct nmg_ray_state rs,
struct bu_ptbl b,
struct bu_ptbl ob,
fastf_t mag,
fastf_t omag 
)

An attempt to fix the condition: nmg_assess_eu(): ON vertexuse in middle of edge?

Note that the vertexuse being zapped may have a lower subscript.

Must be called after vu list has been sorted.

Definition at line 2958 of file nmg_fcut.c.

References BU_CK_PTBL, bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl_rm(), nmg_assess_eu(), NMG_CK_RAYSTATE, rt_g::NMG_debug, NMG_LOOPUSE_MAGIC, nmg_unlist_v(), RTG, and OSL::Strings::v.

Here is the call graph for this function:

struct edge_g_lseg* nmg_face_cutjoin ( struct bu_ptbl b1,
struct bu_ptbl b2,
fastf_t mag1,
fastf_t mag2,
struct faceuse *  fu1,
struct faceuse *  fu2,
fastf_t pt,
fastf_t dir,
struct edge_g_lseg *  eg,
const struct bn_tol tol 
)

The main face cut handler. Called from nmg_inter.c by nmg_isect_2faces().

A wrapper for nmg_face_combine, for now.

The two vertexuse lists may be of different lengths, because one may have multiple uses of a vertex, while the other has only a single use of that same vertex.

Definition at line 3059 of file nmg_fcut.c.

References BN_CK_TOL, bu_bomb(), bu_log(), BU_PTBL_END, BU_PTBL_GET, bu_ptbl::buffer, bn_tol::dist, nmg_ray_state::eg_p, bu_ptbl::end, nmg_ck_vu_ptbl(), rt_g::NMG_debug, nmg_face_rs_init(), nmg_fcut_face(), nmg_find_fu_of_vu(), nmg_mesh_two_faces(), nmg_pr_vu_briefly(), ptbl_vsort(), RTG, and top().

Referenced by nmg_cut_lu_into_coplanar_and_non().

Here is the call graph for this function:

void nmg_fcut_face_2d ( struct bu_ptbl vu_list,
fastf_t mag,
struct faceuse *  fu1,
struct faceuse *  fu2,
struct bn_tol tol 
)

Definition at line 3190 of file nmg_fcut.c.

References BN_CK_TOL, BU_CK_PTBL, nmg_ray_state::dir, nmg_face_rs_init(), nmg_fcut_face(), nmg_ray_state::pt, VSET, and VSETALL.

Here is the call graph for this function: