1 // Created on: 1997-06-25
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Approx_SweepFunction_HeaderFile
18 #define _Approx_SweepFunction_HeaderFile
20 #include <Standard.hxx>
22 #include <Standard_Transient.hxx>
23 #include <Standard_Real.hxx>
24 #include <TColgp_Array1OfPnt.hxx>
25 #include <TColgp_Array1OfPnt2d.hxx>
26 #include <TColStd_Array1OfReal.hxx>
27 #include <TColgp_Array1OfVec.hxx>
28 #include <TColgp_Array1OfVec2d.hxx>
29 #include <Standard_Integer.hxx>
30 #include <TColStd_Array1OfInteger.hxx>
31 #include <GeomAbs_Shape.hxx>
35 class Approx_SweepFunction;
36 DEFINE_STANDARD_HANDLE(Approx_SweepFunction, Standard_Transient)
38 //! defined the function used by SweepApproximation to
39 //! perform sweeping application.
40 class Approx_SweepFunction : public Standard_Transient
46 //! compute the section for v = param
47 Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
49 //! compute the first derivative in v direction of the
50 //! section for v = param
51 //! Warning : It used only for C1 or C2 approximation
52 Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths);
54 //! compute the second derivative in v direction of the
55 //! section for v = param
56 //! Warning : It used only for C2 approximation
57 Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths);
59 //! get the number of 2d curves to approximate.
60 Standard_EXPORT virtual Standard_Integer Nb2dCurves() const = 0;
62 //! get the format of an section
63 Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const = 0;
65 //! get the Knots of the section
66 Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const = 0;
68 //! get the Multplicities of the section
69 Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const = 0;
71 //! Returns if the sections are rationnal or not
72 Standard_EXPORT virtual Standard_Boolean IsRational() const = 0;
74 //! Returns the number of intervals for continuity
76 //! May be one if Continuity(me) >= <S>
77 Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
79 //! Stores in <T> the parameters bounding the intervals
80 //! of continuity <S>.
82 //! The array must provide enough room to accommodate
83 //! for the parameters. i.e. T.Length() > NbIntervals()
84 Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
86 //! Sets the bounds of the parametric interval on
88 //! This determines the derivatives in these values if the
89 //! function is not Cn.
90 Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) = 0;
92 //! Returns the resolutions in the sub-space 2d <Index>
93 //! This information is usfull to find an good tolerance in
95 Standard_EXPORT virtual void Resolution (const Standard_Integer Index, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const;
97 //! Returns the tolerance to reach in approximation
99 //! BoundTol error at the Boundary
100 //! AngleTol tangent error at the Boundary (in radian)
101 //! SurfTol error inside the surface.
102 Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, TColStd_Array1OfReal& Tol3d) const = 0;
104 //! Is useful, if (me) have to run numerical algorithm to perform D0, D1 or D2
105 Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) = 0;
107 //! Get the barycentre of Surface.
108 //! An very poor estimation is sufficient.
109 //! This information is useful to perform well conditioned rational approximation.
110 //! Warning: Used only if <me> IsRational
111 Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const;
113 //! Returns the length of the greater section.
114 //! Thisinformation is useful to G1's control.
115 //! Warning: With an little value, approximation can be slower.
116 Standard_EXPORT virtual Standard_Real MaximalSection() const;
118 //! Compute the minimal value of weight for each poles in all sections.
119 //! This information is useful to control error in rational approximation.
120 //! Warning: Used only if <me> IsRational
121 Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const;
126 DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction,Standard_Transient)
146 #endif // _Approx_SweepFunction_HeaderFile