BRL-CAD
|
Support for uniform tolerances. More...
Files | |
file | tol.h |
Data Structures | |
struct | bn_tol |
Macros | |
#define | BN_CK_TOL(_p) BU_CKMAG(_p, BN_TOL_MAGIC, "bn_tol") |
#define | BN_TOL_INIT(_p) |
#define | BN_TOL_INIT_ZERO { BN_TOL_MAGIC, 0.0, 0.0, 0.0, 1.0 } |
#define | BN_TOL_IS_INITIALIZED(_p) (((struct bn_tol *)(_p) != (struct bn_tol *)0) && LIKELY((_p)->magic == BN_TOL_MAGIC)) |
#define | BN_TOL_DIST 0.0005 |
#define | BN_VECT_ARE_PARALLEL(_dot, _tol) (((_dot) <= -SMALL_FASTF) ? (NEAR_EQUAL((_dot), -1.0, (_tol)->perp)) : (NEAR_EQUAL((_dot), 1.0, (_tol)->perp))) |
#define | BN_VECT_ARE_PERP(_dot, _tol) (((_dot) < 0) ? ((-(_dot))<=(_tol)->perp) : ((_dot) <= (_tol)->perp)) |
Support for uniform tolerances.
A handy way of passing around the tolerance information needed to perform approximate floating-point calculations on geometry.
dist & dist_sq establish the distance tolerance.
If two points are closer together than dist, then they are to be considered the same point.
For example:
perp & para establish the angular tolerance.
If two rays emanate from the same point, and their dot product is nearly one, then the two rays are the same, while if their dot product is nearly zero, then they are perpendicular.
For example:
#define BN_CK_TOL | ( | _p | ) | BU_CKMAG(_p, BN_TOL_MAGIC, "bn_tol") |
#define BN_TOL_INIT | ( | _p | ) |
initializes a bn_tol struct to zero without allocating any memory.
#define BN_TOL_INIT_ZERO { BN_TOL_MAGIC, 0.0, 0.0, 0.0, 1.0 } |
#define BN_TOL_IS_INITIALIZED | ( | _p | ) | (((struct bn_tol *)(_p) != (struct bn_tol *)0) && LIKELY((_p)->magic == BN_TOL_MAGIC)) |
#define BN_TOL_DIST 0.0005 |
#define BN_VECT_ARE_PARALLEL | ( | _dot, | |
_tol | |||
) | (((_dot) <= -SMALL_FASTF) ? (NEAR_EQUAL((_dot), -1.0, (_tol)->perp)) : (NEAR_EQUAL((_dot), 1.0, (_tol)->perp))) |