a79f0660c8e0eaf59e929e62dd5dd9c95f44ee64
[occt.git] / src / BlendFunc / BlendFunc_GenChamfer.hxx
1 // Created by: Julia GERASIMOVA
2 // Copyright (c) 2015 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _BlendFunc_GenChamfer_HeaderFile
16 #define _BlendFunc_GenChamfer_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Handle.hxx>
21
22 #include <Standard_Integer.hxx>
23 #include <Standard_Real.hxx>
24 #include <BlendFunc_Corde.hxx>
25 #include <Blend_Function.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <math_Vector.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 Adaptor3d_HSurface;
36 class Adaptor3d_HCurve;
37 class math_Matrix;
38 class gp_Pnt;
39 class gp_Vec;
40 class gp_Vec2d;
41 class gp_Lin;
42 class Blend_Point;
43
44
45
46 //! Deferred class for a function used to compute a general chamfer
47 class BlendFunc_GenChamfer  : public Blend_Function
48 {
49 public:
50
51   DEFINE_STANDARD_ALLOC
52
53   Standard_EXPORT BlendFunc_GenChamfer(const Handle(Adaptor3d_HSurface)& S1,
54                                        const Handle(Adaptor3d_HSurface)& S2,
55                                        const Handle(Adaptor3d_HCurve)& CG);
56   
57   //! returns the number of equations of the function.
58   Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
59   
60   //! returns the values <F> of the functions and the derivatives
61   //! <D> for the variable <X>.
62   //! Returns True if the computation was done successfully,
63   //! False otherwise.
64   Standard_EXPORT Standard_Boolean Values (const math_Vector& X,
65                                            math_Vector& F,
66                                            math_Matrix& D) Standard_OVERRIDE;
67   
68   //! Sets the value of the parameter along the guide line.
69   //! This determines the plane in which the solution has
70   //! to be found.
71   Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE = 0;
72   
73   //! Sets the bounds of the parametric interval on
74   //! the guide line.
75   //! This determines the derivatives in these values if the
76   //! function is not Cn.
77   Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
78   
79   Standard_EXPORT void GetTolerance (math_Vector& Tolerance,
80                                      const Standard_Real Tol) const Standard_OVERRIDE;
81   
82   Standard_EXPORT void GetBounds (math_Vector& InfBound,
83                                   math_Vector& SupBound) const Standard_OVERRIDE;
84   
85   //! Returns   the    minimal  Distance  beetween   two
86   //! extremitys of calculed sections.
87   Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
88   
89   //! Sets the distances and the "quadrant".
90   Standard_EXPORT virtual void Set (const Standard_Real Dist1,
91                                     const Standard_Real Dist2,
92                                     const Standard_Integer Choix) = 0;
93   
94   //! Returns False
95   Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
96   
97   //! Compute the minimal value of weight for each poles
98   //! of all sections.
99   Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
100   
101   //! Returns  the number  of  intervals for  continuity
102   //! <S>. May be one if Continuity(me) >= <S>
103   Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
104   
105   //! Stores in <T> the  parameters bounding the intervals
106   //! of continuity <S>.
107   //!
108   //! The array must provide  enough room to  accomodate
109   //! for the parameters. i.e. T.Length() > NbIntervals()
110   //! raises
111   //! OutOfRange from Standard
112   Standard_EXPORT void Intervals (TColStd_Array1OfReal& T,
113                                   const GeomAbs_Shape S) const Standard_OVERRIDE;
114   
115   Standard_EXPORT void GetShape (Standard_Integer& NbPoles,
116                                  Standard_Integer& NbKnots,
117                                  Standard_Integer& Degree,
118                                  Standard_Integer& NbPoles2d) Standard_OVERRIDE;
119   
120   //! Returns the tolerance to reach in approximation
121   //! to respecte
122   //! BoundTol error at the Boundary
123   //! AngleTol tangent error at the Boundary
124   //! SurfTol error inside the surface.
125   Standard_EXPORT void GetTolerance (const Standard_Real BoundTol,
126                                      const Standard_Real SurfTol,
127                                      const Standard_Real AngleTol,
128                                      math_Vector& Tol3d,
129                                      math_Vector& Tol1D) const Standard_OVERRIDE;
130   
131   Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
132   
133   Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
134   
135   //! Obsolete method
136   Standard_EXPORT void Section (const Standard_Real Param,
137                                 const Standard_Real U1,
138                                 const Standard_Real V1,
139                                 const Standard_Real U2,
140                                 const Standard_Real V2,
141                                 Standard_Real& Pdeb,
142                                 Standard_Real& Pfin,
143                                 gp_Lin& C);
144   
145   //! Used for the first and last section
146   Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
147                                             TColgp_Array1OfPnt& Poles,
148                                             TColgp_Array1OfVec& DPoles,
149                                             TColgp_Array1OfVec& D2Poles,
150                                             TColgp_Array1OfPnt2d& Poles2d,
151                                             TColgp_Array1OfVec2d& DPoles2d,
152                                             TColgp_Array1OfVec2d& D2Poles2d,
153                                             TColStd_Array1OfReal& Weigths,
154                                             TColStd_Array1OfReal& DWeigths,
155                                             TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
156   
157   //! Used for the first and last section
158   Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
159                                             TColgp_Array1OfPnt& Poles,
160                                             TColgp_Array1OfVec& DPoles,
161                                             TColgp_Array1OfPnt2d& Poles2d,
162                                             TColgp_Array1OfVec2d& DPoles2d,
163                                             TColStd_Array1OfReal& Weigths,
164                                             TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
165   
166   Standard_EXPORT void Section (const Blend_Point& P,
167                                 TColgp_Array1OfPnt& Poles,
168                                 TColgp_Array1OfPnt2d& Poles2d,
169                                 TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
170   
171   Standard_EXPORT void Resolution (const Standard_Integer IC2d,
172                                    const Standard_Real Tol,
173                                    Standard_Real& TolU,
174                                    Standard_Real& TolV) const Standard_OVERRIDE;
175
176
177
178
179 protected:
180
181   Handle(Adaptor3d_HSurface) surf1;
182   Handle(Adaptor3d_HSurface) surf2;
183   Handle(Adaptor3d_HCurve) curv;
184   Standard_Integer choix;
185   Standard_Real tol;
186   Standard_Real distmin;
187
188
189 private:
190
191
192 };
193
194
195
196
197
198
199
200 #endif // _BlendFunc_GenChamfer_HeaderFile