2255d80417c5cd26fed03a3267429d32ccfa2e70
[occt.git] / src / Blend / Blend_SurfRstFunction.hxx
1 // Created by: Jacques  GOUSSARD Author:    Laurent    BOURESCHE --
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Blend_SurfRstFunction_HeaderFile
17 #define _Blend_SurfRstFunction_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22
23 #include <Blend_AppFunction.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <math_Vector.hxx>
27 #include <Standard_Real.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <GeomAbs_Shape.hxx>
30 #include <TColStd_Array1OfInteger.hxx>
31 #include <TColgp_Array1OfPnt.hxx>
32 #include <TColgp_Array1OfVec.hxx>
33 #include <TColgp_Array1OfPnt2d.hxx>
34 #include <TColgp_Array1OfVec2d.hxx>
35 class Standard_DomainError;
36 class math_Matrix;
37 class gp_Pnt;
38 class gp_Pnt2d;
39 class gp_Vec;
40 class gp_Vec2d;
41 class Blend_Point;
42
43
44 //! Deferred class for a function used to compute a blending
45 //! surface between a surface and a pcurve on an other Surface,
46 //! using a guide line.
47 //! The vector <X> used in Value, Values and Derivatives methods
48 //! may be the vector of the parametric coordinates U,V,
49 //! W of the extremities of a section on the surface  and
50 //! the curve.
51 class Blend_SurfRstFunction  : public Blend_AppFunction
52 {
53 public:
54
55   DEFINE_STANDARD_ALLOC
56
57   
58   //! Returns 3 (default value). Can be redefined.
59   Standard_EXPORT virtual Standard_Integer NbVariables() const = 0;
60   
61   //! returns the number of equations of the function.
62   Standard_EXPORT virtual Standard_Integer NbEquations() const = 0;
63   
64   //! computes the values <F> of the Functions for the
65   //! variable <X>.
66   //! Returns True if the computation was done successfully,
67   //! False otherwise.
68   Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, math_Vector& F) = 0;
69   
70   //! returns the values <D> of the derivatives for the
71   //! variable <X>.
72   //! Returns True if the computation was done successfully,
73   //! False otherwise.
74   Standard_EXPORT virtual Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) = 0;
75   
76   //! returns the values <F> of the functions and the derivatives
77   //! <D> for the variable <X>.
78   //! Returns True if the computation was done successfully,
79   //! False otherwise.
80   Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) = 0;
81   
82   //! Sets the value of the parameter along the guide line.
83   //! This determines the plane in which the solution has
84   //! to be found.
85   Standard_EXPORT virtual void Set (const Standard_Real Param) = 0;
86   
87   //! Sets the bounds of the parametric interval on
88   //! the guide line.
89   //! This determines the derivatives in these values if the
90   //! function is not Cn.
91   Standard_EXPORT virtual void Set (const Standard_Real First, const Standard_Real Last) = 0;
92   
93   //! Returns in the vector Tolerance the parametric tolerance
94   //! for each variable;
95   //! Tol is the tolerance used in 3d space.
96   Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const = 0;
97   
98   //! Returns in the vector InfBound the lowest values allowed
99   //! for each variables.
100   //! Returns in the vector SupBound the greatest values allowed
101   //! for each of the 3 variables.
102   Standard_EXPORT virtual void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const = 0;
103   
104   //! Returns Standard_True if Sol is a zero of the function.
105   //! Tol is the tolerance used in 3d space.
106   //! The computation is made at the current value of
107   //! the parameter on the guide line.
108   Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) = 0;
109   
110   //! Returns   the    minimal  Distance  beetween   two
111   //! extremitys of calculed sections.
112   Standard_EXPORT Standard_Real GetMinimalDistance() const;
113   
114   //! Returns the point on the first support.
115   Standard_EXPORT const gp_Pnt& Pnt1() const;
116   
117   //! Returns the point on the seconde support.
118   Standard_EXPORT const gp_Pnt& Pnt2() const;
119   
120   //! Returns the point on the surface.
121   Standard_EXPORT virtual const gp_Pnt& PointOnS() const = 0;
122   
123   //! Returns the point on the curve.
124   Standard_EXPORT virtual const gp_Pnt& PointOnRst() const = 0;
125   
126   //! Returns U,V coordinates of the point on the surface.
127   Standard_EXPORT virtual const gp_Pnt2d& Pnt2dOnS() const = 0;
128   
129   //! Returns  U,V coordinates of the point  on the curve on
130   //! surface.
131   Standard_EXPORT virtual const gp_Pnt2d& Pnt2dOnRst() const = 0;
132   
133   //! Returns parameter of the point on the curve.
134   Standard_EXPORT virtual Standard_Real ParameterOnRst() const = 0;
135   
136   //! Returns True when it is not possible to compute
137   //! the tangent vectors at PointOnS and/or PointOnRst.
138   Standard_EXPORT virtual Standard_Boolean IsTangencyPoint() const = 0;
139   
140   //! Returns the tangent vector at PointOnS, in 3d space.
141   Standard_EXPORT virtual const gp_Vec& TangentOnS() const = 0;
142   
143   //! Returns the tangent vector at PointOnS, in the
144   //! parametric space of the first surface.
145   Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnS() const = 0;
146   
147   //! Returns the tangent vector at PointOnC, in 3d space.
148   Standard_EXPORT virtual const gp_Vec& TangentOnRst() const = 0;
149   
150   //! Returns the tangent vector at PointOnRst, in the
151   //! parametric space of the second surface.
152   Standard_EXPORT virtual const gp_Vec2d& Tangent2dOnRst() const = 0;
153   
154   //! Enables implementation  of a criterion of decrochage
155   //! specific to  the function.
156   Standard_EXPORT virtual Standard_Boolean Decroch (const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const = 0;
157   
158   //! Returns  if the section is rationnal
159   Standard_EXPORT virtual Standard_Boolean IsRational() const = 0;
160   
161   //! Returns the length of the maximum section
162   Standard_EXPORT virtual Standard_Real GetSectionSize() const = 0;
163   
164   //! Compute the minimal value of weight for each poles
165   //! of all sections.
166   Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const = 0;
167   
168   //! Returns  the number  of  intervals for  continuity
169   //! <S>. May be one if Continuity(me) >= <S>
170   Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
171   
172   //! Stores in <T> the  parameters bounding the intervals
173   //! of continuity <S>.
174   //!
175   //! The array must provide  enough room to  accomodate
176   //! for the parameters. i.e. T.Length() > NbIntervals()
177   Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
178   
179   Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) = 0;
180   
181   //! Returns the tolerance to reach in approximation
182   //! to respecte
183   //! BoundTol error at the Boundary
184   //! AngleTol tangent error at the Boundary
185   //! SurfTol error inside the surface.
186   Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const = 0;
187   
188   Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) = 0;
189   
190   Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) = 0;
191   
192   //! Used for the first and last section
193   //! The method returns Standard_True if the derivatives
194   //! are computed, otherwise it returns Standard_False.
195   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) = 0;
196   
197   //! Used for the first and last section
198   //! The method returns Standard_True if the derivatives
199   //! are computed, otherwise it returns Standard_False.
200   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) = 0;
201   
202   Standard_EXPORT virtual void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
203
204
205
206
207 protected:
208
209
210
211
212
213 private:
214
215
216
217
218
219 };
220
221
222
223
224
225
226
227 #endif // _Blend_SurfRstFunction_HeaderFile