BRL-CAD

Information about where a ray hits the surface. More...

Collaboration diagram for The Hit Structure:

Files

file  hit.h
 

Data Structures

struct  hit
 Information about where a ray hits the surface. More...
 
struct  curvature
 
struct  uvcoord
 

Macros

#define HIT_NULL   ((struct hit *)0)
 
#define RT_CK_HIT(_p)   BU_CKMAG(_p, RT_HIT_MAGIC, "struct hit")
 
#define RT_HIT_INIT_ZERO   { RT_HIT_MAGIC, 0.0, VINIT_ZERO, VINIT_ZERO, VINIT_ZERO, NULL, 0, NULL }
 
#define RT_HIT_NORMAL(_normal, _hitp, _stp, _unused, _flipflag)
 
#define CURVE_NULL   ((struct curvature *)0)
 
#define RT_CURVATURE_INIT_ZERO   { VINIT_ZERO, 0.0, 0.0 }
 
#define RT_CURVATURE(_curvp, _hitp, _flipflag, _stp)
 
#define RT_HIT_UVCOORD(ap, _stp, _hitp, uvp)
 

Functions

void rt_pr_hit (const char *str, const struct hit *hitp)
 
void rt_pr_hit_vls (struct bu_vls *v, const char *str, const struct hit *hitp)
 
void rt_pr_hitarray_vls (struct bu_vls *v, const char *str, const struct hit *hitp, int count)
 

Detailed Description

Information about where a ray hits the surface.

The hit structure contains information about an individual boundary/ray intersection.

This is the lowest level of intersection information returned by LIBRT's intersection logic. Generally, multiple hits are used by higher level routines to construct segments (per shape) and partitions (boolean evaluations of multiple segments which constitute the actual portion of the ray deemed to have passed through solid geometry.)

Macro Definition Documentation

◆ HIT_NULL

#define HIT_NULL   ((struct hit *)0)

Definition at line 71 of file hit.h.

◆ RT_CK_HIT

#define RT_CK_HIT (   _p)    BU_CKMAG(_p, RT_HIT_MAGIC, "struct hit")

Definition at line 72 of file hit.h.

◆ RT_HIT_INIT_ZERO

#define RT_HIT_INIT_ZERO   { RT_HIT_MAGIC, 0.0, VINIT_ZERO, VINIT_ZERO, VINIT_ZERO, NULL, 0, NULL }

Definition at line 73 of file hit.h.

◆ RT_HIT_NORMAL

#define RT_HIT_NORMAL (   _normal,
  _hitp,
  _stp,
  _unused,
  _flipflag 
)
Value:
{ \
RT_CK_HIT(_hitp); \
RT_CK_SOLTAB(_stp); \
RT_CK_FUNCTAB((_stp)->st_meth); \
{ \
void *_n = (void *)_normal; \
if ((_stp)->st_meth->ft_norm) { \
(_stp)->st_meth->ft_norm(_hitp, _stp, (_hitp)->hit_rayp); \
} \
if (_n != NULL) { \
int _f = (int)_flipflag; \
if (_f) { \
VREVERSE((fastf_t *)_normal, (_hitp)->hit_normal); \
} else { \
VMOVE((fastf_t *)_normal, (_hitp)->hit_normal); \
} \
} \
} \
}
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330

Compute normal into (_hitp)->hit_normal.

Set flip-flag accordingly depending on boolean logic, as one hit may be shared between multiple partitions with different flip status.

Example: box.r = box.s - sph.s; sph.r = sph.s

Return the post-boolean normal into caller-provided _normal vector.

Definition at line 86 of file hit.h.

◆ CURVE_NULL

#define CURVE_NULL   ((struct curvature *)0)

Definition at line 123 of file hit.h.

◆ RT_CURVATURE_INIT_ZERO

#define RT_CURVATURE_INIT_ZERO   { VINIT_ZERO, 0.0, 0.0 }

Definition at line 124 of file hit.h.

◆ RT_CURVATURE

#define RT_CURVATURE (   _curvp,
  _hitp,
  _flipflag,
  _stp 
)
Value:
{ \
RT_CK_HIT(_hitp); \
RT_CK_SOLTAB(_stp); \
RT_CK_FUNCTAB((_stp)->st_meth); \
if ((_stp)->st_meth->ft_curve) { \
(_stp)->st_meth->ft_curve(_curvp, _hitp, _stp); \
} \
if (_flipflag) { \
(_curvp)->crv_c1 = - (_curvp)->crv_c1; \
(_curvp)->crv_c2 = - (_curvp)->crv_c2; \
} \
}

Use this macro after having computed the normal, to compute the curvature at a hit point.

In Release 4.4 and earlier, this was called RT_CURVE(). When the extra argument was added the name was changed.

Definition at line 133 of file hit.h.

◆ RT_HIT_UVCOORD

#define RT_HIT_UVCOORD (   ap,
  _stp,
  _hitp,
  uvp 
)
Value:
{ \
RT_CK_HIT(_hitp); \
RT_CK_SOLTAB(_stp); \
RT_CK_FUNCTAB((_stp)->st_meth); \
if ((_stp)->st_meth->ft_uv) { \
(_stp)->st_meth->ft_uv(ap, _stp, _hitp, uvp); \
} \
}

Definition at line 158 of file hit.h.

Function Documentation

◆ rt_pr_hit()

void rt_pr_hit ( const char *  str,
const struct hit hitp 
)

◆ rt_pr_hit_vls()

void rt_pr_hit_vls ( struct bu_vls v,
const char *  str,
const struct hit hitp 
)

◆ rt_pr_hitarray_vls()

void rt_pr_hitarray_vls ( struct bu_vls v,
const char *  str,
const struct hit hitp,
int  count 
)