42cf5bc1 |
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 <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <GeomAbs_Shape.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | class Geom2d_BSplineCurve; |
29 | class Geom_BSplineCurve; |
30 | class Standard_OutOfRange; |
31 | class Standard_ConstructionError; |
32 | class Adaptor2d_HCurve2d; |
33 | class Adaptor3d_HSurface; |
34 | |
35 | |
36 | //! Approximation of curve on surface |
37 | class Approx_CurveOnSurface |
38 | { |
39 | public: |
40 | |
41 | DEFINE_STANDARD_ALLOC |
42 | |
f04de133 |
43 | //! This constructor calls perform method. This constructor is deprecated. |
44 | Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.") |
42cf5bc1 |
45 | Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& 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); |
f04de133 |
46 | |
47 | //! This constructor does not call perform method. |
48 | //! @param theC2D 2D Curve to be approximated in 3D. |
49 | //! @param theSurf Surface where 2D curve is located. |
50 | //! @param theFirst First parameter of resulting curve. |
51 | //! @param theFirst Last parameter of resulting curve. |
52 | //! @param theTol Computation tolerance. |
53 | Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_HCurve2d)& theC2D, |
54 | const Handle(Adaptor3d_HSurface)& theSurf, |
55 | const Standard_Real theFirst, |
56 | const Standard_Real theLast, |
57 | const Standard_Real theTol); |
58 | |
42cf5bc1 |
59 | Standard_EXPORT Standard_Boolean IsDone() const; |
60 | |
61 | Standard_EXPORT Standard_Boolean HasResult() const; |
62 | |
63 | Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const; |
64 | |
65 | Standard_EXPORT Standard_Real MaxError3d() const; |
66 | |
67 | Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const; |
68 | |
69 | Standard_EXPORT Standard_Real MaxError2dU() const; |
70 | |
71 | //! returns the maximum errors relativly to the U component or the V component of the |
72 | //! 2d Curve |
73 | Standard_EXPORT Standard_Real MaxError2dV() const; |
74 | |
f04de133 |
75 | //! Constructs the 3d curve. Input parameters are ignored when the input curve is |
76 | //! U-isoline or V-isoline. |
77 | //! @param theMaxSegments Maximal number of segments in the resulting spline. |
78 | //! @param theMaxDegree Maximal degree of the result. |
79 | //! @param theContinuity Resulting continuity. |
80 | //! @param theOnly3d Determines building only 3D curve. |
81 | //! @param theOnly2d Determines building only 2D curve. |
82 | Standard_EXPORT void Perform(const Standard_Integer theMaxSegments, |
83 | const Standard_Integer theMaxDegree, |
84 | const GeomAbs_Shape theContinuity, |
85 | const Standard_Boolean theOnly3d = Standard_False, |
86 | const Standard_Boolean theOnly2d = Standard_False); |
42cf5bc1 |
87 | |
88 | protected: |
89 | |
f04de133 |
90 | //! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier, |
91 | //! or geometric line. This line should have natural parameterization. |
92 | //! @param theC2D Trimmed curve to be checked. |
93 | //! @param theIsU Flag indicating that line is u const. |
94 | //! @param theParam Line parameter. |
95 | //! @param theIsForward Flag indicating forward parameterization on a isoline. |
96 | //! @return Standard_True when 2d curve is a line and Standard_False otherwise. |
97 | Standard_Boolean isIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D, |
98 | Standard_Boolean& theIsU, |
99 | Standard_Real& theParam, |
100 | Standard_Boolean& theIsForward) const; |
101 | |
102 | //! Builds 3D curve for a isoline. This method takes corresponding isoline from |
103 | //! the input surface. |
104 | //! @param theC2D Trimmed curve to be approximated. |
105 | //! @param theIsU Flag indicating that line is u const. |
106 | //! @param theParam Line parameter. |
107 | //! @param theIsForward Flag indicating forward parameterization on a isoline. |
108 | //! @return Standard_True when 3d curve is built and Standard_False otherwise. |
109 | Standard_Boolean buildC3dOnIsoLine(const Handle(Adaptor2d_HCurve2d) theC2D, |
110 | const Standard_Boolean theIsU, |
111 | const Standard_Real theParam, |
112 | const Standard_Boolean theIsForward); |
42cf5bc1 |
113 | |
f04de133 |
114 | private: |
115 | Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&); |
42cf5bc1 |
116 | |
f04de133 |
117 | private: |
42cf5bc1 |
118 | |
f04de133 |
119 | //! Input curve. |
120 | const Handle(Adaptor2d_HCurve2d) myC2D; |
42cf5bc1 |
121 | |
f04de133 |
122 | //! Input surface. |
123 | const Handle(Adaptor3d_HSurface) mySurf; |
124 | |
125 | //! First parameter of the result. |
126 | const Standard_Real myFirst; |
42cf5bc1 |
127 | |
f04de133 |
128 | //! Last parameter of the result. |
129 | const Standard_Real myLast; |
42cf5bc1 |
130 | |
f04de133 |
131 | //! Tolerance. |
132 | Standard_Real myTol; |
42cf5bc1 |
133 | |
134 | Handle(Geom2d_BSplineCurve) myCurve2d; |
135 | Handle(Geom_BSplineCurve) myCurve3d; |
136 | Standard_Boolean myIsDone; |
137 | Standard_Boolean myHasResult; |
138 | Standard_Real myError3d; |
139 | Standard_Real myError2dU; |
140 | Standard_Real myError2dV; |
141 | |
142 | |
143 | }; |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | #endif // _Approx_CurveOnSurface_HeaderFile |