BRL-CAD

Partitions of a ray. More...

Collaboration diagram for The Partition Structure:

Files

file  ray_partition.h
 

Data Structures

struct  partition
 
struct  partition_list
 
struct  partition_bundle
 

Macros

#define PT_NULL   ((struct partition *)0)
 
#define RT_CHECK_PT(_p)   RT_CK_PT(_p)
 compat More...
 
#define RT_CK_PT(_p)   BU_CKMAG(_p, PT_MAGIC, "struct partition")
 
#define RT_CK_PARTITION(_p)   BU_CKMAG(_p, PT_MAGIC, "struct partition")
 
#define RT_CK_PT_HD(_p)   BU_CKMAG(_p, PT_HD_MAGIC, "struct partition list head")
 
#define RT_PT_MIDDLE_START   pt_inseg
 1st elem to copy More...
 
#define RT_PT_MIDDLE_END   pt_seglist.l.magic
 copy up to this elem (non-inclusive) More...
 
#define RT_PT_MIDDLE_LEN(p)    (((char *)&(p)->RT_PT_MIDDLE_END) - ((char *)&(p)->RT_PT_MIDDLE_START))
 
#define RT_DUP_PT(ip, new, old, res)
 
#define GET_PT_INIT(ip, p, res)
 
#define GET_PT(ip, p, res)
 
#define FREE_PT(p, res)
 
#define RT_FREE_PT_LIST(_headp, _res)
 
#define INSERT_PT(_new, _old)   BU_LIST_INSERT((struct bu_list *)_old, (struct bu_list *)_new)
 
#define APPEND_PT(_new, _old)   BU_LIST_APPEND((struct bu_list *)_old, (struct bu_list *)_new)
 
#define DEQUEUE_PT(_cur)   BU_LIST_DEQUEUE((struct bu_list *)_cur)
 

Functions

int rt_partition_len (const struct partition *partheadp)
 

Detailed Description

Partitions of a ray.

The partition structure contains information about intervals of the ray which pass through geometry. A partition consists of one or more segments, which are woven together via rt_boolweave to form the final "solid" partitions that describe solid segments of geometry along a given ray.

Macro Definition Documentation

◆ PT_NULL

#define PT_NULL   ((struct partition *)0)

Definition at line 68 of file ray_partition.h.

◆ RT_CHECK_PT

#define RT_CHECK_PT (   _p)    RT_CK_PT(_p)

compat

Definition at line 70 of file ray_partition.h.

◆ RT_CK_PT

#define RT_CK_PT (   _p)    BU_CKMAG(_p, PT_MAGIC, "struct partition")

Definition at line 71 of file ray_partition.h.

◆ RT_CK_PARTITION

#define RT_CK_PARTITION (   _p)    BU_CKMAG(_p, PT_MAGIC, "struct partition")

Definition at line 72 of file ray_partition.h.

◆ RT_CK_PT_HD

#define RT_CK_PT_HD (   _p)    BU_CKMAG(_p, PT_HD_MAGIC, "struct partition list head")

Definition at line 73 of file ray_partition.h.

◆ RT_PT_MIDDLE_START

#define RT_PT_MIDDLE_START   pt_inseg

1st elem to copy

Definition at line 76 of file ray_partition.h.

◆ RT_PT_MIDDLE_END

#define RT_PT_MIDDLE_END   pt_seglist.l.magic

copy up to this elem (non-inclusive)

Definition at line 77 of file ray_partition.h.

◆ RT_PT_MIDDLE_LEN

#define RT_PT_MIDDLE_LEN (   p)     (((char *)&(p)->RT_PT_MIDDLE_END) - ((char *)&(p)->RT_PT_MIDDLE_START))

Definition at line 78 of file ray_partition.h.

◆ RT_DUP_PT

