1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <BRepClass_FaceClassifier.hxx>
17 #include <BRepAdaptor_Surface.hxx>
18 #include <BRepClass_FaceExplorer.hxx>
19 #include <BRepTools.hxx>
20 #include <Extrema_ExtPS.hxx>
22 #include <gp_Pnt2d.hxx>
23 #include <TopAbs_State.hxx>
24 #include <TopoDS_Face.hxx>
26 //=======================================================================
27 //function : BRepClass_FaceClassifier
29 //=======================================================================
30 BRepClass_FaceClassifier::BRepClass_FaceClassifier()
34 //=======================================================================
35 //function : BRepClass_FaceClassifier
37 //=======================================================================
38 BRepClass_FaceClassifier::BRepClass_FaceClassifier(BRepClass_FaceExplorer& F,
40 const Standard_Real Tol)
42 BRepClass_FClassifier(F,P,Tol)
45 //=======================================================================
46 //function : BRepClass_FaceClassifier
48 //=======================================================================
49 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& theF,
51 const Standard_Real theTol,
52 const Standard_Boolean theUseBndBox,
53 const Standard_Real theGapCheckTol)
55 Perform(theF, theP, theTol, theUseBndBox, theGapCheckTol);
57 //=======================================================================
58 //function : BRepClass_FaceClassifier
60 //=======================================================================
61 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& theF,
63 const Standard_Real theTol,
64 const Standard_Boolean theUseBndBox,
65 const Standard_Real theGapCheckTol)
67 Perform(theF, theP, theTol, theUseBndBox, theGapCheckTol);
70 //=======================================================================
73 //=======================================================================
74 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF,
76 const Standard_Real theTol,
77 const Standard_Boolean theUseBndBox,
78 const Standard_Real theGapCheckTol)
80 BRepClass_FaceExplorer aFex(theF);
81 aFex.SetMaxTolerance(theGapCheckTol);
82 aFex.SetUseBndBox(theUseBndBox);
83 BRepClass_FClassifier::Perform(aFex, theP, theTol);
91 //=======================================================================
94 //=======================================================================
95 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& theF,
97 const Standard_Real theTol,
98 const Standard_Boolean theUseBndBox,
99 const Standard_Real theGapCheckTol)
101 Standard_Integer aNbExt, aIndice, i;
102 Standard_Real aU1, aU2, aV1, aV2, aMaxDist, aD;
104 Extrema_ExtPS aExtrema;
109 BRepAdaptor_Surface aSurf(theF, Standard_False);
110 BRepTools::UVBounds(theF, aU1, aU2, aV1, aV2);
111 aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, theTol, theTol);
113 //modified by NIZNHY-PKV Wed Aug 13 11:28:47 2008f
114 rejected=Standard_True;
115 //modified by NIZNHY-PKV Wed Aug 13 11:28:49 2008t
116 aExtrema.Perform(theP);
117 if(!aExtrema.IsDone()) {
121 aNbExt=aExtrema.NbExt();
126 for (i=1; i<=aNbExt; ++i) {
127 aD=aExtrema.SquareDistance(i);
135 aExtrema.Point(aIndice).Parameter(aU1, aU2);
136 aPuv.SetCoord(aU1, aU2);
137 Perform(theF, aPuv, theTol, theUseBndBox, theGapCheckTol);