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.
16 #include <BRepAdaptor_HSurface.hxx>
17 #include <BRepAdaptor_Surface.hxx>
18 #include <BRepClass_FaceClassifier.hxx>
19 #include <BRepClass_FaceExplorer.hxx>
20 #include <BRepTools.hxx>
21 #include <Extrema_ExtPS.hxx>
23 #include <gp_Pnt2d.hxx>
24 #include <TopAbs_State.hxx>
25 #include <TopoDS_Face.hxx>
27 //=======================================================================
28 //function : BRepClass_FaceClassifier
30 //=======================================================================
31 BRepClass_FaceClassifier::BRepClass_FaceClassifier()
35 //=======================================================================
36 //function : BRepClass_FaceClassifier
38 //=======================================================================
39 BRepClass_FaceClassifier::BRepClass_FaceClassifier(BRepClass_FaceExplorer& F,
41 const Standard_Real Tol)
43 BRepClass_FClassifier(F,P,Tol)
46 //=======================================================================
47 //function : BRepClass_FaceClassifier
49 //=======================================================================
50 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
52 const Standard_Real Tol)
56 //=======================================================================
57 //function : BRepClass_FaceClassifier
59 //=======================================================================
60 BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
62 const Standard_Real Tol)
67 //=======================================================================
70 //=======================================================================
71 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& F,
73 const Standard_Real Tol)
75 BRepClass_FaceExplorer Fex(F);
76 BRepClass_FClassifier::Perform(Fex,P,Tol);
84 //=======================================================================
87 //=======================================================================
88 void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
90 const Standard_Real aTol)
92 Standard_Integer aNbExt, aIndice, i;
93 Standard_Real aU1, aU2, aV1, aV2, aMaxDist, aD;
95 Extrema_ExtPS aExtrema;
100 BRepAdaptor_Surface aSurf(aF);
101 BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
102 aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
104 //modified by NIZNHY-PKV Wed Aug 13 11:28:47 2008f
105 rejected=Standard_True;
106 //modified by NIZNHY-PKV Wed Aug 13 11:28:49 2008t
107 aExtrema.Perform(aP);
108 if(!aExtrema.IsDone()) {
112 aNbExt=aExtrema.NbExt();
117 for (i=1; i<=aNbExt; ++i) {
118 aD=aExtrema.SquareDistance(i);
126 aExtrema.Point(aIndice).Parameter(aU1, aU2);
127 aPuv.SetCoord(aU1, aU2);
128 Perform(aF, aPuv, aTol);