42cf5bc1 |
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 |
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 _GeomFill_SweepFunction_HeaderFile |
18 | #define _GeomFill_SweepFunction_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <gp_Mat.hxx> |
25 | #include <gp_Vec.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; |
39 | class gp_Pnt; |
40 | |
41 | |
42 | class GeomFill_SweepFunction; |
43 | DEFINE_STANDARD_HANDLE(GeomFill_SweepFunction, Approx_SweepFunction) |
44 | |
45 | //! Function to approximate by SweepApproximation from |
316ea293 |
46 | //! Approx. To build general sweep Surface. |
42cf5bc1 |
47 | class GeomFill_SweepFunction : public Approx_SweepFunction |
48 | { |
49 | |
50 | public: |
51 | |
316ea293 |
52 | |
42cf5bc1 |
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); |
54 | |
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; |
316ea293 |
57 | |
58 | //! compute the first derivative in v direction of the |
59 | //! section for v = param |
42cf5bc1 |
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; |
316ea293 |
61 | |
42cf5bc1 |
62 | //! compute the second derivative in v direction of the |
316ea293 |
63 | //! section for v = param |
42cf5bc1 |
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; |
65 | |
316ea293 |
66 | //! get the number of 2d curves to approximate. |
42cf5bc1 |
67 | Standard_EXPORT virtual Standard_Integer Nb2dCurves() const Standard_OVERRIDE; |
68 | |
316ea293 |
69 | //! get the format of a section |
42cf5bc1 |
70 | Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const Standard_OVERRIDE; |
316ea293 |
71 | |
42cf5bc1 |
72 | //! get the Knots of the section |
73 | Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const Standard_OVERRIDE; |
316ea293 |
74 | |
42cf5bc1 |
75 | //! get the Multplicities of the section |
76 | Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const Standard_OVERRIDE; |
316ea293 |
77 | |
78 | //! Returns if the section is rational or not |
42cf5bc1 |
79 | Standard_EXPORT virtual Standard_Boolean IsRational() const Standard_OVERRIDE; |
316ea293 |
80 | |
81 | //! Returns the number of intervals for continuity |
42cf5bc1 |
82 | //! <S>. May be one if Continuity(me) >= <S> |
83 | Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
316ea293 |
84 | |
85 | //! Stores in <T> the parameters bounding the intervals |
42cf5bc1 |
86 | //! of continuity <S>. |
87 | //! |
21c7c457 |
88 | //! The array must provide enough room to accommodate |
42cf5bc1 |
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; |
316ea293 |
91 | |
42cf5bc1 |
92 | //! Sets the bounds of the parametric interval on |
93 | //! the function |
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; |
316ea293 |
97 | |
98 | //! Returns the resolutions in the sub-space 2d <Index> |
42cf5bc1 |
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; |
316ea293 |
103 | |
42cf5bc1 |
104 | //! Returns the tolerance to reach in approximation |
105 | //! to respecte |
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; |
316ea293 |
110 | |
42cf5bc1 |
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; |
114 | |
115 | //! Get the barycentre of Surface. An very poor |
a25d5aaa |
116 | //! estimation is sufficient. This information is useful |
21c7c457 |
117 | //! to perform well conditioned rational approximation. |
42cf5bc1 |
118 | //! Warning: Used only if <me> IsRational |
119 | Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const Standard_OVERRIDE; |
316ea293 |
120 | |
42cf5bc1 |
121 | //! Returns the length of the maximum section. This |
a25d5aaa |
122 | //! information is useful to perform well conditioned rational |
42cf5bc1 |
123 | //! approximation. |
124 | Standard_EXPORT virtual Standard_Real MaximalSection() const Standard_OVERRIDE; |
125 | |
126 | //! Compute the minimal value of weight for each poles |
a25d5aaa |
127 | //! of all sections. This information is useful to |
21c7c457 |
128 | //! perform well conditioned rational approximation. |
42cf5bc1 |
129 | //! Warning: Used only if <me> IsRational |
130 | Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; |
131 | |
132 | |
133 | |
134 | |
92efcf78 |
135 | DEFINE_STANDARD_RTTIEXT(GeomFill_SweepFunction,Approx_SweepFunction) |
42cf5bc1 |
136 | |
137 | protected: |
138 | |
139 | |
140 | |
141 | |
142 | private: |
143 | |
144 | |
145 | Handle(GeomFill_LocationLaw) myLoc; |
146 | Handle(GeomFill_SectionLaw) mySec; |
147 | Standard_Real myf; |
148 | Standard_Real myfOnS; |
149 | Standard_Real myRatio; |
150 | gp_Mat M; |
151 | gp_Mat DM; |
152 | gp_Mat D2M; |
153 | gp_Vec V; |
154 | gp_Vec DV; |
155 | gp_Vec D2V; |
156 | |
157 | |
158 | }; |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | #endif // _GeomFill_SweepFunction_HeaderFile |