1 // File: IntRes2d_Domain.cxx
2 // Created: Wed Jun 10 15:06:44 1992
3 // Author: Laurent BUCHARD
6 // modified by Edward AGAPOV (eap) Jun 7 2002 (occ 438)
7 // --- limit infinite points and parameters in order to make
8 // --- arithmetic operation on them safe
10 #include <IntRes2d_Domain.ixx>
11 #include <Precision.hxx>
13 const Standard_Real infVal = Precision::Infinite();
15 //=======================================================================
16 //function : LimitInfinite
18 //=======================================================================
20 static inline Standard_Real LimitInfinite(const Standard_Real Val)
22 return ( Abs(Val) > infVal ? (Val>0 ? infVal : -infVal) : Val );
25 //=======================================================================
26 //function : IntRes2d_Domain
28 //=======================================================================
30 IntRes2d_Domain::IntRes2d_Domain():
32 first_param(0.0), last_param(0.0),
33 first_tol(0.0), last_tol(0.0),
34 first_point(0.0, 0.0), last_point(0.0, 0.0),
39 void IntRes2d_Domain::SetValues() {
41 periodfirst=periodlast=0.0;
44 //=======================================================================
45 //function : IntRes2d_Domain
46 //purpose : Creates a bounded Domain.
47 //=======================================================================
49 IntRes2d_Domain::IntRes2d_Domain(const gp_Pnt2d& Pnt1,
50 const Standard_Real Par1,
51 const Standard_Real Tol1,
53 const Standard_Real Par2,
54 const Standard_Real Tol2) {
56 SetValues(Pnt1,Par1,Tol1,Pnt2,Par2,Tol2);
59 //=======================================================================
60 //function : SetValues
61 //purpose : Sets the values for a bounded domain.
62 //=======================================================================
64 void IntRes2d_Domain::SetValues(const gp_Pnt2d& Pnt1,
65 const Standard_Real Par1,
66 const Standard_Real Tol1,
68 const Standard_Real Par2,
69 const Standard_Real Tol2) {
72 periodfirst = periodlast = 0.0;
74 first_param=LimitInfinite(Par1);
75 first_point.SetCoord( LimitInfinite(Pnt1.X()), LimitInfinite(Pnt1.Y()) );
78 last_param=LimitInfinite(Par2);
79 last_point.SetCoord( LimitInfinite(Pnt2.X()), LimitInfinite(Pnt2.Y()) );
86 IntRes2d_Domain::IntRes2d_Domain(const gp_Pnt2d& Pnt,
87 const Standard_Real Par,
88 const Standard_Real Tol,
89 const Standard_Boolean First) :
90 first_param(0.0), last_param(0.0),
91 first_tol(0.0), last_tol(0.0),
92 first_point(0.0, 0.0), last_point(0.0, 0.0)
94 SetValues(Pnt,Par,Tol,First);
97 void IntRes2d_Domain::SetValues(const gp_Pnt2d& Pnt,
98 const Standard_Real Par,
99 const Standard_Real Tol,
100 const Standard_Boolean First) {
102 periodfirst=periodlast=0.0;
105 first_param=LimitInfinite(Par);
106 first_point.SetCoord( LimitInfinite(Pnt.X()), LimitInfinite(Pnt.Y()) );
111 last_param=LimitInfinite(Par);
112 last_point.SetCoord( LimitInfinite(Pnt.X()), LimitInfinite(Pnt.Y()) );