BRL-CAD
Ray/NMG Intersection

Support for intersecting geometric rays with NMG models. More...

Collaboration diagram for Ray/NMG Intersection:

Files

file  ray.h
 

Data Structures

struct  nmg_ray
 
struct  nmg_hit
 
struct  nmg_seg
 
struct  nmg_hitmiss
 
struct  nmg_ray_data
 

Macros

#define NMG_HIT_LIST   0
 
#define NMG_MISS_LIST   1
 
#define HMG_INBOUND_STATE(_hm)   (((_hm)->in_out & 0x0f0) >> 4)
 
#define HMG_OUTBOUND_STATE(_hm)   ((_hm)->in_out & 0x0f)
 
#define NMG_RAY_STATE_INSIDE   1
 
#define NMG_RAY_STATE_ON   2
 
#define NMG_RAY_STATE_OUTSIDE   4
 
#define NMG_RAY_STATE_ANY   8
 
#define HMG_HIT_IN_IN   0x11
 hit internal structure More...
 
#define HMG_HIT_IN_OUT   0x14
 breaking out More...
 
#define HMG_HIT_OUT_IN   0x41
 breaking in More...
 
#define HMG_HIT_OUT_OUT   0x44
 edge/vertex graze More...
 
#define HMG_HIT_IN_ON   0x12
 
#define HMG_HIT_ON_IN   0x21
 
#define HMG_HIT_ON_ON   0x22
 
#define HMG_HIT_OUT_ON   0x42
 
#define HMG_HIT_ON_OUT   0x24
 
#define HMG_HIT_ANY_ANY   0x88
 hit on non-3-manifold More...
 
#define NMG_VERT_ENTER   1
 
#define NMG_VERT_ENTER_LEAVE   0
 
#define NMG_VERT_LEAVE   -1
 
#define NMG_VERT_UNKNOWN   -2
 
#define NMG_HITMISS_SEG_IN   0x696e00
 "in" More...
 
#define NMG_HITMISS_SEG_OUT   0x6f757400
 "out" More...
 
#define NMG_CK_RD(_rd)   NMG_CKMAG(_rd, NMG_RAY_DATA_MAGIC, "ray data");
 
#define NMG_CK_HITMISS(hm)
 
#define NMG_CK_HITMISS_LISTS(rd)
 
#define NMG_GET_HITMISS(_p)
 
#define NMG_FREE_HITLIST(_p)
 
#define nmg_bu_bomb(rd, vlfree, str)
 
#define HIT   1
 a hit on a face More...
 
#define MISS   0
 a miss on the face More...
 

Functions

int ray_in_rpp (struct nmg_ray *rp, const fastf_t *invdir, const fastf_t *min, const fastf_t *max)
 
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)
 

Variables

struct bu_list re_nmgfree
 head of NMG hitmiss freelist More...
 

Detailed Description

Support for intersecting geometric rays with NMG models.

TODO - these structs and ray_in_rpp are versions of librt functionality, and we need to think about how/where to merge them into a common function and struct that are available to both libraries without introducing a coupling dependency.

Macro Definition Documentation

◆ NMG_HIT_LIST

#define NMG_HIT_LIST   0

Definition at line 48 of file ray.h.

◆ NMG_MISS_LIST

#define NMG_MISS_LIST   1

Definition at line 49 of file ray.h.

◆ HMG_INBOUND_STATE

#define HMG_INBOUND_STATE (   _hm)    (((_hm)->in_out & 0x0f0) >> 4)

Definition at line 54 of file ray.h.

◆ HMG_OUTBOUND_STATE

#define HMG_OUTBOUND_STATE (   _hm)    ((_hm)->in_out & 0x0f)

Definition at line 55 of file ray.h.

◆ NMG_RAY_STATE_INSIDE

#define NMG_RAY_STATE_INSIDE   1

Definition at line 58 of file ray.h.

◆ NMG_RAY_STATE_ON

#define NMG_RAY_STATE_ON   2

Definition at line 59 of file ray.h.

◆ NMG_RAY_STATE_OUTSIDE

#define NMG_RAY_STATE_OUTSIDE   4

Definition at line 60 of file ray.h.

◆ NMG_RAY_STATE_ANY

#define NMG_RAY_STATE_ANY   8

Definition at line 61 of file ray.h.

◆ HMG_HIT_IN_IN

#define HMG_HIT_IN_IN   0x11

hit internal structure

Definition at line 63 of file ray.h.

◆ HMG_HIT_IN_OUT

#define HMG_HIT_IN_OUT   0x14

breaking out

Definition at line 64 of file ray.h.

◆ HMG_HIT_OUT_IN

#define HMG_HIT_OUT_IN   0x41

breaking in

Definition at line 65 of file ray.h.

◆ HMG_HIT_OUT_OUT

#define HMG_HIT_OUT_OUT   0x44

edge/vertex graze

Definition at line 66 of file ray.h.

◆ HMG_HIT_IN_ON

#define HMG_HIT_IN_ON   0x12

Definition at line 67 of file ray.h.

◆ HMG_HIT_ON_IN

#define HMG_HIT_ON_IN   0x21

Definition at line 68 of file ray.h.

◆ HMG_HIT_ON_ON

#define HMG_HIT_ON_ON   0x22

Definition at line 69 of file ray.h.

◆ HMG_HIT_OUT_ON

#define HMG_HIT_OUT_ON   0x42

Definition at line 70 of file ray.h.

◆ HMG_HIT_ON_OUT

#define HMG_HIT_ON_OUT   0x24

Definition at line 71 of file ray.h.

