1 // Created on: 1991-12-13
2 // Created by: Christophe MARION
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License 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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Intrv_Interval_HeaderFile
18 #define _Intrv_Interval_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_ShortReal.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Intrv_Position.hxx>
31 //! **-----------**** Other
33 //! ***----------* IsJustBefore
34 //! ***---------------* IsOverlappingAtStart
35 //! ***------------------------* IsJustEnclosingAtEnd
36 //! ***-----------------------------------* IsEnclosing
37 //! ***----* IsJustOverlappingAtStart
38 //! ***-------------* IsSimilar
39 //! ***------------------------* IsJustEnclosingAtStart
41 //! ***------* IsJustOverlappingAtEnd
42 //! ***-----------------* IsOverlappingAtEnd
43 //! ***--------* IsJustAfter
52 Standard_EXPORT Intrv_Interval();
54 Standard_EXPORT Intrv_Interval(const Standard_Real Start, const Standard_Real End);
56 Standard_EXPORT Intrv_Interval(const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd);
58 Standard_Real Start() const;
60 Standard_Real End() const;
62 Standard_ShortReal TolStart() const;
64 Standard_ShortReal TolEnd() const;
66 void Bounds (Standard_Real& Start, Standard_ShortReal& TolStart, Standard_Real& End, Standard_ShortReal& TolEnd) const;
68 void SetStart (const Standard_Real Start, const Standard_ShortReal TolStart);
71 //! ****+****--------------------> Old one
72 //! ****+****------------------------> New one to fuse
74 //! ****+****------------------------> result
75 void FuseAtStart (const Standard_Real Start, const Standard_ShortReal TolStart);
78 //! ****+****-----------> Old one
79 //! <----------**+** Tool for cutting
81 //! ****+****-----------> result
82 void CutAtStart (const Standard_Real Start, const Standard_ShortReal TolStart);
84 void SetEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
87 //! <---------------------****+**** Old one
88 //! <-----------------**+** New one to fuse
90 //! <---------------------****+**** result
91 void FuseAtEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
94 //! <-----****+**** Old one
95 //! **+**------> Tool for cutting
97 //! <-----****+**** result
98 void CutAtEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
100 //! True if myStart+myTolStart > myEnd-myTolEnd
101 //! or if myEnd+myTolEnd > myStart-myTolStart
102 Standard_Boolean IsProbablyEmpty() const;
104 //! True if me is Before Other
105 //! **-----------**** Other
107 //! ***------------* JustBefore
108 //! ***-----------------* OverlappingAtStart
109 //! ***--------------------------* JustEnclosingAtEnd
110 //! ***-------------------------------------* Enclosing
111 //! ***----* JustOverlappingAtStart
112 //! ***-------------* Similar
113 //! ***------------------------* JustEnclosingAtStart
115 //! ***------* JustOverlappingAtEnd
116 //! ***-----------------* OverlappingAtEnd
117 //! ***--------* JustAfter
119 Standard_EXPORT Intrv_Position Position (const Intrv_Interval& Other) const;
121 //! True if me is Before Other
122 //! ***----------------** me
123 //! **-----------**** Other
124 Standard_Boolean IsBefore (const Intrv_Interval& Other) const;
126 //! True if me is After Other
127 //! **-----------**** me
128 //! ***----------------** Other
129 Standard_Boolean IsAfter (const Intrv_Interval& Other) const;
131 //! True if me is Inside Other
132 //! **-----------**** me
133 //! ***--------------------------** Other
134 Standard_Boolean IsInside (const Intrv_Interval& Other) const;
136 //! True if me is Enclosing Other
137 //! ***----------------------------**** me
138 //! ***------------------** Other
139 Standard_Boolean IsEnclosing (const Intrv_Interval& Other) const;
141 //! True if me is just Enclosing Other at start
142 //! ***---------------------------**** me
143 //! ***------------------** Other
144 Standard_Boolean IsJustEnclosingAtStart (const Intrv_Interval& Other) const;
146 //! True if me is just Enclosing Other at End
147 //! ***----------------------------**** me
148 //! ***-----------------**** Other
149 Standard_Boolean IsJustEnclosingAtEnd (const Intrv_Interval& Other) const;
151 //! True if me is just before Other
152 //! ***--------**** me
153 //! ***-----------** Other
154 Standard_Boolean IsJustBefore (const Intrv_Interval& Other) const;
156 //! True if me is just after Other
157 //! ****-------**** me
158 //! ***-----------** Other
159 Standard_Boolean IsJustAfter (const Intrv_Interval& Other) const;
161 //! True if me is overlapping Other at start
162 //! ***---------------*** me
163 //! ***-----------** Other
164 Standard_Boolean IsOverlappingAtStart (const Intrv_Interval& Other) const;
166 //! True if me is overlapping Other at end
167 //! ***-----------** me
168 //! ***---------------*** Other
169 Standard_Boolean IsOverlappingAtEnd (const Intrv_Interval& Other) const;
171 //! True if me is just overlapping Other at start
172 //! ***-----------*** me
173 //! ***------------------------** Other
174 Standard_Boolean IsJustOverlappingAtStart (const Intrv_Interval& Other) const;
176 //! True if me is just overlapping Other at end
177 //! ***-----------* me
178 //! ***------------------------** Other
179 Standard_Boolean IsJustOverlappingAtEnd (const Intrv_Interval& Other) const;
181 //! True if me and Other have the same bounds
182 //! *----------------*** me
183 //! ***-----------------** Other
184 Standard_Boolean IsSimilar (const Intrv_Interval& Other) const;
199 Standard_Real myStart;
201 Standard_ShortReal myTolStart;
202 Standard_ShortReal myTolEnd;
208 #include <Intrv_Interval.lxx>
214 #endif // _Intrv_Interval_HeaderFile