#define RT_DUP_PT (   ip,
  new,
  old,
  res 
)
Value:
{ \
GET_PT(ip, new, res); \
memcpy((char *)(&(new)->RT_PT_MIDDLE_START), (char *)(&(old)->RT_PT_MIDDLE_START), RT_PT_MIDDLE_LEN(old)); \
(new)->pt_overlap_reg = NULL; \
bu_ptbl_cat(&(new)->pt_seglist, &(old)->pt_seglist); }
#define RT_PT_MIDDLE_LEN(p)
Definition: ray_partition.h:78
#define RT_PT_MIDDLE_START
1st elem to copy
Definition: ray_partition.h:76

Definition at line 81 of file ray_partition.h.

◆ GET_PT_INIT

#define GET_PT_INIT (   ip,
  p,
  res 
)
Value:
{\
GET_PT(ip, p, res); \
memset(((char *) &(p)->RT_PT_MIDDLE_START), 0, RT_PT_MIDDLE_LEN(p)); }

Clear out the pointers, empty the hit list

Definition at line 88 of file ray_partition.h.

◆ GET_PT

#define GET_PT (   ip,
  p,
  res 
)
Value:
{ \
if (BU_LIST_NON_EMPTY_P(p, partition, &res->re_parthead)) { \
BU_LIST_DEQUEUE((struct bu_list *)(p)); \
bu_ptbl_reset(&(p)->pt_seglist); \
} else { \
BU_ALLOC((p), struct partition); \
(p)->pt_magic = PT_MAGIC; \
bu_ptbl_init(&(p)->pt_seglist, 42, "pt_seglist ptbl"); \
(res)->re_partlen++; \
} \
res->re_partget++; }
#define BU_LIST_NON_EMPTY_P(p, structure, headp)
Definition: list.h:311
#define PT_MAGIC
Definition: magic.h:229
Definition: list.h:131

Definition at line 92 of file ray_partition.h.

◆ FREE_PT

#define FREE_PT (   p,
  res 
)
Value:
{ \
BU_LIST_APPEND(&(res->re_parthead), (struct bu_list *)(p)); \
if ((p)->pt_overlap_reg) { \
bu_free((void *)((p)->pt_overlap_reg), "pt_overlap_reg");\
(p)->pt_overlap_reg = NULL; \
} \
res->re_partfree++; }

Definition at line 104 of file ray_partition.h.

◆ RT_FREE_PT_LIST

#define RT_FREE_PT_LIST (   _headp,
  _res 
)
Value:
{ \
register struct partition *_pp, *_zap; \
for (_pp = (_headp)->pt_forw; _pp != (_headp);) { \
_zap = _pp; \
_pp = _pp->pt_forw; \
BU_LIST_DEQUEUE((struct bu_list *)(_zap)); \
FREE_PT(_zap, _res); \
} \
(_headp)->pt_forw = (_headp)->pt_back = (_headp); \
}
struct partition * pt_back
backwards link
Definition: ray_partition.h:57
struct partition * pt_forw
forwards link
Definition: ray_partition.h:56

Definition at line 112 of file ray_partition.h.

◆ INSERT_PT

#define INSERT_PT (   _new,
  _old 
)    BU_LIST_INSERT((struct bu_list *)_old, (struct bu_list *)_new)

Insert "new" partition in front of "old" partition. Note order change

Definition at line 124 of file ray_partition.h.

◆ APPEND_PT

#define APPEND_PT (   _new,
  _old 
)    BU_LIST_APPEND((struct bu_list *)_old, (struct bu_list *)_new)

Append "new" partition after "old" partition. Note arg order change

Definition at line 127 of file ray_partition.h.

◆ DEQUEUE_PT

#define DEQUEUE_PT (   _cur)    BU_LIST_DEQUEUE((struct bu_list *)_cur)

Dequeue "cur" partition from doubly-linked list

Definition at line 130 of file ray_partition.h.

Function Documentation

◆ rt_partition_len()

int rt_partition_len ( const struct partition partheadp)

Return the length of a partition linked list.