1 // Created on: 1997-08-22
2 // Created by: Jeannine PANCIATICI,  Sergey SOKOLOV
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_CurvilinearParameter_HeaderFile
18 #define _Approx_CurvilinearParameter_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Real.hxx>
27 #include <GeomAbs_Shape.hxx>
28 #include <Standard_OStream.hxx>
29 class Geom_BSplineCurve;
30 class Geom2d_BSplineCurve;
31 class Standard_OutOfRange;
32 class Standard_ConstructionError;
33 class Adaptor3d_HCurve;
34 class Adaptor2d_HCurve2d;
35 class Adaptor3d_HSurface;
36 
37 
38 //! Approximation of a Curve to make its parameter be its
39 //! curvilinear  abscissa
40 //! If the curve is a curve on a surface S, C2D is the corresponding Pcurve,
41 //! we considere the curve is given by its representation S(C2D(u))
42 //! If the curve is a curve on 2 surfaces S1 and S2 and C2D1 C2D2 are
43 //! the two corresponding Pcurve, we considere the curve is given
44 //! by its representation  1/2(S1(C2D1(u) + S2 (C2D2(u)))
45 class Approx_CurvilinearParameter
46 {
47 public:
48 
49   DEFINE_STANDARD_ALLOC
50 
51 
52   //! case of a free 3D curve
53   Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_HCurve)& C3D, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
54 
55   //! case of a curve on one surface
56   Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& Surf, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
57 
58   //! case of a curve on two surfaces
59   Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_HCurve2d)& C2D1, const Handle(Adaptor3d_HSurface)& Surf1, const Handle(Adaptor2d_HCurve2d)& C2D2, const Handle(Adaptor3d_HSurface)& Surf2, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
60 
61   Standard_EXPORT Standard_Boolean IsDone() const;
62 
63   Standard_EXPORT Standard_Boolean HasResult() const;
64 
65   //! returns the Bspline curve corresponding to the reparametrized 3D curve
66   Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
67 
68   //! returns the maximum error on the reparametrized 3D curve
69   Standard_EXPORT Standard_Real MaxError3d() const;
70 
71   //! returns the BsplineCurve representing the reparametrized 2D curve on the
72   //! first surface (case of a curve on one or two surfaces)
73   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d1() const;
74 
75   //! returns the maximum error on the first reparametrized 2D curve
76   Standard_EXPORT Standard_Real MaxError2d1() const;
77 
78   //! returns the BsplineCurve representing the reparametrized 2D curve on the
79   //! second surface (case of a curve on two surfaces)
80   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d2() const;
81 
82   //! returns the maximum error on the second reparametrized 2D curve
83   Standard_EXPORT Standard_Real MaxError2d2() const;
84 
85   //! print the maximum errors(s)
86   Standard_EXPORT void Dump (Standard_OStream& o) const;
87 
88 
89 
90 
91 protected:
92 
93 
94 
95 
96 
97 private:
98 
99 
100   Standard_EXPORT static void ToleranceComputation (const Handle(Adaptor2d_HCurve2d)& C2D, const Handle(Adaptor3d_HSurface)& S, const Standard_Integer MaxNumber, const Standard_Real Tol, Standard_Real& TolV, Standard_Real& TolW);
101 
102 
103   Standard_Integer myCase;
104   Standard_Boolean myDone;
105   Standard_Boolean myHasResult;
106   Handle(Geom_BSplineCurve) myCurve3d;
107   Standard_Real myMaxError3d;
108   Handle(Geom2d_BSplineCurve) myCurve2d1;
109   Standard_Real myMaxError2d1;
110   Handle(Geom2d_BSplineCurve) myCurve2d2;
111   Standard_Real myMaxError2d2;
112 
113 
114 };
115 
116 
117 
118 
119 
120 
121 
122 #endif // _Approx_CurvilinearParameter_HeaderFile
123