1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00
occt/src/BRepClass/BRepClass_FaceClassifier.cxx
kgv c22b52d60e 0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSurface classes
Adaptor2d_Curve2d, Adaptor3d_Curve and Adaptor3d_Surface now inherit Standard_Transient.
Interfaces Adaptor2d_HCurve2d, Adaptor3d_HCurve, Adaptor3d_HSurface and their subclasses
are now aliases to Adaptor2d_Curve2d, Adaptor3d_Curve and Adaptor3d_Surface.
Removed numerous unsafe reinterpret casts.

Generic classes Adaptor3d_GenHCurve, Adaptor3d_GenHSurface, Adaptor2d_GenHCurve2d have been removed.
Several redundant .lxx files have been merged into .hxx.

Removed obsolete adaptor classes with H suffix.
2020-12-11 19:12:48 +03:00

130 lines
3.8 KiB
C++

// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepClass_FaceClassifier.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepClass_FaceExplorer.hxx>
#include <BRepTools.hxx>
#include <Extrema_ExtPS.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <TopAbs_State.hxx>
#include <TopoDS_Face.hxx>
//=======================================================================
//function : BRepClass_FaceClassifier
//purpose :
//=======================================================================
BRepClass_FaceClassifier::BRepClass_FaceClassifier()
{
}
//=======================================================================
//function : BRepClass_FaceClassifier
//purpose :
//=======================================================================
BRepClass_FaceClassifier::BRepClass_FaceClassifier(BRepClass_FaceExplorer& F,
const gp_Pnt2d& P,
const Standard_Real Tol)
:
BRepClass_FClassifier(F,P,Tol)
{
}
//=======================================================================
//function : BRepClass_FaceClassifier
//purpose :
//=======================================================================
BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
const gp_Pnt& P,
const Standard_Real Tol)
{
Perform(F,P,Tol);
}
//=======================================================================
//function : BRepClass_FaceClassifier
//purpose :
//=======================================================================
BRepClass_FaceClassifier::BRepClass_FaceClassifier(const TopoDS_Face& F,
const gp_Pnt2d& P,
const Standard_Real Tol)
{
Perform(F,P,Tol);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepClass_FaceClassifier::Perform(const TopoDS_Face& F,
const gp_Pnt2d& P,
const Standard_Real Tol)
{
BRepClass_FaceExplorer Fex(F);
BRepClass_FClassifier::Perform(Fex,P,Tol);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
const gp_Pnt& aP,
const Standard_Real aTol)
{
Standard_Integer aNbExt, aIndice, i;
Standard_Real aU1, aU2, aV1, aV2, aMaxDist, aD;
gp_Pnt2d aPuv;
Extrema_ExtPS aExtrema;
//
aMaxDist=RealLast();
aIndice=0;
//
BRepAdaptor_Surface aSurf(aF, Standard_False);
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
//
//modified by NIZNHY-PKV Wed Aug 13 11:28:47 2008f
rejected=Standard_True;
//modified by NIZNHY-PKV Wed Aug 13 11:28:49 2008t
aExtrema.Perform(aP);
if(!aExtrema.IsDone()) {
return;
}
//
aNbExt=aExtrema.NbExt();
if(!aNbExt) {
return;
}
//
for (i=1; i<=aNbExt; ++i) {
aD=aExtrema.SquareDistance(i);
if(aD < aMaxDist) {
aMaxDist=aD;
aIndice=i;
}
}
//
if(aIndice) {
aExtrema.Point(aIndice).Parameter(aU1, aU2);
aPuv.SetCoord(aU1, aU2);
Perform(aF, aPuv, aTol);
}
}