BRL-CAD
tol.c
Go to the documentation of this file.
1 /* T O L . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2011-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #include "tol.h"
22 
23 
24 struct bn_tol *
25 rt_tol_default(struct bn_tol *tol)
26 {
27  if (!tol) {
28  BU_ALLOC(tol, struct bn_tol);
29  BN_TOL_INIT(tol);
30  }
31 
32  BN_CK_TOL(tol);
33 
34  tol->dist = 0.0005;
35  tol->dist_sq = tol->dist * tol->dist;
36  tol->perp = 1e-6;
37  tol->para = 1 - tol->perp;
38 
39  return tol;
40 }
41 
42 
43 /*
44  * Local Variables:
45  * tab-width: 8
46  * mode: C
47  * indent-tabs-mode: t
48  * c-file-style: "stroustrup"
49  * End:
50  * ex: shiftwidth=4 tabstop=8
51  */
#define BN_TOL_INIT(_p)
Definition: tol.h:87
double dist
>= 0
Definition: tol.h:73
double dist_sq
dist * dist
Definition: tol.h:74
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
Support for uniform tolerances.
Definition: tol.h:71
#define BN_CK_TOL(_p)
Definition: tol.h:82
double perp
nearly 0
Definition: tol.h:75
struct bn_tol * rt_tol_default(struct bn_tol *tol)
Definition: tol.c:25
double para
nearly 1
Definition: tol.h:76