0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepBlend / BRepBlend_SurfRstConstRad.hxx
1 // Created on: 1997-02-06
2 // Created by: Laurent BOURESCHE
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 _BRepBlend_SurfRstConstRad_HeaderFile
18 #define _BRepBlend_SurfRstConstRad_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Adaptor3d_CurveOnSurface.hxx>
25 #include <gp_Pnt.hxx>
26 #include <gp_Pnt2d.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <gp_Vec.hxx>
30 #include <gp_Vec2d.hxx>
31 #include <Standard_Integer.hxx>
32 #include <BlendFunc_SectionShape.hxx>
33 #include <Convert_ParameterisationType.hxx>
34 #include <Blend_SurfRstFunction.hxx>
35 #include <math_Vector.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 Adaptor2d_HCurve2d;
45 class Adaptor3d_HCurve;
46 class math_Matrix;
47 class gp_Pnt;
48 class gp_Pnt2d;
49 class gp_Vec;
50 class gp_Vec2d;
51 class gp_Circ;
52 class Blend_Point;
53
54
55 //! Copy of CSConstRad with pcurve on surface
56 //! as support.
57 class BRepBlend_SurfRstConstRad  : public Blend_SurfRstFunction
58 {
59 public:
60
61   DEFINE_STANDARD_ALLOC
62
63   
64   Standard_EXPORT BRepBlend_SurfRstConstRad(const Handle(Adaptor3d_HSurface)& Surf, const Handle(Adaptor3d_HSurface)& SurfRst, const Handle(Adaptor2d_HCurve2d)& Rst, const Handle(Adaptor3d_HCurve)& CGuide);
65   
66   //! Returns 3.
67   Standard_EXPORT Standard_Integer NbVariables() const;
68   
69   //! Returns 3.
70   Standard_EXPORT Standard_Integer NbEquations() const;
71   
72   //! computes the values <F> of the Functions for the
73   //! variable <X>.
74   //! Returns True if the computation was done successfully,
75   //! False otherwise.
76   Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F);
77   
78   //! returns the values <D> of the derivatives for the
79   //! variable <X>.
80   //! Returns True if the computation was done successfully,
81   //! False otherwise.
82   Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D);
83   
84   //! returns the values <F> of the functions and the derivatives
85   //! <D> for the variable <X>.
86   //! Returns True if the computation was done successfully,
87   //! False otherwise.
88   Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D);
89   
90   Standard_EXPORT void Set (const Handle(Adaptor3d_HSurface)& SurfRef, const Handle(Adaptor2d_HCurve2d)& RstRef);
91   
92   Standard_EXPORT void Set (const Standard_Real Param);
93   
94   //! Sets the bounds of the parametric interval on
95   //! the guide line.
96   //! This determines the derivatives in these values if the
97   //! function is not Cn.
98   Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last);
99   
100   Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const;
101   
102   Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const;
103   
104   Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol);
105   
106   //! Returns   the    minimal  Distance  beetween   two
107   //! extremitys of calculed sections.
108   Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
109   
110   Standard_EXPORT const gp_Pnt& PointOnS() const;
111   
112   Standard_EXPORT const gp_Pnt& PointOnRst() const;
113   
114   //! Returns U,V coordinates of the point on the surface.
115   Standard_EXPORT const gp_Pnt2d& Pnt2dOnS() const;
116   
117   //! Returns  U,V coordinates of the point  on the curve on
118   //! surface.
119   Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst() const;
120   
121   //! Returns parameter of the point on the curve.
122   Standard_EXPORT Standard_Real ParameterOnRst() const;
123   
124   Standard_EXPORT Standard_Boolean IsTangencyPoint() const;
125   
126   Standard_EXPORT const gp_Vec& TangentOnS() const;
127   
128   Standard_EXPORT const gp_Vec2d& Tangent2dOnS() const;
129   
130   Standard_EXPORT const gp_Vec& TangentOnRst() const;
131   
132   Standard_EXPORT const gp_Vec2d& Tangent2dOnRst() const;
133   
134   //! Enables  implementation  of  a criterion of  decrochage
135   //! specific to  the function.
136   //! Warning: Can  be  called  without  previous  call  of  issolution
137   //! but the values  calculated can  be  senseless.
138   Standard_EXPORT Standard_Boolean Decroch (const math_Vector& Sol, gp_Vec& NS, gp_Vec& TgS) const;
139   
140   Standard_EXPORT void Set (const Standard_Real Radius, const Standard_Integer Choix);
141   
142   //! Sets  the  type  of   section generation   for the
143   //! approximations.
144   Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection);
145   
146   Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U, const Standard_Real V, const Standard_Real W, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Circ& C);
147   
148   //! Returns  if the section is rationnal
149   Standard_EXPORT Standard_Boolean IsRational() const;
150   
151   //! Returns the length of the maximum section
152   Standard_EXPORT Standard_Real GetSectionSize() const;
153   
154   //! Compute the minimal value of weight for each poles
155   //! of all sections.
156   Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const;
157   
158   //! Returns  the number  of  intervals for  continuity
159   //! <S>. May be one if Continuity(me) >= <S>
160   Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const;
161   
162   //! Stores in <T> the  parameters bounding the intervals
163   //! of continuity <S>.
164   //! The array must provide  enough room to  accomodate
165   //! for the parameters. i.e. T.Length() > NbIntervals()
166   Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
167   
168   Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d);
169   
170   //! Returns the tolerance to reach in approximation
171   //! to respecte
172   //! BoundTol error at the Boundary
173   //! AngleTol tangent error at the Boundary
174   //! SurfTol error inside the surface.
175   Standard_EXPORT void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const;
176   
177   Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots);
178   
179   Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults);
180   
181   //! Used for the first and last section
182   Standard_EXPORT 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);
183   
184   //! Used for the first and last section
185   //! The method returns Standard_True if the derivatives
186   //! are computed, otherwise it returns Standard_False.
187   Standard_EXPORT 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);
188   
189   Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths);
190   
191   Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const;
192
193
194
195
196 protected:
197
198
199
200
201
202 private:
203
204
205
206   Handle(Adaptor3d_HSurface) surf;
207   Handle(Adaptor3d_HSurface) surfrst;
208   Handle(Adaptor2d_HCurve2d) rst;
209   Adaptor3d_CurveOnSurface cons;
210   Handle(Adaptor3d_HCurve) guide;
211   Handle(Adaptor3d_HCurve) tguide;
212   gp_Pnt pts;
213   gp_Pnt ptrst;
214   gp_Pnt2d pt2ds;
215   gp_Pnt2d pt2drst;
216   Standard_Real prmrst;
217   Standard_Boolean istangent;
218   gp_Vec tgs;
219   gp_Vec2d tg2ds;
220   gp_Vec tgrst;
221   gp_Vec2d tg2drst;
222   Standard_Real ray;
223   Standard_Integer choix;
224   gp_Pnt ptgui;
225   gp_Vec d1gui;
226   gp_Vec d2gui;
227   gp_Vec nplan;
228   Standard_Real normtg;
229   Standard_Real theD;
230   Handle(Adaptor3d_HSurface) surfref;
231   Handle(Adaptor2d_HCurve2d) rstref;
232   Standard_Real maxang;
233   Standard_Real minang;
234   Standard_Real distmin;
235   BlendFunc_SectionShape mySShape;
236   Convert_ParameterisationType myTConv;
237
238
239 };
240
241
242
243
244
245
246
247 #endif // _BRepBlend_SurfRstConstRad_HeaderFile