1 // Created by: Peter KURNEV
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.
15 #ifndef _BOPTools_AlgoTools2D_HeaderFile
16 #define _BOPTools_AlgoTools2D_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
22 #include <Standard_Boolean.hxx>
23 #include <Standard_Real.hxx>
24 #include <BOPCol_ListOfShape.hxx>
25 #include <Standard_Integer.hxx>
31 class BRepAdaptor_Surface;
32 class ProjLib_ProjectedCurve;
33 class IntTools_Context;
37 //! The class contains handy static functions
38 //! dealing with the topology
39 //! This is the copy of the BOPTools_AlgoTools2D.cdl
40 class BOPTools_AlgoTools2D
48 //! Compute P-Curve for the edge <aE> on the face <aF>
49 //! Raises exception Standard_ConstructionError if projection algorithm fails
50 Standard_EXPORT static void BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, const TopoDS_Face& aF);
53 //! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
54 Standard_EXPORT static Standard_Boolean EdgeTangent (const TopoDS_Edge& anE, const Standard_Real aT, gp_Vec& Tau);
57 //! Compute surface parameters <U,V> of the face <aF>
58 //! for the point from the edge <aE> at parameter <aT>.
59 //! If <aE> has't pcurve on surface, algorithm tries to get it by
60 //! projection and can
61 //! raise exception Standard_ConstructionError if projection algorithm fails
62 Standard_EXPORT static void PointOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, const Standard_Real aT, Standard_Real& U, Standard_Real& V);
65 //! Get P-Curve <aC> for the edge <aE> on surface <aF> .
66 //! If the P-Curve does not exist, build it using Make2D().
67 //! [aToler] - reached tolerance
68 //! Raises exception Standard_ConstructionError if algorithm Make2D() fails
69 Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
72 //! Get P-Curve <aC> for the edge <aE> on surface <aF> .
73 //! If the P-Curve does not exist, build it using Make2D().
74 //! [aFirst, aLast] - range of the P-Curve
75 //! [aToler] - reached tolerance
76 //! Raises exception Standard_ConstructionError if algorithm Make2D() fails
77 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);
80 //! Returns TRUE if the edge <aE> has P-Curve <aC>
82 //! [aFirst, aLast] - range of the P-Curve
83 //! [aToler] - reached tolerance
84 //! If the P-Curve does not exist, aC.IsNull()=TRUE.
85 Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC, Standard_Real& aFirst, Standard_Real& aLast, Standard_Real& aToler);
88 //! Returns TRUE if the edge <aE> has P-Curve <aC>
90 //! If the P-Curve does not exist, aC.IsNull()=TRUE.
91 Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
94 //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
95 Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, const Handle(Geom2d_Curve)& aC2D, Handle(Geom2d_Curve)& aC2DA);
98 //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
99 //! [aT1, aT2] - range to adjust
100 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);
103 //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
104 //! [aT1, aT2] - range to adjust
105 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);
108 //! Compute intermediate value in between [aFirst, aLast] .
109 Standard_EXPORT static Standard_Real IntermediatePoint (const Standard_Real aFirst, const Standard_Real aLast);
112 //! Compute intermediate value of parameter for the edge <anE>.
113 Standard_EXPORT static Standard_Real IntermediatePoint (const TopoDS_Edge& anE);
115 Standard_EXPORT static void BuildPCurveForEdgeOnPlane (const TopoDS_Edge& theE, const TopoDS_Face& theF);
117 Standard_EXPORT static void BuildPCurveForEdgesOnPlane (const BOPCol_ListOfShape& theLE, const TopoDS_Face& theF);
120 //! Make P-Curve <aC> for the edge <aE> on surface <aF> .
121 //! [aFirst, aLast] - range of the P-Curve
122 //! [aToler] - reached tolerance
123 //! Raises exception Standard_ConstructionError if algorithm fails
124 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);
127 //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
128 //! [aToler] - reached tolerance
129 //! Raises exception Standard_ConstructionError if projection algorithm fails
130 Standard_EXPORT static void MakePCurveOnFace (const TopoDS_Face& aF, const Handle(Geom_Curve)& C3D, Handle(Geom2d_Curve)& aC, Standard_Real& aToler);
133 //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .
134 //! [aT1, aT2] - range to build
135 //! [aToler] - reached tolerance
136 //! Raises exception Standard_ConstructionError if projection algorithm fails
137 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);
140 //! Make empty P-Curve <aC> of relevant to <PC> type
141 Standard_EXPORT static void MakePCurveOfType (const ProjLib_ProjectedCurve& PC, Handle(Geom2d_Curve)& aC);
144 //! Attach P-Curve from the edge <aEold> on surface <aF>
145 //! to the edge <aEnew>
146 //! Returns 0 in case of success
147 Standard_EXPORT static Standard_Integer AttachExistingPCurve (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, const TopoDS_Face& aF, const Handle(IntTools_Context)& aCtx);
172 #endif // _BOPTools_AlgoTools2D_HeaderFile