1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0028165: Improve performance of Boolean Operations

1. Unification of the usage of the BRepAdaptor_Surface in Boolean Operations algorithm.
For each face when it is necessary the Adaptor is initialized only once and stored in Context.

For that purpose the new IntTools_Context::SurfaceAdaptor(const TopoDS_Face&) method has been implemented.

To provide possibility to take the Adaptor from the context, the context has been added as
a parameter in following methods:
BOPTools_AlgoTools::MakePCurve()
BOPTools_AlgoTools::Sence()
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace()
BOPTools_AlgoTools2D::PointOnSurface
BOPTools_AlgoTools2D::CurveOnSurface
BOPTools_AlgoTools2D::AdjustPCurveOnFace
BOPTools_AlgoTools2D::Make2D
BOPTools_AlgoTools2D::MakePCurveOnFace
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge

It is also possible now to pass the context into BOPAlgo_WireSplitter algorithm.

Also, the new IntTools_Context::UVBounds(const TopoDS_Face&) method
has been implemented to get the UV bounds of a face.

2. Additional improvement is a calculation of reduced intersection range only for the intersection
type VERTEX during computation of Edge/Face interference.

3. The methods IntTools_EdgeFace::Prepare() and IntTools_EdgeFace::FindProjectableRoot()
and the fields IntTools_EdgeFace::myProjectableRanges and IntTools_EdgeFace::myFClass2d
have been removed as obsolete.

4. Test cases for the issue.
This commit is contained in:
emv
2016-11-30 13:29:37 +03:00
committed by apn
parent 483ce1bd89
commit 51db017972
31 changed files with 623 additions and 488 deletions

View File

@@ -1002,7 +1002,8 @@ Standard_Boolean BOPTools_AlgoTools::CheckSameGeom
// purpose:
//=======================================================================
Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
const TopoDS_Face& theF2)
const TopoDS_Face& theF2,
const Handle(IntTools_Context)& theContext)
{
Standard_Integer iSense=0;
gp_Dir aDNF1, aDNF2;
@@ -1036,8 +1037,8 @@ Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
return iSense;
}
//
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE1, theF1, aDNF1, theContext);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE2, theF2, aDNF2, theContext);
//
iSense=BOPTools_AlgoTools3D::SenseFlag(aDNF1, aDNF2);
//
@@ -1357,7 +1358,8 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
const TopoDS_Face& aF2,
const IntTools_Curve& aIC,
const Standard_Boolean bPC1,
const Standard_Boolean bPC2)
const Standard_Boolean bPC2,
const Handle(IntTools_Context)& theContext)
{
Standard_Integer i;
@@ -1392,19 +1394,19 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
//
aC2D=aC2Dx1;
if (aC2D.IsNull()) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD);
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext);
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D,
aOutFirst, aOutLast,
aOutTol);
aOutTol, theContext);
}
//
if (aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D,
aC2DA);
aC2DA, theContext);
}
else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D,
aC2DA);
aC2DA, theContext);
}
//
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
@@ -1809,7 +1811,7 @@ void GetFaceDir(const TopoDS_Edge& aE,
Standard_Real aTolE;
gp_Pnt aPx;
//
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN, theContext);
if (aF.Orientation()==TopAbs_REVERSED){
aDN.Reverse();
}

View File

@@ -62,7 +62,15 @@ public:
Standard_EXPORT static void MakeEdge (const IntTools_Curve& theCurve, const TopoDS_Vertex& theV1, const Standard_Real theT1, const TopoDS_Vertex& theV2, const Standard_Real theT2, const Standard_Real theTolR3D, TopoDS_Edge& theE);
Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE, const TopoDS_Face& theF1, const TopoDS_Face& theF2, const IntTools_Curve& theCurve, const Standard_Boolean thePC1, const Standard_Boolean thePC2);
//! Makes 2d curve of the edge <theE> on the faces <theF1> and <theF2>.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE,
const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
const IntTools_Curve& theCurve,
const Standard_Boolean thePC1,
const Standard_Boolean thePC2,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
Standard_EXPORT static void MakeContainer (const TopAbs_ShapeEnum theType, TopoDS_Shape& theShape);
@@ -88,7 +96,12 @@ public:
Standard_EXPORT static Standard_Boolean CheckSameGeom (const TopoDS_Face& theF1, const TopoDS_Face& theF2, Handle(IntTools_Context)& theContext);
Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1, const TopoDS_Face& theF2);
//! Basing on the normals directions of the faces the method
//! Defines whether to reverse the second face or not.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static Standard_Integer Sense (const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns True if the face theFace contains
//! the edge theEdge but with opposite orientation.

