Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:21:11

0001 // Created on: 1997-09-30
0002 // Created by: Roman BORISOV
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Approx_CurveOnSurface_HeaderFile
0018 #define _Approx_CurveOnSurface_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022 #include <GeomAbs_Shape.hxx>
0023 
0024 class Geom_BSplineCurve;
0025 class Geom2d_BSplineCurve;
0026 
0027 //! Approximation of curve on surface
0028 class Approx_CurveOnSurface
0029 {
0030 public:
0031   DEFINE_STANDARD_ALLOC
0032 
0033   //! This constructor calls perform method. This constructor is deprecated.
0034   Standard_DEPRECATED(
0035     "This constructor is deprecated. Use other constructor and perform method instead.")
0036   Standard_EXPORT Approx_CurveOnSurface(const occ::handle<Adaptor2d_Curve2d>& C2D,
0037                                         const occ::handle<Adaptor3d_Surface>& Surf,
0038                                         const double                          First,
0039                                         const double                          Last,
0040                                         const double                          Tol,
0041                                         const GeomAbs_Shape                   Continuity,
0042                                         const int                             MaxDegree,
0043                                         const int                             MaxSegments,
0044                                         const bool                            Only3d = false,
0045                                         const bool                            Only2d = false);
0046 
0047   //! This constructor does not call perform method.
0048   //! @param theC2D   2D Curve to be approximated in 3D.
0049   //! @param theSurf  Surface where 2D curve is located.
0050   //! @param theFirst First parameter of resulting curve.
0051   //! @param theFirst Last parameter of resulting curve.
0052   //! @param theTol   Computation tolerance.
0053   Standard_EXPORT Approx_CurveOnSurface(const occ::handle<Adaptor2d_Curve2d>& theC2D,
0054                                         const occ::handle<Adaptor3d_Surface>& theSurf,
0055                                         const double                          theFirst,
0056                                         const double                          theLast,
0057                                         const double                          theTol);
0058 
0059   Standard_EXPORT bool IsDone() const;
0060 
0061   Standard_EXPORT bool HasResult() const;
0062 
0063   Standard_EXPORT occ::handle<Geom_BSplineCurve> Curve3d() const;
0064 
0065   Standard_EXPORT double MaxError3d() const;
0066 
0067   Standard_EXPORT occ::handle<Geom2d_BSplineCurve> Curve2d() const;
0068 
0069   Standard_EXPORT double MaxError2dU() const;
0070 
0071   //! returns the maximum errors relatively to the U component or the V component of the
0072   //! 2d Curve
0073   Standard_EXPORT double MaxError2dV() const;
0074 
0075   //! Constructs the 3d curve. Input parameters are ignored when the input curve is
0076   //! U-isoline or V-isoline.
0077   //! @param theMaxSegments Maximal number of segments in the resulting spline.
0078   //! @param theMaxDegree   Maximal degree of the result.
0079   //! @param theContinuity  Resulting continuity.
0080   //! @param theOnly3d      Determines building only 3D curve.
0081   //! @param theOnly2d      Determines building only 2D curve.
0082   Standard_EXPORT void Perform(const int           theMaxSegments,
0083                                const int           theMaxDegree,
0084                                const GeomAbs_Shape theContinuity,
0085                                const bool          theOnly3d = false,
0086                                const bool          theOnly2d = false);
0087 
0088 protected:
0089   //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
0090   //! or geometric line. This line should have natural parameterization.
0091   //! @param theC2D       Trimmed curve to be checked.
0092   //! @param theIsU       Flag indicating that line is u const.
0093   //! @param theParam     Line parameter.
0094   //! @param theIsForward Flag indicating forward parameterization on a isoline.
0095   //! @return true when 2d curve is a line and false otherwise.
0096   bool isIsoLine(const occ::handle<Adaptor2d_Curve2d>& theC2D,
0097                  bool&                                 theIsU,
0098                  double&                               theParam,
0099                  bool&                                 theIsForward) const;
0100 
0101   //! Builds 3D curve for a isoline. This method takes corresponding isoline from
0102   //! the input surface.
0103   //! @param theC2D   Trimmed curve to be approximated.
0104   //! @param theIsU   Flag indicating that line is u const.
0105   //! @param theParam Line parameter.
0106   //! @param theIsForward Flag indicating forward parameterization on a isoline.
0107   //! @return true when 3d curve is built and false otherwise.
0108   bool buildC3dOnIsoLine(const occ::handle<Adaptor2d_Curve2d>& theC2D,
0109                          const bool                            theIsU,
0110                          const double                          theParam,
0111                          const bool                            theIsForward);
0112 
0113 private:
0114   Approx_CurveOnSurface& operator=(const Approx_CurveOnSurface&) = delete;
0115 
0116 private:
0117   //! Input curve.
0118   const occ::handle<Adaptor2d_Curve2d> myC2D;
0119 
0120   //! Input surface.
0121   const occ::handle<Adaptor3d_Surface> mySurf;
0122 
0123   //! First parameter of the result.
0124   const double myFirst;
0125 
0126   //! Last parameter of the result.
0127   const double myLast;
0128 
0129   //! Tolerance.
0130   double myTol;
0131 
0132   occ::handle<Geom2d_BSplineCurve> myCurve2d;
0133   occ::handle<Geom_BSplineCurve>   myCurve3d;
0134   bool                             myIsDone;
0135   bool                             myHasResult;
0136   double                           myError3d;
0137   double                           myError2dU;
0138   double                           myError2dV;
0139 };
0140 
0141 #endif // _Approx_CurveOnSurface_HeaderFile