0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / BlendFunc / BlendFunc_EvolRad.hxx
1 // Created on: 1993-12-20
2 // Created by: Jacques GOUSSARD
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 _BlendFunc_EvolRad_HeaderFile
18 #define _BlendFunc_EvolRad_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <gp_Pnt.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <gp_Vec.hxx>
27 #include <gp_Vec2d.hxx>
28 #include <Standard_Real.hxx>
29 #include <Standard_Integer.hxx>
30 #include <math_Vector.hxx>
31 #include <math_Matrix.hxx>
32 #include <BlendFunc_Tensor.hxx>
33 #include <BlendFunc_SectionShape.hxx>
34 #include <Convert_ParameterisationType.hxx>
35 #include <Blend_Function.hxx>
36 #include <TColStd_Array1OfReal.hxx>
37 #include <GeomAbs_Shape.hxx>
38 #include <TColStd_Array1OfInteger.hxx>
39 #include <TColgp_Array1OfPnt.hxx>
40 #include <TColgp_Array1OfVec.hxx>
41 #include <TColgp_Array1OfPnt2d.hxx>
42 #include <TColgp_Array1OfVec2d.hxx>
43 class Adaptor3d_HSurface;
44 class Adaptor3d_HCurve;
45 class Law_Function;
46 class math_Matrix;
47 class gp_Pnt;
48 class gp_Vec;
49 class gp_Vec2d;
50 class gp_Circ;
51 class Blend_Point;
52
53
54
55 class BlendFunc_EvolRad  : public Blend_Function
56 {
57 public:
58
59   DEFINE_STANDARD_ALLOC
60
61   
62   Standard_EXPORT BlendFunc_EvolRad(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C, const Handle(Law_Function)& Law);
63   
64   //! returns the number of equations of the function.
65   Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
66   
67   //! computes the values <F> of the Functions for the
68   //! variable <X>.
69   //! Returns True if the computation was done successfully,
70   //! False otherwise.
71   Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
72   
73   //! returns the values <D> of the derivatives for the
74   //! variable <X>.
75   //! Returns True if the computation was done successfully,
76   //! False otherwise.
77   Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
78   
79   //! returns the values <F> of the functions and the derivatives
80   //! <D> for the variable <X>.
81   //! Returns True if the computation was done successfully,
82   //! False otherwise.
83   Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE;
84   
85   Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
86   
87   Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
88   
89   Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE;
90   
91   Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE;
92   
93   Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
94   
95   //! Returns   the    minimal  Distance  beetween   two
96   //! extremitys of calculed sections.
97   Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
98   
99   Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
100   
101   Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
102   
103   Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
104   
105   Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE;
106   
107   Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE;
108   
109   Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE;
110   
111   Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE;
112   
113   //! Returns the tangent vector at the section,
114   //! at the beginning and the end of the section, and
115   //! returns the normal (of the surfaces) at
116   //! these points.
117   Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
118   
119   Standard_EXPORT virtual Standard_Boolean TwistOnS1() const Standard_OVERRIDE;
120   
121   Standard_EXPORT virtual Standard_Boolean TwistOnS2() const Standard_OVERRIDE;
122   
123   Standard_EXPORT void Set (const Standard_Integer Choix);
124   
125   //! Sets  the  type  of   section generation   for the
126   //! approximations.
127   Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection);
128   
129   //! Method for graphic traces
130   Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Circ& C);
131   
132   //! Returns  if the section is rationnal
133   Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
134   
135   //! Returns the length of the maximum section
136   Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
137   
138   //! Compute the minimal value of weight for each poles
139   //! of all sections.
140   Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
141   
142   //! Returns  the number  of  intervals for  continuity
143   //! <S>. May be one if Continuity(me) >= <S>
144   Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
145   
146   //! Stores in <T> the  parameters bounding the intervals
147   //! of continuity <S>.
148   //!
149   //! The array must provide  enough room to  accomodate
150   //! for the parameters. i.e. T.Length() > NbIntervals()
151   Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
152   
153   Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE;
154   
155   //! Returns the tolerance to reach in approximation
156   //! to respecte
157   //! BoundTol error at the Boundary
158   //! AngleTol tangent error at the Boundary
159   //! SurfTol error inside the surface.
160   Standard_EXPORT void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE;
161   
162   Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
163   
164   Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
165   
166   //! Used for the first and last section
167   Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, 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;
168   
169   //! Used for the first and last section
170   Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
171   
172   Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
173   
174   Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE;
175
176
177
178
179 protected:
180
181
182
183
184
185 private:
186
187   
188   Standard_EXPORT Standard_Boolean ComputeValues (const math_Vector& X, const Standard_Integer Order, const Standard_Boolean ByParam = Standard_False, const Standard_Real Param = 0);
189
190
191   Handle(Adaptor3d_HSurface) surf1;
192   Handle(Adaptor3d_HSurface) surf2;
193   Handle(Adaptor3d_HCurve) curv;
194   Handle(Adaptor3d_HCurve) tcurv;
195   Handle(Law_Function) fevol;
196   Handle(Law_Function) tevol;
197   gp_Pnt pts1;
198   gp_Pnt pts2;
199   Standard_Boolean istangent;
200   gp_Vec tg1;
201   gp_Vec2d tg12d;
202   gp_Vec tg2;
203   gp_Vec2d tg22d;
204   Standard_Real param;
205   Standard_Real sg1;
206   Standard_Real sg2;
207   Standard_Real ray;
208   Standard_Real dray;
209   Standard_Real d2ray;
210   Standard_Integer choix;
211   Standard_Integer myXOrder;
212   Standard_Integer myTOrder;
213   math_Vector xval;
214   Standard_Real tval;
215   gp_Vec d1u1;
216   gp_Vec d1u2;
217   gp_Vec d1v1;
218   gp_Vec d1v2;
219   gp_Vec d2u1;
220   gp_Vec d2v1;
221   gp_Vec d2uv1;
222   gp_Vec d2u2;
223   gp_Vec d2v2;
224   gp_Vec d2uv2;
225   gp_Vec dn1w;
226   gp_Vec dn2w;
227   gp_Vec d2n1w;
228   gp_Vec d2n2w;
229   gp_Vec nplan;
230   gp_Vec nsurf1;
231   gp_Vec nsurf2;
232   gp_Vec dns1u1;
233   gp_Vec dns1u2;
234   gp_Vec dns1v1;
235   gp_Vec dns1v2;
236   gp_Vec dnplan;
237   gp_Vec d2nplan;
238   gp_Vec dnsurf1;
239   gp_Vec dnsurf2;
240   gp_Vec dndu1;
241   gp_Vec dndu2;
242   gp_Vec dndv1;
243   gp_Vec dndv2;
244   gp_Vec d2ndu1;
245   gp_Vec d2ndu2;
246   gp_Vec d2ndv1;
247   gp_Vec d2ndv2;
248   gp_Vec d2nduv1;
249   gp_Vec d2nduv2;
250   gp_Vec d2ndtu1;
251   gp_Vec d2ndtu2;
252   gp_Vec d2ndtv1;
253   gp_Vec d2ndtv2;
254   math_Vector E;
255   math_Matrix DEDX;
256   math_Vector DEDT;
257   BlendFunc_Tensor D2EDX2;
258   math_Matrix D2EDXDT;
259   math_Vector D2EDT2;
260   Standard_Real minang;
261   Standard_Real maxang;
262   Standard_Real lengthmin;
263   Standard_Real lengthmax;
264   Standard_Real distmin;
265   BlendFunc_SectionShape mySShape;
266   Convert_ParameterisationType myTConv;
267
268
269 };
270
271
272
273
274
275
276
277 #endif // _BlendFunc_EvolRad_HeaderFile