summaryrefslogtreecommitdiff
path: root/inc/Bnd_Box2d.lxx
blob: 6f7e493b272fcce8728948b06be6105db53f8d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// File:	Bnd_Box2d.lxx
// Created:	Thu Nov 27 11:12:34 1997
// Author:	Christophe MARION
//		<cma@partox.paris1.matra-dtv.fr>

#define VoidMask  0x01
#define XminMask  0x02
#define XmaxMask  0x04
#define YminMask  0x08
#define YmaxMask  0x10
#define WholeMask 0x1e

#include <gp_Pnt2d.hxx>

//=======================================================================
//function : Bnd_Box2d
//purpose  : 
//=======================================================================

inline Bnd_Box2d::Bnd_Box2d()
     : Xmin(0.), Xmax(0.), Ymin(0.), Ymax(0.), Gap(0.), Flags (VoidMask)
{
}

//=======================================================================
//function : SetWhole
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::SetWhole ()
{ Flags = WholeMask; }

//=======================================================================
//function : SetVoid
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::SetVoid ()
{
  Flags = VoidMask;
  Gap=0.;
}

//=======================================================================
//function : Set
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::Set(const gp_Pnt2d& P)
{
  Flags = VoidMask;
  Gap=0.;
  Add(P);
}

//=======================================================================
//function : Set
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::Set(const gp_Pnt2d& P, const gp_Dir2d& D)
{
  Flags = VoidMask;
  Gap=0.;
  Add(P,D);
}

//=======================================================================
//function : GetGap
//purpose  : 
//=======================================================================

inline Standard_Real Bnd_Box2d::GetGap () const
{
  return Gap;
}

//=======================================================================
//function : SetGap
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::SetGap (const Standard_Real Tol)
{
  Gap = Tol;
}

//=======================================================================
//function : Enlarge
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::Enlarge (const Standard_Real Tol)
{
  Standard_Real t = Tol;
  if (t < 0) t = - t;
  if (Gap < t) Gap = t;
}

//=======================================================================
//function : OpenXmin
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::OpenXmin ()
{ Flags |= XminMask; }

//=======================================================================
//function : OpenXmax
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::OpenXmax ()
{ Flags |= XmaxMask; }

//=======================================================================
//function : OpenYmin
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::OpenYmin ()
{ Flags |= YminMask; }

//=======================================================================
//function : OpenYmax
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::OpenYmax ()
{ Flags |= YmaxMask; }

//=======================================================================
//function : IsOpenXmin
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOpenXmin () const
{ return Flags & XminMask; }

//=======================================================================
//function : IsOpenXmax
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOpenXmax () const
{ return Flags & XmaxMask; }

//=======================================================================
//function : IsOpenYmin
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOpenYmin () const
{ return Flags & YminMask; }

//=======================================================================
//function : IsOpenYmax
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOpenYmax () const
{ return Flags & YmaxMask; }

//=======================================================================
//function : IsWhole
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsWhole () const
{ return (Flags & WholeMask) == WholeMask; }

//=======================================================================
//function : IsVoid
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsVoid () const
{ return Flags & VoidMask; }

//=======================================================================
//function : Add
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::Add (const gp_Pnt2d& P)
{
  Update(P.X(),P.Y());
}

//=======================================================================
//function : Add
//purpose  : 
//=======================================================================

inline void Bnd_Box2d::Add (const gp_Pnt2d& P, const gp_Dir2d& D)
{
  Add(P);
  Add(D);
}

//=======================================================================
//function : IsOut
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOut (const Bnd_Box2d& Other, 
				   const gp_Trsf2d& T) const
{
  return IsOut(Other.Transformed(T));
}

//=======================================================================
//function : IsOut
//purpose  : 
//=======================================================================

inline Standard_Boolean Bnd_Box2d::IsOut (const gp_Trsf2d& T1,
					  const Bnd_Box2d& Other, 
					  const gp_Trsf2d& T2) const
{ 
  return Transformed(T1).IsOut (Other.Transformed(T2));
}