Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-23 10:18:33

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _BOPTools_AlgoTools2D_HeaderFile
0016 #define _BOPTools_AlgoTools2D_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <Standard_Boolean.hxx>
0023 #include <Standard_Real.hxx>
0024 #include <Standard_Integer.hxx>
0025 class TopoDS_Edge;
0026 class TopoDS_Face;
0027 class gp_Vec;
0028 class Geom2d_Curve;
0029 class Geom_Curve;
0030 class BRepAdaptor_Surface;
0031 class IntTools_Context;
0032 
0033 //! The class contains handy static functions
0034 //! dealing with the topology
0035 //! This is the copy of the BOPTools_AlgoTools2D.cdl
0036 class BOPTools_AlgoTools2D
0037 {
0038 public:
0039   DEFINE_STANDARD_ALLOC
0040 
0041   //! Compute P-Curve for the edge <aE> on the face <aF>.
0042   //! Raises exception Standard_ConstructionError if projection algorithm fails.
0043   //! <theContext> - storage for caching the geometrical tools
0044   Standard_EXPORT static void BuildPCurveForEdgeOnFace(
0045     const TopoDS_Edge&                   aE,
0046     const TopoDS_Face&                   aF,
0047     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0048 
0049   //! Compute tangent for the edge <aE> [in 3D] at parameter <aT>
0050   Standard_EXPORT static bool EdgeTangent(const TopoDS_Edge& anE, const double aT, gp_Vec& Tau);
0051 
0052   //! Compute surface parameters <U,V> of the face <aF>
0053   //! for the point from the edge <aE> at parameter <aT>.
0054   //! If <aE> has't pcurve on surface, algorithm tries to get it by
0055   //! projection and can raise exception
0056   //! Standard_ConstructionError if projection algorithm fails.
0057   //! <theContext> - storage for caching the geometrical tools
0058   Standard_EXPORT static void PointOnSurface(
0059     const TopoDS_Edge&                   aE,
0060     const TopoDS_Face&                   aF,
0061     const double                         aT,
0062     double&                              U,
0063     double&                              V,
0064     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0065 
0066   //! Get P-Curve <aC> for the edge <aE> on surface <aF>.
0067   //! If the P-Curve does not exist, build it using Make2D().
0068   //! [aToler] - reached tolerance
0069   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
0070   //! <theContext> - storage for caching the geometrical tools
0071   Standard_EXPORT static void CurveOnSurface(
0072     const TopoDS_Edge&                   aE,
0073     const TopoDS_Face&                   aF,
0074     occ::handle<Geom2d_Curve>&           aC,
0075     double&                              aToler,
0076     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0077 
0078   //! Get P-Curve <aC> for the edge <aE> on surface <aF>.
0079   //! If the P-Curve does not exist, build it using Make2D().
0080   //! [aFirst, aLast] - range of the P-Curve
0081   //! [aToler] - reached tolerance
0082   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.
0083   //! <theContext> - storage for caching the geometrical tools
0084   Standard_EXPORT static void CurveOnSurface(
0085     const TopoDS_Edge&                   aE,
0086     const TopoDS_Face&                   aF,
0087     occ::handle<Geom2d_Curve>&           aC,
0088     double&                              aFirst,
0089     double&                              aLast,
0090     double&                              aToler,
0091     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0092 
0093   //! Returns TRUE if the edge <aE> has P-Curve <aC>
0094   //! on surface <aF>.
0095   //! [aFirst, aLast] - range of the P-Curve
0096   //! [aToler] - reached tolerance
0097   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
0098   Standard_EXPORT static bool HasCurveOnSurface(const TopoDS_Edge&         aE,
0099                                                 const TopoDS_Face&         aF,
0100                                                 occ::handle<Geom2d_Curve>& aC,
0101                                                 double&                    aFirst,
0102                                                 double&                    aLast,
0103                                                 double&                    aToler);
0104 
0105   //! Returns TRUE if the edge <aE> has P-Curve <aC>
0106   //! on surface <aF>.
0107   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
0108   Standard_EXPORT static bool HasCurveOnSurface(const TopoDS_Edge& aE, const TopoDS_Face& aF);
0109 
0110   //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.
0111   //! <theContext> - storage for caching the geometrical tools
0112   Standard_EXPORT static void AdjustPCurveOnFace(
0113     const TopoDS_Face&                   theF,
0114     const occ::handle<Geom_Curve>&       theC3D,
0115     const occ::handle<Geom2d_Curve>&     theC2D,
0116     occ::handle<Geom2d_Curve>&           theC2DA,
0117     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0118 
0119   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF>.
0120   //! [aT1, aT2] - range to adjust
0121   //! <theContext> - storage for caching the geometrical tools
0122   Standard_EXPORT static void AdjustPCurveOnFace(
0123     const TopoDS_Face&                   theF,
0124     const double                         theFirst,
0125     const double                         theLast,
0126     const occ::handle<Geom2d_Curve>&     theC2D,
0127     occ::handle<Geom2d_Curve>&           theC2DA,
0128     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0129 
0130   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF>.
0131   //! [aT1, aT2] - range to adjust
0132   Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface&       aF,
0133                                                  const double                     aT1,
0134                                                  const double                     aT2,
0135                                                  const occ::handle<Geom2d_Curve>& aC2D,
0136                                                  occ::handle<Geom2d_Curve>&       aC2DA);
0137 
0138   //! Compute intermediate value in between [aFirst, aLast].
0139   Standard_EXPORT static double IntermediatePoint(const double aFirst, const double aLast);
0140 
0141   //! Compute intermediate value of parameter for the edge <anE>.
0142   Standard_EXPORT static double IntermediatePoint(const TopoDS_Edge& anE);
0143 
0144   //! Make P-Curve <aC> for the edge <aE> on surface <aF>.
0145   //! [aFirst, aLast] - range of the P-Curve
0146   //! [aToler] - reached tolerance
0147   //! Raises exception Standard_ConstructionError if algorithm fails.
0148   //! <theContext> - storage for caching the geometrical tools
0149   Standard_EXPORT static void Make2D(
0150     const TopoDS_Edge&                   aE,
0151     const TopoDS_Face&                   aF,
0152     occ::handle<Geom2d_Curve>&           aC,
0153     double&                              aFirst,
0154     double&                              aLast,
0155     double&                              aToler,
0156     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0157 
0158   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF>.
0159   //! [aToler] - reached tolerance
0160   //! Raises exception Standard_ConstructionError if projection algorithm fails.
0161   //! <theContext> - storage for caching the geometrical tools
0162   Standard_EXPORT static void MakePCurveOnFace(
0163     const TopoDS_Face&                   aF,
0164     const occ::handle<Geom_Curve>&       C3D,
0165     occ::handle<Geom2d_Curve>&           aC,
0166     double&                              aToler,
0167     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0168 
0169   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF>.
0170   //! [aT1, aT2] - range to build
0171   //! [aToler] - reached tolerance
0172   //! Raises exception Standard_ConstructionError if projection algorithm fails.
0173   //! <theContext> - storage for caching the geometrical tools
0174   Standard_EXPORT static void MakePCurveOnFace(
0175     const TopoDS_Face&                   aF,
0176     const occ::handle<Geom_Curve>&       C3D,
0177     const double                         aT1,
0178     const double                         aT2,
0179     occ::handle<Geom2d_Curve>&           aC,
0180     double&                              aToler,
0181     const occ::handle<IntTools_Context>& theContext = occ::handle<IntTools_Context>());
0182 
0183   //! Attach P-Curve from the edge <aEold> on surface <aF>
0184   //! to the edge <aEnew>
0185   //! Returns 0 in case of success
0186   Standard_EXPORT static int AttachExistingPCurve(const TopoDS_Edge&                   aEold,
0187                                                   const TopoDS_Edge&                   aEnew,
0188                                                   const TopoDS_Face&                   aF,
0189                                                   const occ::handle<IntTools_Context>& aCtx);
0190 
0191   //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
0192   //! Sets corresponding values for isTheUIso and isTheVIso variables.
0193   //!
0194   //! ATTENTION!!!
0195   //! This method is based on the comparison between direction of
0196   //! surface (which theF is based on) iso-lines and the direction
0197   //! of the edge p-curve (on theF) in middle-point of the p-curve.
0198   //!
0199   //! This method should be used carefully
0200   //! (e.g. BRep_Tool::IsClosed(...) together) in order to avoid
0201   //! false classification some p-curves as isoline (e.g. circle on a plane).
0202   Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
0203                                             const TopoDS_Face& theF,
0204                                             bool&              isTheUIso,
0205                                             bool&              isTheVIso);
0206 };
0207 
0208 #endif // _BOPTools_AlgoTools2D_HeaderFile