Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-25 09:13:13

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>.<br>
0042   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
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 Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0048 
0049   //! Compute tangent for the edge  <aE> [in 3D]  at parameter <aT>
0050   Standard_EXPORT static Standard_Boolean EdgeTangent(const TopoDS_Edge&  anE,
0051                                                       const Standard_Real aT,
0052                                                       gp_Vec&             Tau);
0053 
0054   //! Compute surface parameters <U,V> of the face <aF>
0055   //! for  the point from the edge <aE> at parameter <aT>.<br>
0056   //! If <aE> has't pcurve on surface, algorithm tries to get it by
0057   //! projection and can
0058   //! raise exception Standard_ConstructionError if projection algorithm fails.<br>
0059   //! <theContext> - storage for caching the geometrical tools
0060   Standard_EXPORT static void PointOnSurface(
0061     const TopoDS_Edge&              aE,
0062     const TopoDS_Face&              aF,
0063     const Standard_Real             aT,
0064     Standard_Real&                  U,
0065     Standard_Real&                  V,
0066     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0067 
0068   //! Get P-Curve <aC>  for the edge <aE> on surface <aF> .<br>
0069   //! If the P-Curve does not exist, build  it using Make2D().<br>
0070   //! [aToler] - reached tolerance
0071   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
0072   //! <theContext> - storage for caching the geometrical tools
0073   Standard_EXPORT static void CurveOnSurface(
0074     const TopoDS_Edge&              aE,
0075     const TopoDS_Face&              aF,
0076     Handle(Geom2d_Curve)&           aC,
0077     Standard_Real&                  aToler,
0078     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0079 
0080   //! Get P-Curve <aC>  for the edge <aE> on surface <aF> .<br>
0081   //! If the P-Curve does not exist, build  it using Make2D().<br>
0082   //! [aFirst, aLast] - range of the P-Curve<br>
0083   //! [aToler] - reached tolerance<br>
0084   //! Raises exception Standard_ConstructionError if algorithm Make2D() fails.<br>
0085   //! <theContext> - storage for caching the geometrical tools
0086   Standard_EXPORT static void CurveOnSurface(
0087     const TopoDS_Edge&              aE,
0088     const TopoDS_Face&              aF,
0089     Handle(Geom2d_Curve)&           aC,
0090     Standard_Real&                  aFirst,
0091     Standard_Real&                  aLast,
0092     Standard_Real&                  aToler,
0093     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0094 
0095   //! Returns TRUE if the edge <aE>  has  P-Curve <aC>
0096   //! on surface <aF> .
0097   //! [aFirst, aLast] - range of the P-Curve
0098   //! [aToler] - reached tolerance
0099   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
0100   Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge&    aE,
0101                                                             const TopoDS_Face&    aF,
0102                                                             Handle(Geom2d_Curve)& aC,
0103                                                             Standard_Real&        aFirst,
0104                                                             Standard_Real&        aLast,
0105                                                             Standard_Real&        aToler);
0106 
0107   //! Returns TRUE if the edge <aE>  has  P-Curve <aC>
0108   //! on surface <aF> .
0109   //! If the P-Curve does not exist, aC.IsNull()=TRUE.
0110   Standard_EXPORT static Standard_Boolean HasCurveOnSurface(const TopoDS_Edge& aE,
0111                                                             const TopoDS_Face& aF);
0112 
0113   //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
0114   //! <theContext> - storage for caching the geometrical tools
0115   Standard_EXPORT static void AdjustPCurveOnFace(
0116     const TopoDS_Face&              theF,
0117     const Handle(Geom_Curve)&       theC3D,
0118     const Handle(Geom2d_Curve)&     theC2D,
0119     Handle(Geom2d_Curve)&           theC2DA,
0120     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0121 
0122   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
0123   //! [aT1,  aT2] - range to adjust<br>
0124   //! <theContext> - storage for caching the geometrical tools
0125   Standard_EXPORT static void AdjustPCurveOnFace(
0126     const TopoDS_Face&              theF,
0127     const Standard_Real             theFirst,
0128     const Standard_Real             theLast,
0129     const Handle(Geom2d_Curve)&     theC2D,
0130     Handle(Geom2d_Curve)&           theC2DA,
0131     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0132 
0133   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .
0134   //! [aT1,  aT2] - range to adjust
0135   Standard_EXPORT static void AdjustPCurveOnSurf(const BRepAdaptor_Surface&  aF,
0136                                                  const Standard_Real         aT1,
0137                                                  const Standard_Real         aT2,
0138                                                  const Handle(Geom2d_Curve)& aC2D,
0139                                                  Handle(Geom2d_Curve)&       aC2DA);
0140 
0141   //! Compute intermediate  value in  between [aFirst, aLast] .
0142   Standard_EXPORT static Standard_Real IntermediatePoint(const Standard_Real aFirst,
0143                                                          const Standard_Real aLast);
0144 
0145   //! Compute intermediate value of parameter for the edge <anE>.
0146   Standard_EXPORT static Standard_Real IntermediatePoint(const TopoDS_Edge& anE);
0147 
0148   //! Make P-Curve <aC> for the edge <aE> on surface <aF> .<br>
0149   //! [aFirst, aLast] - range of the P-Curve<br>
0150   //! [aToler] - reached tolerance<br>
0151   //! Raises exception Standard_ConstructionError if algorithm fails.<br>
0152   //! <theContext> - storage for caching the geometrical tools
0153   Standard_EXPORT static void Make2D(
0154     const TopoDS_Edge&              aE,
0155     const TopoDS_Face&              aF,
0156     Handle(Geom2d_Curve)&           aC,
0157     Standard_Real&                  aFirst,
0158     Standard_Real&                  aLast,
0159     Standard_Real&                  aToler,
0160     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0161 
0162   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
0163   //! [aToler] - reached tolerance<br>
0164   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
0165   //! <theContext> - storage for caching the geometrical tools
0166   Standard_EXPORT static void MakePCurveOnFace(
0167     const TopoDS_Face&              aF,
0168     const Handle(Geom_Curve)&       C3D,
0169     Handle(Geom2d_Curve)&           aC,
0170     Standard_Real&                  aToler,
0171     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0172 
0173   //! Make P-Curve <aC> for the 3D-curve <C3D> on surface <aF> .<br>
0174   //! [aT1,  aT2] - range to build<br>
0175   //! [aToler] - reached tolerance<br>
0176   //! Raises exception Standard_ConstructionError if projection algorithm fails.<br>
0177   //! <theContext> - storage for caching the geometrical tools
0178   Standard_EXPORT static void MakePCurveOnFace(
0179     const TopoDS_Face&              aF,
0180     const Handle(Geom_Curve)&       C3D,
0181     const Standard_Real             aT1,
0182     const Standard_Real             aT2,
0183     Handle(Geom2d_Curve)&           aC,
0184     Standard_Real&                  aToler,
0185     const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0186 
0187   //! Attach P-Curve from the edge <aEold> on surface <aF>
0188   //! to the edge <aEnew>
0189   //! Returns 0 in case of success
0190   Standard_EXPORT static Standard_Integer AttachExistingPCurve(
0191     const TopoDS_Edge&              aEold,
0192     const TopoDS_Edge&              aEnew,
0193     const TopoDS_Face&              aF,
0194     const Handle(IntTools_Context)& aCtx);
0195 
0196   //! Checks if CurveOnSurface of theE on theF matches with isoline of theF surface.
0197   //! Sets corresponding values for isTheUIso and isTheVIso variables.
0198   //!
0199   //! ATTENTION!!!
0200   //! This method is based on the comparison between direction of
0201   //! surface (which theF is based on) iso-lines and the direction
0202   //! of the edge p-curve (on theF) in middle-point of the p-curve.
0203   //!
0204   //! This method should be used carefully
0205   //! (e.g. BRep_Tool::IsClosed(...) together) in order to avoid
0206   //! false classification some p-curves as isoline (e.g. circle on a plane).
0207   Standard_EXPORT static void IsEdgeIsoline(const TopoDS_Edge& theE,
0208                                             const TopoDS_Face& theF,
0209                                             Standard_Boolean&  isTheUIso,
0210                                             Standard_Boolean&  isTheVIso);
0211 };
0212 
0213 #endif // _BOPTools_AlgoTools2D_HeaderFile