52#define NMG_MISS_LIST 1
57#define HMG_INBOUND_STATE(_hm) (((_hm)->in_out & 0x0f0) >> 4)
58#define HMG_OUTBOUND_STATE(_hm) ((_hm)->in_out & 0x0f)
61#define NMG_RAY_STATE_INSIDE 1
62#define NMG_RAY_STATE_ON 2
63#define NMG_RAY_STATE_OUTSIDE 4
64#define NMG_RAY_STATE_ANY 8
66#define HMG_HIT_IN_IN 0x11
67#define HMG_HIT_IN_OUT 0x14
68#define HMG_HIT_OUT_IN 0x41
69#define HMG_HIT_OUT_OUT 0x44
70#define HMG_HIT_IN_ON 0x12
71#define HMG_HIT_ON_IN 0x21
72#define HMG_HIT_ON_ON 0x22
73#define HMG_HIT_OUT_ON 0x42
74#define HMG_HIT_ON_OUT 0x24
75#define HMG_HIT_ANY_ANY 0x88
77#define NMG_VERT_ENTER 1
78#define NMG_VERT_ENTER_LEAVE 0
79#define NMG_VERT_LEAVE -1
80#define NMG_VERT_UNKNOWN -2
82#define NMG_HITMISS_SEG_IN 0x696e00
83#define NMG_HITMISS_SEG_OUT 0x6f757400
85#define NMG_CK_RD(_rd) NMG_CKMAG(_rd, NMG_RAY_DATA_MAGIC, "ray data");
87#ifdef NO_BOMBING_MACROS
88# define NMG_CK_HITMISS(hm) (void)(hm)
90# define NMG_CK_HITMISS(hm) \
92 switch (hm->l.magic) { \
93 case NMG_RT_HIT_MAGIC: \
94 case NMG_RT_HIT_SUB_MAGIC: \
95 case NMG_RT_MISS_MAGIC: \
98 bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
99 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
102 bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
103 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
106 bu_log(CPP_FILELINE ": bad struct hitmiss magic: %u:(0x%08x)\n", \
107 hm->l.magic, hm->l.magic); \
108 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
110 if (!hm->hit.hit_private) { \
111 bu_log(CPP_FILELINE ": NULL hit_private in hitmiss struct\n"); \
112 bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
117#ifdef NO_BOMBING_MACROS
118# define NMG_CK_HITMISS_LISTS(rd) (void)(rd)
120# define NMG_CK_HITMISS_LISTS(rd) \
122 struct nmg_hitmiss *_a_hit; \
123 for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_hit)) {NMG_CK_HITMISS(_a_hit);} \
124 for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_miss)) {NMG_CK_HITMISS(_a_hit);} \
130#define NMG_GET_HITMISS_RD(_rd, _p) { \
131 struct bu_list *_hmfree = (_rd)->hitmiss_free; \
133 (_p) = BU_LIST_FIRST(nmg_hitmiss, _hmfree); \
134 if (UNLIKELY(BU_LIST_IS_HEAD((_p), _hmfree))) \
135 bu_bomb("NMG hitmiss scratch exhausted\n"); \
137 BU_LIST_DEQUEUE(&((_p)->l)); \
139 bu_semaphore_acquire(BU_SEM_GENERAL); \
140 (_p) = BU_LIST_FIRST(nmg_hitmiss, &(re_nmgfree)); \
141 if (BU_LIST_IS_HEAD((_p), &(re_nmgfree))) \
142 BU_ALLOC((_p), struct nmg_hitmiss); \
144 BU_LIST_DEQUEUE(&((_p)->l)); \
145 bu_semaphore_release(BU_SEM_GENERAL); \
150#define NMG_FREE_HITLIST_RD(_rd, _p) { \
151 BU_CK_LIST_HEAD((_p)); \
152 if ((_rd)->hitmiss_free) { \
153 BU_LIST_APPEND_LIST((_rd)->hitmiss_free, (_p)); \
155 bu_semaphore_acquire(BU_SEM_GENERAL); \
156 BU_LIST_APPEND_LIST(&(re_nmgfree), (_p)); \
157 bu_semaphore_release(BU_SEM_GENERAL); \
162#define NMG_GET_HITMISS(_p) { \
163 bu_semaphore_acquire(BU_SEM_GENERAL); \
164 (_p) = BU_LIST_FIRST(nmg_hitmiss, &(re_nmgfree)); \
165 if (BU_LIST_IS_HEAD((_p), &(re_nmgfree))) \
166 BU_ALLOC((_p), struct nmg_hitmiss); \
168 BU_LIST_DEQUEUE(&((_p)->l)); \
169 bu_semaphore_release(BU_SEM_GENERAL); \
172#define NMG_FREE_HITLIST(_p) { \
173 BU_CK_LIST_HEAD((_p)); \
174 bu_semaphore_acquire(BU_SEM_GENERAL); \
175 BU_LIST_APPEND_LIST(&(re_nmgfree), (_p)); \
176 bu_semaphore_release(BU_SEM_GENERAL); \
179#ifdef NO_BOMBING_MACROS
180# define nmg_bu_bomb(rd, vlfree, str) (void)(rd)
182# define nmg_bu_bomb(rd, vlfree, str) { \
184 if (nmg_debug & NMG_DEBUG_NMGRT) bu_bomb("End of diagnostics"); \
185 BU_LIST_INIT(&rd->rd_hit); \
186 BU_LIST_INIT(&rd->rd_miss); \
187 nmg_debug |= NMG_DEBUG_NMGRT; \
188 nmg_isect_ray_model(rd,vlfree); \
189 bu_bomb("Should have bombed before this\n"); \
320 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 bu_list * hitmiss_free
optional worker-local freelist
struct nmg_hitmiss ** hitmiss
1 struct hitmiss ptr per elem.
struct nmg_class_scratch * class_scratch
optional point-classifier scratch
char * manifolds
structure 1-3manifold table
const struct bn_tol * tol
struct bu_list rd_miss
list of missed/sub-hit elements
struct bu_ptbl * hitstate[2]
optional state-transition scratch
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