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& F,
51 const Standard_Real Tol)
55 //=======================================================================
56 //function : BRepClass_FaceClassifier
58 //=======================================================================
59 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
61 const Standard_Real Tol)
66 //=======================================================================
69 //=======================================================================
70 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& F,
72 const Standard_Real Tol)
74 BRepClass_FaceExplorer Fex(F);
75 BRepClass_FClassifier::Perform(Fex,P,Tol);
83 //=======================================================================
86 //=======================================================================
87 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
89 const Standard_Real aTol)
91 Standard_Integer aNbExt, aIndice, i;
92 Standard_Real aU1, aU2, aV1, aV2, aMaxDist, aD;
94 Extrema_ExtPS aExtrema;
99 BRepAdaptor_Surface aSurf(aF, Standard_False);
100 BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
101 aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
103 //modified by NIZNHY-PKV Wed Aug 13 11:28:47 2008f
104 rejected=Standard_True;
105 //modified by NIZNHY-PKV Wed Aug 13 11:28:49 2008t
106 aExtrema.Perform(aP);
107 if(!aExtrema.IsDone()) {
111 aNbExt=aExtrema.NbExt();
116 for (i=1; i<=aNbExt; ++i) {
117 aD=aExtrema.SquareDistance(i);
125 aExtrema.Point(aIndice).Parameter(aU1, aU2);
126 aPuv.SetCoord(aU1, aU2);
127 Perform(aF, aPuv, aTol);