ITK Function Reference
(V10000.1.0.60_20160308.00)
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
eq.h
Go to the documentation of this file.
1
/*HEAD EQ HHH UGMATH */
2
/*
3
*===============================================================================
4
*
5
* Copyright (c) 1993-2001 Unigraphics Solutions Inc.
6
* Unpublished - All rights reserved
7
*
8
*===============================================================================
9
*
10
* Header file defining macros used to detected equality between scalars
11
* of double or FREAL data type. NOTE: there is a fortran insert file eq.ins
12
* if you make changes here, check eq.ins to see if changes are required there.
13
*
14
*===============================================================================
15
* Date Name
16
* 17-Aug-1993 Dennis Lavarini
17
* 06-Jan-1994 Dennis Lavarini Add hooks to part/system specific tolerances
18
* 09-Mar-1994 Keith Hafen Add EQ_MAX_DBL and EQ_MIN_DBL tolerances
19
* 15-Mar-1996 William Vittitow Add EQ_is_finite
20
* 13-Feb-1997 Jack Marr Allow EQ_is_equal to work with tol=0.0
21
* 17-Sep-1998 Reger Enforce macro signatures under QAZ
22
* 17-Feb-1999 Reger Decorate UGMATH prototypes with UGEXPORT;
23
* include 'unidefs.h' for 'UGEXPORT'
24
* 18-Aug-1999 Lavarini Replace UGEXPORT with UGMATHEXPORT
25
* Move to UGMATH
26
* 18-Oct-1999 Lavarini Allow EQ_is_zero to work with tol=0.0
27
* 08-Dec-2000 Jim Lyles Added EQ_is_eq, EQ_is_ne, EQ_is_2tol_eq, and
28
* EQ_is_2tol_ne.
29
$HISTORY$
30
*
31
*===============================================================================
32
*
33
* In the following macro definitions, these conventions are used:
34
* Inputs:
35
* s, t, and tol are scalars of data type double
36
* pos_tol and neg_tol are also scalars of data type double
37
*
38
* Outputs:
39
* There is no data type output
40
*
41
* Macro Action Description
42
* EQ_TOL_NUMBER (function call) Return the part's numerical tol
43
* EQ_TOL_LENGTH (function call) Return the part's length tol
44
* EQ_TOL_LENGTH_SQ (function call) Return the part's length squared
45
* tol
46
* EQ_ask_systol (1.0e-10) Return system tolerance
47
* EQ_is_equal(s, t, tol) (abs(s-t) <= tol) Return true if scalars are equal
48
* EQ_is_eq(s, t, tol) (abs(s-t) <= tol) Same as EQ_is_equal
49
* EQ_is_ge(s, t, tol) (s > t - tol) Return true if s is greater than
50
* or equal to t
51
* EQ_is_gt(s, t, tol) (s > t + tol) Return true if s is greater than t
52
* EQ_is_le(s, t, tol) (s < t + tol) Return true if s is less than or
53
* equal to t
54
* EQ_is_lt(s, t, tol) (s < t - tol) Return true if s is less than t
55
* EQ_is_ne(s, t, tol) (abs(s-t) > tol) Return true if scalars are not
56
* equal
57
* EQ_is_2tol_eq(s, t, pos_tol, neg_tol) Return true if s is inside
58
* ((s >= t - neg_tol) && the range (t - neg_tol)
59
* (s <= t + pos_tol)) through (t + pos_tol)
60
* EQ_is_2tol_ne(s, t, pos_tol, neg_tol) Return true if s is outside
61
* ((s < t - neg_tol) || the range (t - neg_tol)
62
* (s > t + pos_tol)) through (t + pos_tol)
63
* EQ_is_zero(s, tol) (abs(s) <= tol) Return true if scalar is zero
64
* EQ_MAX_DBL (1.0e19) Maximum number valid for distance
65
* operations. EQ_MAX_DBL**2 is a
66
* valid value on all platforms.
67
* EQ_MIN_DBL (1.0e-19) Minimum number that can be used
68
* as a divisor, EQ_MAX_DBL/EQ_MIN_DBL
69
* is still a valid number on all
70
* platforms.
71
* EQ_is_finite(s) (abs(s) < EQ_MAX_DBL) Return true if scalar is
72
* finite on all platforms.
73
*/
74
75
#ifndef EQ_H_INCLUDED
76
#define EQ_H_INCLUDED
77
78
#include <math.h>
79
#include <libugmath_exports.h>
80
81
#define EQ_TOL_NUMBER (EQ_ask_number_tolerance())
82
#define EQ_TOL_LENGTH (EQ_ask_length_tolerance())
83
#define EQ_TOL_LENGTH_SQ (EQ_ask_length_squared_tolerance())
84
#define EQ_MAX_DBL (1.0e19)
85
#define EQ_MIN_DBL (1.0e-19)
86
87
#define EQ_ask_systol (1.0e-10)
88
89
#ifdef __lint
90
91
extern
logical
EQ_is_equal
(
double
s ,
double
t ,
double
tol );
92
extern
logical
EQ_is_eq
(
double
s,
double
t,
double
tol );
93
extern
logical
EQ_is_ge
(
double
s ,
double
t ,
double
tol );
94
extern
logical
EQ_is_gt
(
double
s ,
double
t ,
double
tol );
95
extern
logical
EQ_is_le
(
double
s ,
double
t ,
double
tol );
96
extern
logical
EQ_is_lt
(
double
s ,
double
t ,
double
tol );
97
extern
logical
EQ_is_ne
(
double
s,
double
t,
double
tol );
98
extern
logical
EQ_is_2tol_eq
(
double
s,
double
t,
99
double
pos_tol,
double
neg_tol );
100
extern
logical
EQ_is_2tol_ne
(
double
s,
double
t,
101
double
pos_tol,
double
neg_tol );
102
extern
logical
EQ_is_zero
(
double
s ,
double
tol );
103
extern
logical
EQ_is_finite
(
double
s );
104
105
#else
106
107
#define EQ_is_equal(s, t, tol) (fabs ((s) - (t)) <= (tol))
108
#define EQ_is_eq(s, t, tol) (EQ_is_equal( s, t, tol ))
109
#define EQ_is_ge(s, t, tol) ((s) > ((t) - (tol)))
110
#define EQ_is_gt(s, t, tol) ((s) > ((t) + (tol)))
111
#define EQ_is_le(s, t, tol) ((s) < ((t) + (tol)))
112
#define EQ_is_lt(s, t, tol) ((s) < ((t) - (tol)))
113
#define EQ_is_ne(s, t, tol) (! EQ_is_equal(s, t, tol))
114
#define EQ_is_2tol_eq(s, t, pos_tol, neg_tol) \
115
(EQ_is_ge(s, t, neg_tol) && \
116
EQ_is_le(s, t, pos_tol))
117
#define EQ_is_2tol_ne(s, t, pos_tol, neg_tol) \
118
(! EQ_is_2tol_eq(s, t, pos_tol, neg_tol))
119
#define EQ_is_zero(s, tol) (fabs ((s)) <= (tol))
120
#define EQ_is_finite(s) (fabs ((s)) < EQ_MAX_DBL)
121
122
#endif
123
124
/*
125
* Proto-types for the part specific tolerance values
126
*/
127
extern
UGMATHEXPORT
double
EQ_ask_number_tolerance
(
void
);
128
extern
UGMATHEXPORT
double
EQ_ask_length_tolerance
(
void
);
129
extern
UGMATHEXPORT
double
EQ_ask_length_squared_tolerance
(
void
);
130
131
#undef EXPORTLIBRARY
132
133
#endif
/* EQ_H_INCLUDED */