1 // Created on: 1997-11-20
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 _GeomFill_SweepFunction_HeaderFile
18 #define _GeomFill_SweepFunction_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
26 #include <Approx_SweepFunction.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <TColgp_Array1OfPnt.hxx>
29 #include <TColgp_Array1OfPnt2d.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <TColgp_Array1OfVec.hxx>
32 #include <TColgp_Array1OfVec2d.hxx>
33 #include <Standard_Integer.hxx>
34 #include <TColStd_Array1OfInteger.hxx>
35 #include <GeomAbs_Shape.hxx>
36 class GeomFill_LocationLaw;
37 class GeomFill_SectionLaw;
38 class Standard_OutOfRange;
42 class GeomFill_SweepFunction;
43 DEFINE_STANDARD_HANDLE(GeomFill_SweepFunction, Approx_SweepFunction)
45 //! Function to approximate by SweepApproximation from
46 //! Approx. To bulid general sweep Surface.
47 class GeomFill_SweepFunction : public Approx_SweepFunction
53 Standard_EXPORT GeomFill_SweepFunction(const Handle(GeomFill_SectionLaw)& Section, const Handle(GeomFill_LocationLaw)& Location, const Standard_Real FirstParameter, const Standard_Real FirstParameterOnS, const Standard_Real RatioParameterOnS);
55 //! compute the section for v = param
56 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) Standard_OVERRIDE;
58 //! compute the first derivative in v direction of the
59 //! section for v = param
60 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) Standard_OVERRIDE;
62 //! compute the second derivative in v direction of the
63 //! section for v = param
64 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) Standard_OVERRIDE;
66 //! get the number of 2d curves to approximate.
67 Standard_EXPORT virtual Standard_Integer Nb2dCurves() const Standard_OVERRIDE;
69 //! get the format of an section
70 Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const Standard_OVERRIDE;
72 //! get the Knots of the section
73 Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const Standard_OVERRIDE;
75 //! get the Multplicities of the section
76 Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const Standard_OVERRIDE;
78 //! Returns if the section is rationnal or not
79 Standard_EXPORT virtual Standard_Boolean IsRational() const Standard_OVERRIDE;
81 //! Returns the number of intervals for continuity
82 //! <S>. May be one if Continuity(me) >= <S>
83 Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
85 //! Stores in <T> the parameters bounding the intervals
86 //! of continuity <S>.
88 //! The array must provide enough room to accomodate
89 //! for the parameters. i.e. T.Length() > NbIntervals()
90 Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
92 //! Sets the bounds of the parametric interval on
94 //! This determines the derivatives in these values if the
95 //! function is not Cn.
96 Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
98 //! Returns the resolutions in the sub-space 2d <Index>
99 //! This information is usfull to find an good tolerance in
100 //! 2d approximation.
101 //! Warning: Used only if Nb2dCurve > 0
102 Standard_EXPORT virtual void Resolution (const Standard_Integer Index, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE;
104 //! Returns the tolerance to reach in approximation
106 //! BoundTol error at the Boundary
107 //! AngleTol tangent error at the Boundary (in radian)
108 //! SurfTol error inside the surface.
109 Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, TColStd_Array1OfReal& Tol3d) const Standard_OVERRIDE;
111 //! Is usfull, if (me) have to be run numerical
112 //! algorithme to perform D0, D1 or D2
113 Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) Standard_OVERRIDE;
115 //! Get the barycentre of Surface. An very poor
116 //! estimation is sufficent. This information is usefull
117 //! to perform well conditionned rational approximation.
118 //! Warning: Used only if <me> IsRational
119 Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const Standard_OVERRIDE;
121 //! Returns the length of the maximum section. This
122 //! information is usefull to perform well conditionned rational
124 Standard_EXPORT virtual Standard_Real MaximalSection() const Standard_OVERRIDE;
126 //! Compute the minimal value of weight for each poles
127 //! of all sections. This information is usefull to
128 //! perform well conditionned rational approximation.
129 //! Warning: Used only if <me> IsRational
130 Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
135 DEFINE_STANDARD_RTTIEXT(GeomFill_SweepFunction,Approx_SweepFunction)
145 Handle(GeomFill_LocationLaw) myLoc;
146 Handle(GeomFill_SectionLaw) mySec;
148 Standard_Real myfOnS;
149 Standard_Real myRatio;
166 #endif // _GeomFill_SweepFunction_HeaderFile