b311480e |
1 | // Created on: 1993-03-08 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | //======================================================================= |
18 | //function : Angular |
19 | //purpose : |
20 | //======================================================================= |
21 | |
22 | inline Standard_Real Precision::Angular() |
23 | { |
24 | #ifdef PRECISION_OBSOLETE |
25 | static const Standard_Real Precision_Angular = 1.e-12; |
26 | return Precision_Angular; |
27 | #else |
28 | return 1.e-12; |
29 | #endif |
30 | } |
31 | |
32 | |
33 | //======================================================================= |
34 | //function : Confusion |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | inline Standard_Real Precision::Confusion() |
39 | { |
40 | #ifdef PRECISION_OBSOLETE |
41 | static const Standard_Real Precision_Confusion = 1.e-7; |
42 | return Precision_Confusion; |
43 | #else |
44 | return 1.e-7; |
45 | #endif |
46 | } |
47 | |
48 | |
49 | //======================================================================= |
08cd2f6b |
50 | //function : SquareConfusion |
51 | //purpose : |
52 | //======================================================================= |
53 | inline Standard_Real Precision::SquareConfusion() |
54 | { |
55 | return Confusion() * Confusion(); |
56 | } |
57 | |
58 | |
59 | //======================================================================= |
7fd59977 |
60 | //function : Intersection |
61 | //purpose : |
62 | //======================================================================= |
63 | |
64 | inline Standard_Real Precision::Intersection() |
65 | { |
66 | #ifdef PRECISION_OBSOLETE |
67 | static const Standard_Real Precision_Intersection = Precision::Confusion() / 100.; |
68 | return Precision_Intersection; |
69 | #else |
70 | return Confusion() * 0.01; |
71 | #endif |
72 | } |
73 | |
74 | |
75 | //======================================================================= |
76 | //function : Approximation |
77 | //purpose : |
78 | //======================================================================= |
79 | |
80 | inline Standard_Real Precision::Approximation() |
81 | { |
82 | #ifdef PRECISION_OBSOLETE |
83 | static const Standard_Real Precision_Approximation = Precision::Confusion() * 10.; |
84 | return Precision_Approximation; |
85 | #else |
86 | return Confusion() * 10.; |
87 | #endif |
88 | } |
89 | |
90 | |
91 | //======================================================================= |
92 | //function : Parametric |
93 | //purpose : |
94 | //======================================================================= |
95 | |
96 | inline Standard_Real Precision::Parametric(const Standard_Real P, |
97 | const Standard_Real T) |
98 | { |
99 | return P / T; |
100 | } |
101 | |
102 | |
103 | //======================================================================= |
104 | //function : PConfusion |
105 | //purpose : |
106 | //======================================================================= |
107 | |
108 | inline Standard_Real Precision::PConfusion(const Standard_Real T) |
109 | { |
110 | return Parametric(Confusion(),T); |
111 | } |
112 | |
113 | |
114 | //======================================================================= |
115 | //function : PIntersection |
116 | //purpose : |
117 | //======================================================================= |
118 | |
119 | inline Standard_Real Precision::PIntersection(const Standard_Real T) |
120 | { |
121 | return Parametric(Intersection(),T); |
122 | } |
123 | |
124 | |
125 | //======================================================================= |
126 | //function : PApproximation |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | inline Standard_Real Precision::PApproximation(const Standard_Real T) |
131 | { |
132 | return Parametric(Approximation(),T); |
133 | } |
134 | |
135 | //======================================================================= |
136 | //function : Parametric |
137 | //purpose : |
138 | //======================================================================= |
139 | |
140 | inline Standard_Real Precision::Parametric(const Standard_Real P) |
141 | { |
142 | #ifdef PRECISION_OBSOLETE |
143 | static const Standard_Real Precision_DefTangent = 1.e+2; |
144 | return Parametric(P,Precision_DefTangent); |
145 | #else |
146 | return Parametric(P, 100.); |
147 | #endif |
148 | } |
149 | |
150 | |
151 | //======================================================================= |
152 | //function : PConfusion |
153 | //purpose : |
154 | //======================================================================= |
155 | |
156 | inline Standard_Real Precision::PConfusion() |
157 | { |
158 | return Parametric(Confusion()); |
159 | } |
160 | |
161 | |
162 | //======================================================================= |
163 | //function : PIntersection |
164 | //purpose : |
165 | //======================================================================= |
166 | |
167 | inline Standard_Real Precision::PIntersection() |
168 | { |
169 | return Parametric(Intersection()); |
170 | } |
171 | |
172 | |
173 | //======================================================================= |
174 | //function : PApproximation |
175 | //purpose : |
176 | //======================================================================= |
177 | |
178 | inline Standard_Real Precision::PApproximation() |
179 | { |
180 | return Parametric(Approximation()); |
181 | } |
182 | |
183 | //======================================================================= |
184 | //function : IsInfinite |
185 | //purpose : |
186 | //======================================================================= |
187 | |
188 | inline Standard_Boolean Precision::IsInfinite(const Standard_Real R) |
189 | { |
190 | return Abs(R) >= (0.5*Precision::Infinite()); |
191 | } |
192 | |
193 | //======================================================================= |
194 | //function : IsPositiveInfinite |
195 | //purpose : |
196 | //======================================================================= |
197 | |
198 | inline Standard_Boolean Precision::IsPositiveInfinite(const Standard_Real R) |
199 | { |
200 | return R >= (0.5*Precision::Infinite()); |
201 | } |
202 | |
203 | //======================================================================= |
204 | //function : IsNegativeInfinite |
205 | //purpose : |
206 | //======================================================================= |
207 | |
208 | inline Standard_Boolean Precision::IsNegativeInfinite(const Standard_Real R) |
209 | { |
210 | return R <= -(0.5*Precision::Infinite()); |
211 | } |
212 | |
213 | |
214 | //======================================================================= |
215 | //function : Infinite |
216 | //purpose : |
217 | //======================================================================= |
218 | |
219 | inline Standard_Real Precision::Infinite() |
220 | { |
221 | #ifdef PRECISION_OBSOLETE |
222 | static const Standard_Real Precision_Infinite = 1.e+100; |
223 | static const Standard_Real Precision_InfiniteValue = 2 * Precision_Infinite; |
224 | return Precision_InfiniteValue; |
225 | #else |
226 | return 2.e+100; |
227 | #endif |
228 | } |
229 | |