From e29426afd412ed1565c36cede196630de8b74928 Mon Sep 17 00:00:00 2001 From: nbv Date: Wed, 13 Dec 2017 16:41:51 +0300 Subject: [PATCH] src/BOPTools/BOPTools_AlgoTools.cxx --- src/BOPTools/BOPTools_AlgoTools.cxx | 24 ++--- src/BOPTools/BOPTools_AlgoTools2D.cxx | 16 ---- src/BOPTools/BOPTools_AlgoTools2D.hxx | 124 ++++++++++++-------------- src/BRepOffset/BRepOffset_Tool.cxx | 38 +++----- 4 files changed, 78 insertions(+), 124 deletions(-) diff --git a/src/BOPTools/BOPTools_AlgoTools.cxx b/src/BOPTools/BOPTools_AlgoTools.cxx index f6a0fa1ccb..6d1acdfc22 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cxx +++ b/src/BOPTools/BOPTools_AlgoTools.cxx @@ -1580,9 +1580,7 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE, // aTolE=BRep_Tool::Tolerance(aE); // - const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2); - Handle(Geom_TrimmedCurve)aC3DETrim= - new Geom_TrimmedCurve(aC3DE, aT1, aT2); + BRep_Tool::Range(aE, aT1, aT2); // for (i=0; i<2; ++i) { bPC = !i ? bPC1 : bPC2; @@ -1602,22 +1600,16 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE, aFFWD.Orientation(TopAbs_FORWARD); // aC2D=aC2Dx1; - if (aC2D.IsNull()) { + if (aC2D.IsNull()) + { BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext); - BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D, - aOutFirst, aOutLast, - aOutTol, theContext); - } - // - if (aC3DE->IsPeriodic111()) { - BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, - aC2DA, theContext); - } - else { - BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, - aC2DA, theContext); + BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D, + aOutFirst, aOutLast, + aOutTol, theContext); } // + BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA, theContext); + // aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE); //BRepLib::SameParameter(aE); } diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx index 4b370d16bf..d0d82f5acb 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx @@ -250,22 +250,6 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface //function : AdjustPCurveOnFace //purpose : //======================================================================= -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 = theC3D->FirstParameter(); - Standard_Real aT2 = theC3D->LastParameter(); - // - BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext); -} -//======================================================================= -//function : AdjustPCurveOnFace -//purpose : -//======================================================================= void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& theF, const Standard_Real theFirst, diff --git a/src/BOPTools/BOPTools_AlgoTools2D.hxx b/src/BOPTools/BOPTools_AlgoTools2D.hxx index 8db49a549d..1211083059 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.hxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.hxx @@ -45,38 +45,38 @@ public: //! Compute P-Curve for the edge on the face .
//! Raises exception Standard_ConstructionError if projection algorithm fails.
//! - 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)()); - + 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 [in 3D] at parameter Standard_EXPORT static Standard_Boolean EdgeTangent(const TopoDS_Edge& anE, const Standard_Real aT, gp_Vec& Tau); - + //! Compute surface parameters of the face //! for the point from the edge at parameter .
//! If has't pcurve on surface, algorithm tries to get it by //! projection and can //! raise exception Standard_ConstructionError if projection algorithm fails.
//! - 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)()); - + 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 for the edge on surface .
//! If the P-Curve does not exist, build it using Make2D().
//! [aToler] - reached tolerance //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
//! - 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)()); + 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 for the edge on surface .
//! If the P-Curve does not exist, build it using Make2D().
@@ -84,14 +84,14 @@ public: //! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
//! - 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)()); - + 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 has P-Curve //! on surface . //! [aFirst, aLast] - range of the P-Curve @@ -103,30 +103,22 @@ public: Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler); - + //! Returns TRUE if the edge has P-Curve //! on surface . //! If the P-Curve does not exist, aC.IsNull()=TRUE. Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE, const TopoDS_Face& aF); - - //! Adjust P-Curve (3D-curve ) on surface of the face .
- //! - 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 (3D-curve ) on surface .
//! [aT1, aT2] - range to adjust
//! - 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)()); + 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 (3D-curve ) on surface . //! [aT1, aT2] - range to adjust @@ -135,50 +127,50 @@ public: const Standard_Real aT2, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA); - + //! Compute intermediate value in between [aFirst, aLast] . Standard_EXPORT static Standard_Real IntermediatePoint(const Standard_Real aFirst, const Standard_Real aLast); - + //! Compute intermediate value of parameter for the edge . - Standard_EXPORT static Standard_Real IntermediatePoint(const TopoDS_Edge& anE); + Standard_EXPORT static Standard_Real IntermediatePoint (const TopoDS_Edge& anE); //! Make P-Curve for the edge on surface .
//! [aFirst, aLast] - range of the P-Curve
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if algorithm fails.
//! - 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)()); - + 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 for the 3D-curve on surface .
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if projection algorithm fails.
//! - 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)()); - + 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 for the 3D-curve on surface .
//! [aT1, aT2] - range to build
//! [aToler] - reached tolerance
//! Raises exception Standard_ConstructionError if projection algorithm fails.
//! - 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)()); - + 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)()); + //! Attach P-Curve from the edge on surface //! to the edge //! Returns 0 in case of success diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index 263399a339..8560bd3169 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -1496,43 +1496,29 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1, continue; Standard_Real f, l; - const Handle(Geom_Curve)& aC3DE = BRep_Tool::Curve(anEdge, f, l); - Handle(Geom_TrimmedCurve) aC3DETrim; - - if(!aC3DE.IsNull()) - aC3DETrim = new Geom_TrimmedCurve(aC3DE, f, l); - + const Handle(Geom_Curve)& aC3DE = BRep_Tool::Curve(anEdge, f, l); + Standard_Real aTolEdge = BRep_Tool::Tolerance(anEdge); if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F1)) { Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d(); - if(!aC3DETrim.IsNull()) { - Handle(Geom2d_Curve) aC2dNew; - - if(aC3DE->IsPeriodic111()) { + if (!aC3DE.IsNull()) + { + Handle(Geom2d_Curve) aC2dNew; BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l, aC2d, aC2dNew, aContext); - } - else { - BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext); - } - aC2d = aC2dNew; - } + aC2d = aC2dNew; + } BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge); } if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F2)) { Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d(); - if(!aC3DETrim.IsNull()) { - Handle(Geom2d_Curve) aC2dNew; - - if(aC3DE->IsPeriodic111()) { + if (!aC3DE.IsNull()) + { + Handle(Geom2d_Curve) aC2dNew; BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l, aC2d, aC2dNew, aContext); - } - else { - BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext); - } - aC2d = aC2dNew; - } + aC2d = aC2dNew; + } BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge); } -- 2.39.5