void diff_init_result(struct diff_result *result, const struct bn_tol *curr_diff_tol, const char *obj_name) { if (!result) return; if (obj_name) { result->obj_name = bu_strdup(obj_name); } else { result->obj_name = NULL; } result->dp_left = RT_DIR_NULL; result->dp_ancestor = RT_DIR_NULL; result->dp_right = RT_DIR_NULL; result->param_state = DIFF_EMPTY; result->attr_state = DIFF_EMPTY; BU_GET(result->diff_tol, struct bn_tol); if (curr_diff_tol) { (result)->diff_tol->magic = BN_TOL_MAGIC; (result)->diff_tol->dist = curr_diff_tol->dist; (result)->diff_tol->dist_sq = curr_diff_tol->dist_sq; (result)->diff_tol->perp = curr_diff_tol->perp; (result)->diff_tol->para = curr_diff_tol->para; } else { BN_TOL_INIT(result->diff_tol); } BU_GET(result->param_diffs, struct bu_ptbl); BU_GET(result->attr_diffs, struct bu_ptbl); BU_PTBL_INIT(result->param_diffs); BU_PTBL_INIT(result->attr_diffs); }
struct bn_tol * rt_tol_default(struct bn_tol *tol) { if (!tol) { BU_ALLOC(tol, struct bn_tol); BN_TOL_INIT(tol); } BN_CK_TOL(tol); tol->dist = 0.0005; tol->dist_sq = tol->dist * tol->dist; tol->perp = 1e-6; tol->para = 1 - tol->perp; return tol; }