View File

@@ -89,7 +89,8 @@ static
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
const TopoDS_Face& aF,
const Handle(IntTools_Context)& theContext)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
@@ -104,7 +105,7 @@ void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
}
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC);
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, theContext);
aTolEdge=BRep_Tool::Tolerance(aE);
@@ -159,14 +160,14 @@ void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aParameter,
Standard_Real& U,
Standard_Real& V)
Standard_Real& V,
const Handle(IntTools_Context)& theContext)
{
gp_Pnt2d aP2D;
Handle(Geom2d_Curve) aC2D;
Standard_Real aToler, aFirst, aLast;
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
aFirst, aLast, aToler);
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, theContext);
aC2D->D0(aParameter, aP2D);
U=aP2D.X();
V=aP2D.Y();
@@ -180,12 +181,12 @@ void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE,
void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aToler)
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
//
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
aFirst, aLast, aToler);
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aFirst, aLast, aToler, theContext);
//
return;
}
@@ -198,7 +199,8 @@ void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext)
{
Standard_Boolean aHasOld;
Handle(Geom2d_Curve) C2D;
@@ -211,7 +213,7 @@ void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE,
return;
}
BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler);
BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, theContext);
aC2D=C2D;
return;
}
@@ -247,7 +249,6 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Boolean bHasOld;
Handle(Geom2d_Curve) aC2D;
@@ -268,45 +269,51 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
(const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
(const TopoDS_Face& theF,
const Handle(Geom_Curve)& theC3D,
const Handle(Geom2d_Curve)& theC2D,
Handle(Geom2d_Curve)& theC2DA,
const Handle(IntTools_Context)& theContext)
{
Standard_Real aT1, aT2;
Standard_Real aT1 = theC3D->FirstParameter();
Standard_Real aT2 = theC3D->LastParameter();
//
aT1=aC3D->FirstParameter();
aT2=aC3D->LastParameter();
//
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aT1, aT2, aC2D, aC2DA);
BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext);
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
(const TopoDS_Face& aF,
const Standard_Real aT1,
const Standard_Real aT2,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
(const TopoDS_Face& theF,
const Standard_Real theFirst,
const Standard_Real theLast,
const Handle(Geom2d_Curve)& theC2D,
Handle(Geom2d_Curve)& theC2DA,
const Handle(IntTools_Context)& theContext)
{
BRepAdaptor_Surface aBAS(aF, Standard_True);
BRepAdaptor_Surface aBASTmp;
const BRepAdaptor_Surface* pBAS;
if (!theContext.IsNull()) {
pBAS = &theContext->SurfaceAdaptor(theF);
}
else {
aBASTmp.Initialize(theF, Standard_True);
pBAS = &aBASTmp;
}
//
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aBAS, aT1, aT2,
aC2D, aC2DA);
BOPTools_AlgoTools2D::AdjustPCurveOnSurf(*pBAS, theFirst, theLast, theC2D, theC2DA);
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
void BOPTools_AlgoTools2D::AdjustPCurveOnSurf
(const BRepAdaptor_Surface& aBAS,
const Standard_Real aFirst,
const Standard_Real aLast,
const Handle(Geom2d_Curve)& aC2D,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
{
Standard_Boolean mincond, maxcond;
@@ -319,9 +326,6 @@ void BOPTools_AlgoTools2D::AdjustPCurveOnFace
VMin=aBAS.FirstVParameter();
VMax=aBAS.LastVParameter();
//
//BRepAdaptor_Surface aBAS(aF, Standard_False);
//BRepTools::UVBounds(aF, UMin, UMax, VMin, VMax);
//
aDelta=Precision::PConfusion();
aT =.5*(aFirst+aLast);
@@ -534,7 +538,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext)
{
Standard_Boolean aLocIdentity;
Standard_Real f3d, l3d;
@@ -569,7 +574,7 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
//
aToler = BRep_Tool::Tolerance(aE);
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler, theContext);
//
aFirst = f3d;
aLast = l3d;
@@ -582,7 +587,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
Handle(Geom2d_Curve)& aC2D, //->
Standard_Real& TolReached2d)
Standard_Real& TolReached2d,
const Handle(IntTools_Context)& theContext)
{
Standard_Real aFirst, aLast;
@@ -591,43 +597,39 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
//
TolReached2d=0.;
//
BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst,
aLast, aC2D, TolReached2d);
BOPTools_AlgoTools2D::MakePCurveOnFace
(aF, aC3D, aFirst, aLast, aC2D, TolReached2d, theContext);
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakePCurveOnFace
void BOPTools_AlgoTools2D::MakePCurveOnFace
(const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Standard_Real aT1,
const Standard_Real aT2,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& TolReached2d)
Handle(Geom2d_Curve)& aC2D,
Standard_Real& TolReached2d,
const Handle(IntTools_Context)& theContext)
{
Standard_Real aTolR, aT;
Standard_Real aUMin, aUMax, aVMin, aVMax;
Handle(Geom2d_Curve) aC2DA;
Handle(GeomAdaptor_HSurface) aBAHS;
Handle(GeomAdaptor_HCurve) aBAHC;
Handle(Geom_Surface) aS;
BRepAdaptor_Surface aBASTmp;
const BRepAdaptor_Surface* pBAS;
if (!theContext.IsNull()) {
pBAS = &theContext->SurfaceAdaptor(aF);
}
else {
aBASTmp.Initialize(aF, Standard_True);
pBAS = &aBASTmp;
}
//
BRepAdaptor_Surface aBAS(aF, Standard_True);
aUMin=aBAS.FirstUParameter();
aUMax=aBAS.LastUParameter();
aVMin=aBAS.FirstVParameter();
aVMax=aBAS.LastVParameter();
aS=aBAS.Surface().Surface();
aS=Handle(Geom_Surface)::DownCast(aS->Transformed(aBAS.Trsf()));
GeomAdaptor_Surface aGAS(aS, aUMin, aUMax, aVMin, aVMax);
//
aBAHS=new GeomAdaptor_HSurface(aGAS);
aBAHC=new GeomAdaptor_HCurve(aC3D, aT1, aT2);
Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(*pBAS);
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aT1, aT2);
//
Standard_Real aTolR;
//when the type of surface is GeomAbs_SurfaceOfRevolution
if (aGAS.GetType() == GeomAbs_SurfaceOfRevolution) {
if (pBAS->GetType() == GeomAbs_SurfaceOfRevolution) {
Standard_Real aTR;
//
aTR=Precision::Confusion();//1.e-7;
@@ -664,12 +666,17 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
}
//
TolReached2d=aTolR;
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aBAS, aT1, aT2,
aC2D, aC2DA);
//
Handle(Geom2d_Curve) aC2DA;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
//
aC2D=aC2DA;
//
// compute the appropriate tolerance for the edge
Handle(Geom_Surface) aS = pBAS->Surface().Surface();
aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));
//
Standard_Real aT;
if (IntTools_Tools::ComputeTolerance
(aC3D, aC2D, aS, aT1, aT2, aTolR, aT)) {
if (aTolR > TolReached2d) {

View File

@@ -45,9 +45,12 @@ public:
//! Compute P-Curve for the edge <aE> on the face <aF>
//! Raises exception Standard_ConstructionError if projection algorithm fails
Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF);
//! Compute P-Curve for the edge <aE> on the face <aF>.<br>
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
@@ -55,26 +58,43 @@ public:
//! Compute surface parameters <U,V> of the face <aF>
//! for the point from the edge <aE> at parameter <aT>.
//! for the point from the edge <aE> at parameter <aT>.<br>
//! If <aE> has't pcurve on surface, algorithm tries to get it by
//! projection and can
//! raise exception Standard_ConstructionError if projection algorithm fails
Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, Standard_Real& U, Standard_Real& V);
//! raise exception Standard_ConstructionError if projection algorithm fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
Standard_Real& U,
Standard_Real& V,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .
//! If the P-Curve does not exist, build it using Make2D().
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
//! If the P-Curve does not exist, build it using Make2D().<br>
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC,
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .
//! If the P-Curve does not exist, build it using Make2D().
//! [aFirst, aLast] - range of the P-Curve
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
//! Get P-Curve <aC> for the edge <aE> on surface <aF> .<br>
//! If the P-Curve does not exist, build it using Make2D().<br>
//! [aFirst, aLast] - range of the P-Curve<br>
//! [aToler] - reached tolerance<br>
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns TRUE if the edge <aE> has P-Curve <aC>
@@ -91,18 +111,28 @@ public:
Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
//! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
const Handle(Geom_Curve)& theC3D,
const Handle(Geom2d_Curve)& theC2D,
Handle(Geom2d_Curve)& theC2DA,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
//! [aT1, aT2] - range to adjust<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
const Standard_Real theFirst,
const Standard_Real theLast,
const Handle(Geom2d_Curve)& theC2D,
Handle(Geom2d_Curve)& theC2DA,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
//! [aT1, aT2] - range to adjust
Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
//! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
//! [aT1, aT2] - range to adjust
Standard_EXPORT static void AdjustPCurveOnFace (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
Standard_EXPORT static void AdjustPCurveOnSurf (const BRepAdaptor_Surface& aF, const Standard_Real aT1, const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
//! Compute intermediate value in between [aFirst, aLast] .
@@ -123,24 +153,43 @@ public:
Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF);
//! Make P-Curve <aC> for the edge <aE> on surface <aF> .
//! [aFirst, aLast] - range of the P-Curve
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if algorithm fails
Standard_EXPORT static void Make2D (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
//! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
//! [aFirst, aLast] - range of the P-Curve<br>
//! [aToler] - reached tolerance<br>
//! Raises exception Standard_ConstructionError if algorithm fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void Make2D (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if projection algorithm fails
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
//! [aToler] - reached tolerance<br>
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& C3D,
Handle(Geom2d_Curve)& aC,
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
//! [aT1, aT2] - range to build
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if projection algorithm fails
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Standard_Real aT1, const Standard_Real aT2, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
//! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
//! [aT1, aT2] - range to build<br>
//! [aToler] - reached tolerance<br>
//! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF,
const Handle(Geom_Curve)& C3D,
const Standard_Real aT1,
const Standard_Real aT2,
Handle(Geom2d_Curve)& aC,
Standard_Real& aToler,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Make empty P-Curve <aC> of relevant to <PC> type

View File

@@ -231,14 +231,15 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
//=======================================================================
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
gp_Dir& aDNF)
gp_Dir& aDNF,
const Handle(IntTools_Context)& theContext)
{
Standard_Real aT, aT1, aT2;
BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF, theContext);
if (aF.Orientation()==TopAbs_REVERSED){
aDNF.Reverse();
@@ -251,7 +252,8 @@ void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF1,
const Standard_Real aT,
gp_Dir& aDNF1)
gp_Dir& aDNF1,
const Handle(IntTools_Context)& theContext)
{
Standard_Real U, V, aTolPC;
gp_Pnt2d aP2D;
@@ -261,7 +263,7 @@ void BOPTools_AlgoTools3D::GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1);
Handle(Geom2d_Curve)aC2D1;
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC);
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC, theContext);
aC2D1->D0(aT, aP2D);
U=aP2D.X();
@@ -511,7 +513,12 @@ void BOPTools_AlgoTools3D::PointNearEdge
gp_Pnt aP;
gp_Pnt2d aP2d;
//
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
if (theContext.IsNull()) {
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
}
else {
theContext->UVBounds(aF, aU1, aU2, aV1, aV2);
}
//
dU=aU2-aU1;
dV=aV2-aV1;
@@ -750,7 +757,12 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace
aFF.Orientation (TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFF);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
if (theContext.IsNull()) {
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
}
else {
theContext->UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
}
//
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
Standard_Integer i;

View File

@@ -49,13 +49,22 @@ public:
//! Computes normal to the face <aF> for the point on the edge <aE>
//! at parameter <aT>
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, gp_Dir& aD);
//! at parameter <aT>.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aT,
gp_Dir& aD,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Computes normal to the face <aF> for the point on the edge <aE>
//! at arbitrary intermediate parameter
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE, const TopoDS_Face& aF, gp_Dir& aD);
//! at arbitrary intermediate parameter.<br>
//! <theContext> - storage for caching the geometrical tools
Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
gp_Dir& aD,
const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
//! Returns 1 if scalar product aNF1* aNF2>0.