// Created by: Peter KURNEV // 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. #ifndef _BOPTools_AlgoTools2D_HeaderFile #define _BOPTools_AlgoTools2D_HeaderFile #include "Standard.hxx" #include "Standard_DefineAlloc.hxx" #include "Standard_Handle.hxx" #include "Standard_Boolean.hxx" #include "Standard_Real.hxx" #include "Standard_Integer.hxx" class TopoDS_Edge; class TopoDS_Face; class gp_Vec; class Geom2d_Curve; class Geom_Curve; class BRepAdaptor_Surface; class IntTools_Context; //! The class contains handy static functions //! dealing with the topology //! This is the copy of the BOPTools_AlgoTools2D.cdl class BOPTools_AlgoTools2D { public: DEFINE_STANDARD_ALLOC //! 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 occ::handle& theContext = occ::handle()); //! Compute tangent for the edge [in 3D] at parameter Standard_EXPORT static bool EdgeTangent(const TopoDS_Edge& anE, const double 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 double aT, double& U, double& V, const occ::handle& theContext = occ::handle()); //! 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, occ::handle& aC, double& aToler, const occ::handle& theContext = occ::handle()); //! Get P-Curve for the edge on surface . //! 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. //! - storage for caching the geometrical tools Standard_EXPORT static void CurveOnSurface( const TopoDS_Edge& aE, const TopoDS_Face& aF, occ::handle& aC, double& aFirst, double& aLast, double& aToler, const occ::handle& theContext = occ::handle()); //! Returns TRUE if the edge has P-Curve //! on surface . //! [aFirst, aLast] - range of the P-Curve //! [aToler] - reached tolerance //! If the P-Curve does not exist, aC.IsNull()=TRUE. Standard_EXPORT static bool HasCurveOnSurface(const TopoDS_Edge& aE, const TopoDS_Face& aF, occ::handle& aC, double& aFirst, double& aLast, double& aToler); //! Returns TRUE if the edge has P-Curve //! on surface . //! If the P-Curve does not exist, aC.IsNull()=TRUE. Standard_EXPORT static bool 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 occ::handle& theC3D, const occ::handle& theC2D, occ::handle& theC2DA, const occ::handle& theContext = occ::handle()); //! 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 double theFirst, const double theLast, const occ::handle& theC2D, occ::handle& theC2DA, const occ::handle& theContext = occ::handle()); //! Adjust P-Curve (3D-curve ) on surface . //! [aT1, aT2] - range to adjust Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface& aF, const double aT1, const double aT2, const occ::handle& aC2D, occ::handle& aC2DA); //! Compute intermediate value in between [aFirst, aLast]. Standard_EXPORT static double IntermediatePoint(const double aFirst, const double aLast); //! Compute intermediate value of parameter for the edge . Standard_EXPORT static double 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, occ::handle& aC, double& aFirst, double& aLast, double& aToler, const occ::handle& theContext = occ::handle()); //! 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 occ::handle& C3D, occ::handle& aC, double& aToler, const occ::handle& theContext = occ::handle()); //! 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 occ::handle& C3D, const double aT1, const double aT2, occ::handle& aC, double& aToler, const occ::handle& theContext = occ::handle()); //! Attach P-Curve from the edge on surface //! to the edge //! Returns 0 in case of success Standard_EXPORT static int AttachExistingPCurve(const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, const TopoDS_Face& aF, const occ::handle& aCtx); //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface. //! Sets corresponding values for isTheUIso and isTheVIso variables. //! //! ATTENTION!!! //! This method is based on the comparison between direction of //! surface (which theF is based on) iso-lines and the direction //! of the edge p-curve (on theF) in middle-point of the p-curve. //! //! This method should be used carefully //! (e.g. BRep_Tool::IsClosed(...) together) in order to avoid //! false classification some p-curves as isoline (e.g. circle on a plane). Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE, const TopoDS_Face& theF, bool& isTheUIso, bool& isTheVIso); }; #endif // _BOPTools_AlgoTools2D_HeaderFile