◆ HMG_HIT_ANY_ANY

#define HMG_HIT_ANY_ANY   0x88

hit on non-3-manifold

Definition at line 72 of file ray.h.

◆ NMG_VERT_ENTER

#define NMG_VERT_ENTER   1

Definition at line 74 of file ray.h.

◆ NMG_VERT_ENTER_LEAVE

#define NMG_VERT_ENTER_LEAVE   0

Definition at line 75 of file ray.h.

◆ NMG_VERT_LEAVE

#define NMG_VERT_LEAVE   -1

Definition at line 76 of file ray.h.

◆ NMG_VERT_UNKNOWN

#define NMG_VERT_UNKNOWN   -2

Definition at line 77 of file ray.h.

◆ NMG_HITMISS_SEG_IN

#define NMG_HITMISS_SEG_IN   0x696e00

"in"

Definition at line 79 of file ray.h.

◆ NMG_HITMISS_SEG_OUT

#define NMG_HITMISS_SEG_OUT   0x6f757400

"out"

Definition at line 80 of file ray.h.

◆ NMG_CK_RD

#define NMG_CK_RD (   _rd)    NMG_CKMAG(_rd, NMG_RAY_DATA_MAGIC, "ray data");

Definition at line 82 of file ray.h.

◆ NMG_CK_HITMISS

#define NMG_CK_HITMISS (   hm)
Value:
{\
switch (hm->l.magic) { \
break; \
case NMG_MISS_LIST: \
bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
break; \
case NMG_HIT_LIST: \
bu_log(CPP_FILELINE ": struct hitmiss has NMG_MISS_LIST magic #\n"); \
bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
break; \
default: \
bu_log(CPP_FILELINE ": bad struct hitmiss magic: %u:(0x%08x)\n", \
hm->l.magic, hm->l.magic); \
bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
}\
if (!hm->hit.hit_private) { \
bu_log(CPP_FILELINE ": NULL hit_private in hitmiss struct\n"); \
bu_bomb("NMG_CK_HITMISS: going down in flames\n"); \
} \
}
#define NMG_RT_HIT_SUB_MAGIC
Definition: magic.h:155
#define NMG_RT_HIT_MAGIC
Definition: magic.h:154
#define NMG_RT_MISS_MAGIC
Definition: magic.h:156
#define CPP_FILELINE
Definition: common.h:615
#define NMG_MISS_LIST
Definition: ray.h:49
#define NMG_HIT_LIST
Definition: ray.h:48

Definition at line 87 of file ray.h.

◆ NMG_CK_HITMISS_LISTS

#define NMG_CK_HITMISS_LISTS (   rd)
Value:
{ \
struct nmg_hitmiss *_a_hit; \
for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_hit)) {NMG_CK_HITMISS(_a_hit);} \
for (BU_LIST_FOR(_a_hit, nmg_hitmiss, &rd->rd_miss)) {NMG_CK_HITMISS(_a_hit);} \
}
#define BU_LIST_FOR(p, structure, headp)
Definition: list.h:379
#define NMG_CK_HITMISS(hm)
Definition: ray.h:87

Definition at line 117 of file ray.h.

◆ NMG_GET_HITMISS

#define NMG_GET_HITMISS (   _p)
Value:
{ \
if (BU_LIST_IS_HEAD((_p), &(re_nmgfree))) \
BU_ALLOC((_p), struct nmg_hitmiss); \
BU_LIST_DEQUEUE(&((_p)->l)); \
}
#define BU_LIST_DEQUEUE(cur)
Definition: list.h:223
#define BU_LIST_FIRST(structure, headp)
Definition: list.h:326
#define BU_LIST_IS_HEAD(p, headp)
Definition: list.h:336
struct bu_list re_nmgfree
head of NMG hitmiss freelist

Definition at line 125 of file ray.h.

◆ NMG_FREE_HITLIST

#define NMG_FREE_HITLIST (   _p)
Value:
{ \
BU_CK_LIST_HEAD((_p)); \
BU_LIST_APPEND_LIST(&(re_nmgfree), (_p)); \
}

Definition at line 134 of file ray.h.

◆ nmg_bu_bomb

#define nmg_bu_bomb (   rd,
  vlfree,
  str 
)
Value:
{ \
bu_log("%s", str); \
if (nmg_debug & NMG_DEBUG_NMGRT) bu_bomb("End of diagnostics"); \
BU_LIST_INIT(&rd->rd_hit); \
BU_LIST_INIT(&rd->rd_miss); \
nmg_debug |= NMG_DEBUG_NMGRT; \
nmg_isect_ray_model(rd,vlfree); \
bu_bomb("Should have bombed before this\n"); \
}
NORETURN void bu_bomb(const char *str)
#define NMG_DEBUG_NMGRT
17 ray tracing
Definition: debug.h:53
uint32_t nmg_debug
debug bits for NMG's

Definition at line 142 of file ray.h.

◆ HIT

#define HIT   1

a hit on a face

Definition at line 154 of file ray.h.

◆ MISS

#define MISS   0

a miss on the face

Definition at line 155 of file ray.h.

Function Documentation

◆ ray_in_rpp()

int ray_in_rpp ( struct nmg_ray rp,
const fastf_t invdir,
const fastf_t min,
const fastf_t max 
)

◆ nmg_class_ray_vs_shell()

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 
)

◆ nmg_isect_ray_model()

void nmg_isect_ray_model ( struct nmg_ray_data rd,
struct bu_list vlfree 
)

Variable Documentation

◆ re_nmgfree

struct bu_list re_nmgfree
extern

head of NMG hitmiss freelist