83 #define BN_CK_TOL(_p) BU_CKMAG(_p, BN_TOL_MAGIC, "bn_tol")
88 #define BN_TOL_INIT(_p) { \
89 (_p)->magic = BN_TOL_MAGIC; \
91 (_p)->dist_sq = 0.0; \
100 #define BN_TOL_INIT_ZERO { BN_TOL_MAGIC, 0.0, 0.0, 0.0, 1.0 }
105 #define BN_TOL_INIT_TOL {BN_TOL_MAGIC, BN_TOL_DIST, BN_TOL_DIST * BN_TOL_DIST, 1.0e-6, 1.0 - 1.0e-6 }
106 #define BN_TOL_INIT_SET_TOL(_p) { \
107 (_p)->magic = BN_TOL_MAGIC; \
108 (_p)->dist = BN_TOL_DIST; \
109 (_p)->dist_sq = BN_TOL_DIST * BN_TOL_DIST; \
110 (_p)->perp = 1.0e-6; \
111 (_p)->para = 1.0 - 1.0e-6; \
117 #define BN_TOL_IS_INITIALIZED(_p) (((struct bn_tol *)(_p) != (struct bn_tol *)0) && LIKELY((_p)->magic == BN_TOL_MAGIC))
122 #define BN_TOL_CPY(_d,_s) { \
123 (_d)->dist = (_s)->dist; \
124 (_d)->dist_sq = (_s)->dist_sq; \
125 (_d)->perp = (_s)->perp; \
126 (_d)->para = (_s)->para; \
132 #define BN_TOL_DIST 0.0005
138 #define BN_VECT_ARE_PARALLEL(_dot, _tol) \
139 (((_dot) <= -SMALL_FASTF) ? (NEAR_EQUAL((_dot), -1.0, (_tol)->perp)) : (NEAR_EQUAL((_dot), 1.0, (_tol)->perp)))
145 #define BN_VECT_ARE_PERP(_dot, _tol) \
146 (((_dot) < 0) ? ((-(_dot))<=(_tol)->perp) : ((_dot) <= (_tol)->perp))
Header file for the BRL-CAD common definitions.
Global registry of recognized magic numbers.
double dist_sq
dist * dist