Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:05

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