0026515: Exponential memory usage problems with BOPDS_IndexedMapOfPaveBlock and NColl...
[occt.git] / src / IntTools / IntTools_Tools.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-11-16
2// Created by: Peter KURNEV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IntTools_Tools_HeaderFile
17#define _IntTools_Tools_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Integer.hxx>
24#include <Standard_Boolean.hxx>
25#include <TopAbs_State.hxx>
26#include <Standard_Real.hxx>
27#include <IntTools_SequenceOfCurves.hxx>
28class TopoDS_Vertex;
29class TopoDS_Wire;
30class TopoDS_Face;
31class gp_Pnt2d;
32class TopoDS_Edge;
33class IntTools_CommonPrt;
34class gp_Pnt;
35class IntTools_Curve;
36class gp_Dir;
37class Geom_Curve;
38class Bnd_Box;
39class IntTools_Range;
40class gp_Lin;
41class gp_Pln;
42class Geom2d_Curve;
43class Geom_Surface;
44
45
46
47//! The class contains handy static functions
48//! dealing with the geometry and topology.
49class IntTools_Tools
50{
51public:
52
53 DEFINE_STANDARD_ALLOC
54
55
56
57 //! Computes distance between vertex V1 and vertex V2,
58 //! if the distance is less than sum of vertex tolerances
59 //! returns zero,
60 //! otherwise returns negative value
61 Standard_EXPORT static Standard_Integer ComputeVV (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
62
63
64 //! Returns True if wire aW contains edges
65 //! with INTERNAL orientation
66 Standard_EXPORT static Standard_Boolean HasInternalEdge (const TopoDS_Wire& aW);
67
68
69 //! Build a face based on surface of given face aF
70 //! and bounded by wire aW
71 Standard_EXPORT static void MakeFaceFromWireAndFace (const TopoDS_Wire& aW, const TopoDS_Face& aF, TopoDS_Face& aFNew);
72
73 Standard_EXPORT static TopAbs_State ClassifyPointByFace (const TopoDS_Face& aF, const gp_Pnt2d& P);
74
75
76 //! Computes square distance between a point on the edge E
77 //! corresponded to parameter t and vertices of edge E.
78 //! Returns True if this distance is less than square
79 //! tolerance of vertex, otherwise returns false.
80 Standard_EXPORT static Standard_Boolean IsVertex (const TopoDS_Edge& E, const Standard_Real t);
81
82
83 //! Returns True if square distance between vertex V
84 //! and a point on the edge E corresponded to parameter t
85 //! is less than square tolerance of V
86 Standard_EXPORT static Standard_Boolean IsVertex (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real t);
87
88
89 //! Returns True if IsVertx for middle parameter of fist range
90 //! and first edge returns True
91 //! and if IsVertex for middle parameter of second range and
92 //! second range returns True,
93 //! otherwise returns False
94 Standard_EXPORT static Standard_Boolean IsVertex (const IntTools_CommonPrt& aCmnPrt);
95
96
97 //! Gets boundary of parameters of E1 and E2.
98 //! Computes 3d points on each corresponded to average parameters.
99 //! Returns True if distance between computed points is less than
100 //! sum of edge tolerance, otherwise returns False.
101 Standard_EXPORT static Standard_Boolean IsMiddlePointsEqual (const TopoDS_Edge& E1, const TopoDS_Edge& E2);
102
103
104 //! Returns True if the distance between point aP and
105 //! vertex aV is less or equal to sum of aTolPV and
106 //! vertex tolerance, otherwise returns False
107 Standard_EXPORT static Standard_Boolean IsVertex (const gp_Pnt& aP, const Standard_Real aTolPV, const TopoDS_Vertex& aV);
108
109
110 //! Returns some value between aFirst and aLast
111 Standard_EXPORT static Standard_Real IntermediatePoint (const Standard_Real aFirst, const Standard_Real aLast);
112
113
114 //! Split aC by average parameter if aC is closed in 3D.
115 //! Returns positive value if splitting has been done,
116 //! otherwise returns zero.
117 Standard_EXPORT static Standard_Integer SplitCurve (const IntTools_Curve& aC, IntTools_SequenceOfCurves& aS);
118
119
120 //! Puts curves from aSIn to aSOut except those curves that
121 //! are coincide with first curve from aSIn.
122 Standard_EXPORT static void RejectLines (const IntTools_SequenceOfCurves& aSIn, IntTools_SequenceOfCurves& aSOut);
123
124
125 //! Returns True if D1 and D2 coinside
126 Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2);
127
128
129 //! Returns True if D1 and D2 coinside with given tolerance
130 Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2, const Standard_Real aTol);
131
132
133 //! Returns True if aC is BoundedCurve from Geom and
134 //! the distance between first point
135 //! of the curve aC and last point
136 //! is less than 1.e-12
137 Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& aC);
138
139
140 //! Returns adaptive tolerance for given aTolBase
141 //! if aC is trimmed curve and basis curve is parabola,
142 //! otherwise returns value of aTolBase
143 Standard_EXPORT static Standard_Real CurveTolerance (const Handle(Geom_Curve)& aC, const Standard_Real aTolBase);
144
145 Standard_EXPORT static Standard_Boolean CheckCurve (const Handle(Geom_Curve)& theC, const Standard_Real theTol, Bnd_Box& theBox);
146
147 Standard_EXPORT static Standard_Boolean IsOnPave (const Standard_Real theT, const IntTools_Range& theRange, const Standard_Real theTol);
148
149 Standard_EXPORT static void VertexParameters (const IntTools_CommonPrt& theCP, Standard_Real& theT1, Standard_Real& theT2);
150
151 Standard_EXPORT static void VertexParameter (const IntTools_CommonPrt& theCP, Standard_Real& theT);
152
153 Standard_EXPORT static Standard_Boolean IsOnPave1 (const Standard_Real theT, const IntTools_Range& theRange, const Standard_Real theTol);
154
155 //! Checks if the range <theR> interfere with the range <theRRef>
156 Standard_EXPORT static Standard_Boolean IsInRange (const IntTools_Range& theRRef, const IntTools_Range& theR, const Standard_Real theTol);
157
158 Standard_EXPORT static Standard_Integer SegPln (const gp_Lin& theLin, const Standard_Real theTLin1, const Standard_Real theTLin2, const Standard_Real theTolLin, const gp_Pln& thePln, const Standard_Real theTolPln, gp_Pnt& theP, Standard_Real& theT, Standard_Real& theTolP, Standard_Real& theTmin, Standard_Real& theTmax);
159
160
161 //! Computes the max distance between points
162 //! taken from 3D and 2D curves by the same parameter
163 Standard_EXPORT static Standard_Boolean ComputeTolerance (const Handle(Geom_Curve)& theCurve3D, const Handle(Geom2d_Curve)& theCurve2D, const Handle(Geom_Surface)& theSurf, const Standard_Real theFirst, const Standard_Real theLast, Standard_Real& theMaxDist, Standard_Real& theMaxPar);
164
165
166
167
168protected:
169
170
171
172
173
174private:
175
176
177
178
179
180};
181
182
183
184
185
186
187
188#endif // _IntTools_Tools_HeaderFile