0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Approx / Approx_CurveOnSurface.hxx
1 // Created on: 1997-09-30
2 // Created by: Roman BORISOV
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Approx_CurveOnSurface_HeaderFile
18 #define _Approx_CurveOnSurface_HeaderFile
19
20 #include <Adaptor2d_Curve2d.hxx>
21 #include <Adaptor3d_Surface.hxx>
22 #include <GeomAbs_Shape.hxx>
23
24 class Geom_BSplineCurve;
25 class Geom2d_BSplineCurve;
26
27 //! Approximation of   curve on surface
28 class Approx_CurveOnSurface 
29 {
30 public:
31
32   DEFINE_STANDARD_ALLOC
33
34   //! This constructor calls perform method. This constructor is deprecated.
35   Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
36   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);
37
38   //! This constructor does not call perform method.
39   //! @param theC2D   2D Curve to be approximated in 3D.
40   //! @param theSurf  Surface where 2D curve is located.
41   //! @param theFirst First parameter of resulting curve.
42   //! @param theFirst Last parameter of resulting curve.
43   //! @param theTol   Computation tolerance.
44   Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
45                                         const Handle(Adaptor3d_Surface)& theSurf,
46                                         const Standard_Real               theFirst,
47                                         const Standard_Real               theLast,
48                                         const Standard_Real               theTol);
49
50   Standard_EXPORT Standard_Boolean IsDone() const;
51   
52   Standard_EXPORT Standard_Boolean HasResult() const;
53   
54   Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
55   
56   Standard_EXPORT Standard_Real MaxError3d() const;
57   
58   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const;
59   
60   Standard_EXPORT Standard_Real MaxError2dU() const;
61   
62   //! returns the maximum errors relatively to the  U component or the V component of the
63   //! 2d Curve
64   Standard_EXPORT Standard_Real MaxError2dV() const;
65
66   //! Constructs the 3d curve. Input parameters are ignored when the input curve is
67   //! U-isoline or V-isoline.
68   //! @param theMaxSegments Maximal number of segments in the resulting spline.
69   //! @param theMaxDegree   Maximal degree of the result.
70   //! @param theContinuity  Resulting continuity.
71   //! @param theOnly3d      Determines building only 3D curve.
72   //! @param theOnly2d      Determines building only 2D curve.
73   Standard_EXPORT void Perform(const Standard_Integer theMaxSegments, 
74                                const Standard_Integer theMaxDegree, 
75                                const GeomAbs_Shape    theContinuity,
76                                const Standard_Boolean theOnly3d = Standard_False,
77                                const Standard_Boolean theOnly2d = Standard_False);
78
79 protected:
80
81   //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
82   //! or geometric line. This line should have natural parameterization.
83   //! @param theC2D       Trimmed curve to be checked.
84   //! @param theIsU       Flag indicating that line is u const.
85   //! @param theParam     Line parameter.
86   //! @param theIsForward Flag indicating forward parameterization on a isoline.
87   //! @return Standard_True when 2d curve is a line and Standard_False otherwise.
88   Standard_Boolean isIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
89                              Standard_Boolean&                theIsU,
90                              Standard_Real&                   theParam,
91                              Standard_Boolean&                theIsForward) const;
92
93   //! Builds 3D curve for a isoline. This method takes corresponding isoline from
94   //! the input surface.
95   //! @param theC2D   Trimmed curve to be approximated.
96   //! @param theIsU   Flag indicating that line is u const.
97   //! @param theParam Line parameter.
98   //! @param theIsForward Flag indicating forward parameterization on a isoline.
99   //! @return Standard_True when 3d curve is built and Standard_False otherwise.
100   Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
101                                      const Standard_Boolean           theIsU,
102                                      const Standard_Real              theParam,
103                                      const Standard_Boolean           theIsForward);
104
105 private:
106   Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
107
108 private:
109
110   //! Input curve.
111   const Handle(Adaptor2d_Curve2d) myC2D;
112
113   //! Input surface.
114   const Handle(Adaptor3d_Surface) mySurf;
115
116   //! First parameter of the result.
117   const Standard_Real myFirst;
118
119   //! Last parameter of the result.
120   const Standard_Real myLast;
121
122   //! Tolerance.
123   Standard_Real myTol;
124
125   Handle(Geom2d_BSplineCurve) myCurve2d;
126   Handle(Geom_BSplineCurve) myCurve3d;
127   Standard_Boolean myIsDone;
128   Standard_Boolean myHasResult;
129   Standard_Real myError3d;
130   Standard_Real myError2dU;
131   Standard_Real myError2dV;
132
133 };
134
135 #endif // _Approx_CurveOnSurface_HeaderFile