Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:58

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 
0032   DEFINE_STANDARD_ALLOC
0033 
0034   //! This constructor calls perform method. This constructor is deprecated.
0035   Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
0036   Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
0037 
0038   //! This constructor does not call perform method.
0039   //! @param theC2D   2D Curve to be approximated in 3D.
0040   //! @param theSurf  Surface where 2D curve is located.
0041   //! @param theFirst First parameter of resulting curve.
0042   //! @param theFirst Last parameter of resulting curve.
0043   //! @param theTol   Computation tolerance.
0044   Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
0045                                         const Handle(Adaptor3d_Surface)& theSurf,
0046                                         const Standard_Real               theFirst,
0047                                         const Standard_Real               theLast,
0048                                         const Standard_Real               theTol);
0049 
0050   Standard_EXPORT Standard_Boolean IsDone() const;
0051   
0052   Standard_EXPORT Standard_Boolean HasResult() const;
0053   
0054   Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
0055   
0056   Standard_EXPORT Standard_Real MaxError3d() const;
0057   
0058   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const;
0059   
0060   Standard_EXPORT Standard_Real MaxError2dU() const;
0061   
0062   //! returns the maximum errors relatively to the  U component or the V component of the
0063   //! 2d Curve
0064   Standard_EXPORT Standard_Real MaxError2dV() const;
0065 
0066   //! Constructs the 3d curve. Input parameters are ignored when the input curve is
0067   //! U-isoline or V-isoline.
0068   //! @param theMaxSegments Maximal number of segments in the resulting spline.
0069   //! @param theMaxDegree   Maximal degree of the result.
0070   //! @param theContinuity  Resulting continuity.
0071   //! @param theOnly3d      Determines building only 3D curve.
0072   //! @param theOnly2d      Determines building only 2D curve.
0073   Standard_EXPORT void Perform(const Standard_Integer theMaxSegments, 
0074                                const Standard_Integer theMaxDegree, 
0075                                const GeomAbs_Shape    theContinuity,
0076                                const Standard_Boolean theOnly3d = Standard_False,
0077                                const Standard_Boolean theOnly2d = Standard_False);
0078 
0079 protected:
0080 
0081   //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
0082   //! or geometric line. This line should have natural parameterization.
0083   //! @param theC2D       Trimmed curve to be checked.
0084   //! @param theIsU       Flag indicating that line is u const.
0085   //! @param theParam     Line parameter.
0086   //! @param theIsForward Flag indicating forward parameterization on a isoline.
0087   //! @return Standard_True when 2d curve is a line and Standard_False otherwise.
0088   Standard_Boolean isIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
0089                              Standard_Boolean&                theIsU,
0090                              Standard_Real&                   theParam,
0091                              Standard_Boolean&                theIsForward) const;
0092 
0093   //! Builds 3D curve for a isoline. This method takes corresponding isoline from
0094   //! the input surface.
0095   //! @param theC2D   Trimmed curve to be approximated.
0096   //! @param theIsU   Flag indicating that line is u const.
0097   //! @param theParam Line parameter.
0098   //! @param theIsForward Flag indicating forward parameterization on a isoline.
0099   //! @return Standard_True when 3d curve is built and Standard_False otherwise.
0100   Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
0101                                      const Standard_Boolean           theIsU,
0102                                      const Standard_Real              theParam,
0103                                      const Standard_Boolean           theIsForward);
0104 
0105 private:
0106   Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
0107 
0108 private:
0109 
0110   //! Input curve.
0111   const Handle(Adaptor2d_Curve2d) myC2D;
0112 
0113   //! Input surface.
0114   const Handle(Adaptor3d_Surface) mySurf;
0115 
0116   //! First parameter of the result.
0117   const Standard_Real myFirst;
0118 
0119   //! Last parameter of the result.
0120   const Standard_Real myLast;
0121 
0122   //! Tolerance.
0123   Standard_Real myTol;
0124 
0125   Handle(Geom2d_BSplineCurve) myCurve2d;
0126   Handle(Geom_BSplineCurve) myCurve3d;
0127   Standard_Boolean myIsDone;
0128   Standard_Boolean myHasResult;
0129   Standard_Real myError3d;
0130   Standard_Real myError2dU;
0131   Standard_Real myError2dV;
0132 
0133 };
0134 
0135 #endif // _Approx_CurveOnSurface_HeaderFile