0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Intrv / Intrv_Interval.hxx
CommitLineData
42cf5bc1 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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Intrv_Interval_HeaderFile
18#define _Intrv_Interval_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <Standard_ShortReal.hxx>
26#include <Standard_Boolean.hxx>
27#include <Intrv_Position.hxx>
28
29
30
31//! **-----------**** Other
32//! ***---* IsBefore
33//! ***----------* IsJustBefore
34//! ***---------------* IsOverlappingAtStart
35//! ***------------------------* IsJustEnclosingAtEnd
36//! ***-----------------------------------* IsEnclosing
37//! ***----* IsJustOverlappingAtStart
38//! ***-------------* IsSimilar
39//! ***------------------------* IsJustEnclosingAtStart
40//! ***-* IsInside
41//! ***------* IsJustOverlappingAtEnd
42//! ***-----------------* IsOverlappingAtEnd
43//! ***--------* IsJustAfter
44//! ***---* IsAfter
45class Intrv_Interval
46{
47public:
48
49 DEFINE_STANDARD_ALLOC
50
51
52 Standard_EXPORT Intrv_Interval();
53
54 Standard_EXPORT Intrv_Interval(const Standard_Real Start, const Standard_Real End);
55
56 Standard_EXPORT Intrv_Interval(const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd);
57
58 Standard_Real Start() const;
59
60 Standard_Real End() const;
61
62 Standard_ShortReal TolStart() const;
63
64 Standard_ShortReal TolEnd() const;
65
66 void Bounds (Standard_Real& Start, Standard_ShortReal& TolStart, Standard_Real& End, Standard_ShortReal& TolEnd) const;
67
68 void SetStart (const Standard_Real Start, const Standard_ShortReal TolStart);
69
70
71 //! ****+****--------------------> Old one
72 //! ****+****------------------------> New one to fuse
73 //! <<< <<<
74 //! ****+****------------------------> result
75 void FuseAtStart (const Standard_Real Start, const Standard_ShortReal TolStart);
76
77
78 //! ****+****-----------> Old one
79 //! <----------**+** Tool for cutting
80 //! >>> >>>
81 //! ****+****-----------> result
82 void CutAtStart (const Standard_Real Start, const Standard_ShortReal TolStart);
83
84 void SetEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
85
86
87 //! <---------------------****+**** Old one
88 //! <-----------------**+** New one to fuse
89 //! >>> >>>
90 //! <---------------------****+**** result
91 void FuseAtEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
92
93
94 //! <-----****+**** Old one
95 //! **+**------> Tool for cutting
96 //! <<< <<<
97 //! <-----****+**** result
98 void CutAtEnd (const Standard_Real End, const Standard_ShortReal TolEnd);
99
100 //! True if myStart+myTolStart > myEnd-myTolEnd
101 //! or if myEnd+myTolEnd > myStart-myTolStart
102 Standard_Boolean IsProbablyEmpty() const;
103
104 //! True if me is Before Other
105 //! **-----------**** Other
106 //! ***-----* Before
107 //! ***------------* JustBefore
108 //! ***-----------------* OverlappingAtStart
109 //! ***--------------------------* JustEnclosingAtEnd
110 //! ***-------------------------------------* Enclosing
111 //! ***----* JustOverlappingAtStart
112 //! ***-------------* Similar
113 //! ***------------------------* JustEnclosingAtStart
114 //! ***-* Inside
115 //! ***------* JustOverlappingAtEnd
116 //! ***-----------------* OverlappingAtEnd
117 //! ***--------* JustAfter
118 //! ***---* After
119 Standard_EXPORT Intrv_Position Position (const Intrv_Interval& Other) const;
120
121 //! True if me is Before Other
122 //! ***----------------** me
123 //! **-----------**** Other
124 Standard_Boolean IsBefore (const Intrv_Interval& Other) const;
125
126 //! True if me is After Other
127 //! **-----------**** me
128 //! ***----------------** Other
129 Standard_Boolean IsAfter (const Intrv_Interval& Other) const;
130
131 //! True if me is Inside Other
132 //! **-----------**** me
133 //! ***--------------------------** Other
134 Standard_Boolean IsInside (const Intrv_Interval& Other) const;
135
136 //! True if me is Enclosing Other
137 //! ***----------------------------**** me
138 //! ***------------------** Other
139 Standard_Boolean IsEnclosing (const Intrv_Interval& Other) const;
140
141 //! True if me is just Enclosing Other at start
142 //! ***---------------------------**** me
143 //! ***------------------** Other
144 Standard_Boolean IsJustEnclosingAtStart (const Intrv_Interval& Other) const;
145
146 //! True if me is just Enclosing Other at End
147 //! ***----------------------------**** me
148 //! ***-----------------**** Other
149 Standard_Boolean IsJustEnclosingAtEnd (const Intrv_Interval& Other) const;
150
151 //! True if me is just before Other
152 //! ***--------**** me
153 //! ***-----------** Other
154 Standard_Boolean IsJustBefore (const Intrv_Interval& Other) const;
155
156 //! True if me is just after Other
157 //! ****-------**** me
158 //! ***-----------** Other
159 Standard_Boolean IsJustAfter (const Intrv_Interval& Other) const;
160
161 //! True if me is overlapping Other at start
162 //! ***---------------*** me
163 //! ***-----------** Other
164 Standard_Boolean IsOverlappingAtStart (const Intrv_Interval& Other) const;
165
166 //! True if me is overlapping Other at end
167 //! ***-----------** me
168 //! ***---------------*** Other
169 Standard_Boolean IsOverlappingAtEnd (const Intrv_Interval& Other) const;
170
171 //! True if me is just overlapping Other at start
172 //! ***-----------*** me
173 //! ***------------------------** Other
174 Standard_Boolean IsJustOverlappingAtStart (const Intrv_Interval& Other) const;
175
176 //! True if me is just overlapping Other at end
177 //! ***-----------* me
178 //! ***------------------------** Other
179 Standard_Boolean IsJustOverlappingAtEnd (const Intrv_Interval& Other) const;
180
181 //! True if me and Other have the same bounds
182 //! *----------------*** me
183 //! ***-----------------** Other
184 Standard_Boolean IsSimilar (const Intrv_Interval& Other) const;
185
186
187
188
189protected:
190
191
192
193
194
195private:
196
197
198
199 Standard_Real myStart;
200 Standard_Real myEnd;
201 Standard_ShortReal myTolStart;
202 Standard_ShortReal myTolEnd;
203
204
205};
206
207
208#include <Intrv_Interval.lxx>
209
210
211
212
213
214#endif // _Intrv_Interval_HeaderFile