42cf5bc1 |
1 | // Created on: 1993-09-07 |
2 | // Created by: Bruno DUMORTIER |
3 | // Copyright (c) 1993-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 _ProjLib_ComputeApprox_HeaderFile |
18 | #define _ProjLib_ComputeApprox_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
f998596a |
25 | #include <AppParCurves_Constraint.hxx> |
26 | |
42cf5bc1 |
27 | class Geom2d_BSplineCurve; |
28 | class Geom2d_BezierCurve; |
29 | class Adaptor3d_HCurve; |
30 | class Adaptor3d_HSurface; |
31 | |
32 | |
33 | //! Approximate the projection of a 3d curve on an |
34 | //! analytic surface and stores the result in Approx. |
35 | //! The result is a 2d curve. |
f998596a |
36 | //! For approximation some parameters are used, including |
37 | //! required tolerance of approximation. |
38 | //! Tolerance is maximal possible value of 3d deviation of 3d projection of projected curve from |
39 | //! "exact" 3d projection. Since algorithm searches 2d curve on surface, required 2d tolerance is computed |
40 | //! from 3d tolerance with help of U,V resolutions of surface. |
41 | //! 3d and 2d tolerances have sence only for curves on surface, it defines precision of projecting and approximation |
42 | //! and have nothing to do with distance between the projected curve and the surface. |
42cf5bc1 |
43 | class ProjLib_ComputeApprox |
44 | { |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
f998596a |
49 | //! Empty constructor, it only sets some initial values for class fields. |
50 | Standard_EXPORT ProjLib_ComputeApprox(); |
51 | |
42cf5bc1 |
52 | //! <Tol> is the tolerance with which the |
53 | //! approximation is performed. |
f998596a |
54 | //! Other parameters for approximation have default values. |
42cf5bc1 |
55 | Standard_EXPORT ProjLib_ComputeApprox(const Handle(Adaptor3d_HCurve)& C, const Handle(Adaptor3d_HSurface)& S, const Standard_Real Tol); |
56 | |
f998596a |
57 | //! Performs projecting. |
58 | //! In case of approximation current values of parameters are used: |
59 | //! default values or set by corresponding methods Set... |
60 | Standard_EXPORT void Perform(const Handle(Adaptor3d_HCurve)& C, const Handle(Adaptor3d_HSurface)& S); |
61 | |
62 | //! Set tolerance of approximation. |
63 | //! Default value is Precision::Confusion(). |
64 | Standard_EXPORT void SetTolerance(const Standard_Real theTolerance); |
65 | |
66 | //! Set min and max possible degree of result BSpline curve2d, which is got by approximation. |
67 | //! If theDegMin/Max < 0, algorithm uses values that are chosen depending of types curve 3d |
68 | //! and surface. |
69 | Standard_EXPORT void SetDegree(const Standard_Integer theDegMin, const Standard_Integer theDegMax); |
70 | |
71 | //! Set the parameter, which defines maximal value of parametric intervals the projected |
72 | //! curve can be cut for approximation. If theMaxSegments < 0, algorithm uses default |
73 | //! value = 1000. |
74 | Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments); |
75 | |
76 | //! Set the parameter, which defines type of boundary condition between segments during approximation. |
77 | //! It can be AppParCurves_PassPoint or AppParCurves_TangencyPoint. |
78 | //! Default value is AppParCurves_TangencyPoint; |
79 | Standard_EXPORT void SetBndPnt(const AppParCurves_Constraint theBndPnt); |
80 | |
42cf5bc1 |
81 | Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const; |
82 | |
83 | Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const; |
84 | |
85 | //! returns the reached Tolerance. |
86 | Standard_EXPORT Standard_Real Tolerance() const; |
87 | |
88 | |
89 | |
90 | |
91 | protected: |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | private: |
98 | |
42cf5bc1 |
99 | Standard_Real myTolerance; |
100 | Handle(Geom2d_BSplineCurve) myBSpline; |
101 | Handle(Geom2d_BezierCurve) myBezier; |
f998596a |
102 | Standard_Integer myDegMin; |
103 | Standard_Integer myDegMax; |
104 | Standard_Integer myMaxSegments; |
105 | AppParCurves_Constraint myBndPnt; |
42cf5bc1 |
106 | |
107 | }; |
108 | |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | #endif // _ProjLib_ComputeApprox_HeaderFile |