50#define NMG_MISS_LIST 1
55#define HMG_INBOUND_STATE(_hm) (((_hm)->in_out & 0x0f0) >> 4)
56#define HMG_OUTBOUND_STATE(_hm) ((_hm)->in_out & 0x0f)
59#define NMG_RAY_STATE_INSIDE 1
60#define NMG_RAY_STATE_ON 2
61#define NMG_RAY_STATE_OUTSIDE 4
62#define NMG_RAY_STATE_ANY 8
64#define HMG_HIT_IN_IN 0x11
65#define HMG_HIT_IN_OUT 0x14
66#define HMG_HIT_OUT_IN 0x41
67#define HMG_HIT_OUT_OUT 0x44
68#define HMG_HIT_IN_ON 0x12
69#define HMG_HIT_ON_IN 0x21
70#define HMG_HIT_ON_ON 0x22
71#define HMG_HIT_OUT_ON 0x42
72#define HMG_HIT_ON_OUT 0x24
73#define HMG_HIT_ANY_ANY 0x88
75#define NMG_VERT_ENTER 1
76#define NMG_VERT_ENTER_LEAVE 0
77#define NMG_VERT_LEAVE -1
78#define NMG_VERT_UNKNOWN -2
80#define NMG_HITMISS_SEG_IN 0x696e00
81#define NMG_HITMISS_SEG_OUT 0x6f757400
83#define NMG_CK_RD(_rd) NMG_CKMAG(_rd, NMG_RAY_DATA_MAGIC, "ray data");
85#ifdef NO_BOMBING_MACROS
86# define NMG_CK_HITMISS(hm) (void)(hm)
88# define NMG_CK_HITMISS(hm) \
90 switch (hm->l.magic) { \
91 case NMG_RT_HIT_MAGIC: \
92 case NMG_RT_HIT_SUB_MAGIC: \
93 case NMG_RT_MISS_MAGIC: \
96 bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
97 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
100 bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
101 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
104 bu_log(CPP_FILELINE ": bad struct hitmiss magic: %u:(0x%08x)\n", \
105 hm->l.magic, hm->l.magic); \
106 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
108 if (!hm->hit.hit_private) { \
109 bu_log(CPP_FILELINE ": NULL hit_private in hitmiss struct\n"); \
110 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
115#ifdef NO_BOMBING_MACROS
116# define NMG_CK_HITMISS_LISTS(rd) (void)(rd)
118# define NMG_CK_HITMISS_LISTS(rd) \
120 struct nmg_hitmiss *_a_hit; \
121 for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_hit)) {NMG_CK_HITMISS(_a_hit);} \
122 for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_miss)) {NMG_CK_HITMISS(_a_hit);} \
128#define NMG_GET_HITMISS(_p) { \
129 bu_semaphore_acquire(BU_SEM_GENERAL); \
130 (_p) = BU_LIST_FIRST(nmg_hitmiss, &(re_nmgfree)); \
131 if (BU_LIST_IS_HEAD((_p), &(re_nmgfree))) \
132 BU_ALLOC((_p), struct nmg_hitmiss); \
134 BU_LIST_DEQUEUE(&((_p)->l)); \
135 bu_semaphore_release(BU_SEM_GENERAL); \
139#define NMG_FREE_HITLIST(_p) { \
140 BU_CK_LIST_HEAD((_p)); \
141 bu_semaphore_acquire(BU_SEM_GENERAL); \
142 BU_LIST_APPEND_LIST(&(re_nmgfree), (_p)); \
143 bu_semaphore_release(BU_SEM_GENERAL); \
146#ifdef NO_BOMBING_MACROS
147# define nmg_bu_bomb(rd, vlfree, str) (void)(rd)
149# define nmg_bu_bomb(rd, vlfree, str) { \
151 if (nmg_debug & NMG_DEBUG_NMGRT) bu_bomb("End of diagnostics"); \
152 BU_LIST_INIT(&rd->rd_hit); \
153 BU_LIST_INIT(&rd->rd_miss); \
154 nmg_debug |= NMG_DEBUG_NMGRT; \
155 nmg_isect_ray_model(rd,vlfree); \
156 bu_bomb("Should have bombed before this\n"); \
283 const struct bn_tol *tol);
Header file for the BRL-CAD common definitions.
int nmg_class_ray_vs_shell(struct nmg_ray *rp, const struct shell *s, const int in_or_out_only, struct bu_list *vlfree, const struct bn_tol *tol)
void nmg_isect_ray_model(struct nmg_ray_data *rd, struct bu_list *vlfree)
struct bu_list re_nmgfree
head of NMG hitmiss freelist
int ray_in_rpp(struct nmg_ray *rp, const fastf_t *invdir, const fastf_t *min, const fastf_t *max)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
double fastf_t
fastest 64-bit (or larger) floating point type
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Information about where a ray hits the surface.
vect_t hit_normal
DEPRECATED: Surface Normal at hit_point, use RT_HIT_NORMAL.
struct nmg_ray * hit_rayp
pointer to defining ray
point_t hit_point
DEPRECATED: Intersection point, use VJOIN1 hit_dist.
int hit_surfno
solid-specific surface indicator
vect_t hit_vpriv
PRIVATE vector for xxx_*()
fastf_t hit_dist
dist from r_pt to hit_point
void * hit_private
PRIVATE handle for xxx_shot()
struct nmg_hitmiss * other
for keeping track of the other end of the segment when we know it
fastf_t dist_in_plane
distance from plane intersect
int start_stop
is this a seg_in or seg_out
int in_out
status of ray as it transitions this hit point.
struct bu_list rd_hit
list of hit elements
struct nmg_hitmiss ** hitmiss
1 struct hitmiss ptr per elem.
char * manifolds
structure 1-3manifold table
const struct bn_tol * tol
struct bu_list rd_miss
list of missed/sub-hit elements
fastf_t ray_dist_to_plane
ray parametric dist to plane
point_t plane_pt
ray/plane(face) intercept point
point_t r_pt
Point at which ray starts.
fastf_t r_max
exit dist from bounding sphere
vect_t r_dir
Direction of ray (UNIT Length)
fastf_t r_min
entry dist to bounding sphere
struct nmg_hit seg_out
OUT information.
struct nmg_hit seg_in
IN information.
void * seg_stp
pointer back to soltab
fundamental vector, matrix, quaternion math macros