42cf5bc1 |
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_RstRstEvolRad_HeaderFile |
18 | #define _BRepBlend_RstRstEvolRad_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_RstRstFunction.hxx> |
35 | #include <math_Vector.hxx> |
36 | #include <Blend_DecrochStatus.hxx> |
37 | #include <TColStd_Array1OfReal.hxx> |
38 | #include <GeomAbs_Shape.hxx> |
39 | #include <TColStd_Array1OfInteger.hxx> |
40 | #include <TColgp_Array1OfPnt.hxx> |
41 | #include <TColgp_Array1OfVec.hxx> |
42 | #include <TColgp_Array1OfPnt2d.hxx> |
43 | #include <TColgp_Array1OfVec2d.hxx> |
44 | class Adaptor3d_HSurface; |
45 | class Adaptor2d_HCurve2d; |
46 | class Adaptor3d_HCurve; |
47 | class Law_Function; |
48 | class math_Matrix; |
49 | class gp_Pnt; |
50 | class gp_Pnt2d; |
51 | class gp_Vec; |
52 | class gp_Vec2d; |
53 | class gp_Circ; |
54 | class Blend_Point; |
55 | |
56 | |
57 | //! Function to approximate by AppSurface for |
58 | //! Edge/Edge and evolutif radius |
59 | class BRepBlend_RstRstEvolRad : public Blend_RstRstFunction |
60 | { |
61 | public: |
62 | |
63 | DEFINE_STANDARD_ALLOC |
64 | |
65 | |
66 | Standard_EXPORT BRepBlend_RstRstEvolRad(const Handle(Adaptor3d_HSurface)& Surf1, const Handle(Adaptor2d_HCurve2d)& Rst1, const Handle(Adaptor3d_HSurface)& Surf2, const Handle(Adaptor2d_HCurve2d)& Rst2, const Handle(Adaptor3d_HCurve)& CGuide, const Handle(Law_Function)& Evol); |
67 | |
68 | //! Returns 2. |
79104795 |
69 | Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; |
42cf5bc1 |
70 | |
71 | //! Returns 2. |
79104795 |
72 | Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; |
42cf5bc1 |
73 | |
74 | //! computes the values <F> of the Functions for the |
75 | //! variable <X>. |
76 | //! Returns True if the computation was done successfully, |
77 | //! False otherwise. |
79104795 |
78 | Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE; |
42cf5bc1 |
79 | |
80 | //! returns the values <D> of the derivatives for the |
81 | //! variable <X>. |
82 | //! Returns True if the computation was done successfully, |
83 | //! False otherwise. |
79104795 |
84 | Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE; |
42cf5bc1 |
85 | |
86 | //! returns the values <F> of the functions and the derivatives |
87 | //! <D> for the variable <X>. |
88 | //! Returns True if the computation was done successfully, |
89 | //! False otherwise. |
79104795 |
90 | Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE; |
42cf5bc1 |
91 | |
92 | Standard_EXPORT void Set (const Handle(Adaptor3d_HSurface)& SurfRef1, const Handle(Adaptor2d_HCurve2d)& RstRef1, const Handle(Adaptor3d_HSurface)& SurfRef2, const Handle(Adaptor2d_HCurve2d)& RstRef2); |
93 | |
79104795 |
94 | Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE; |
42cf5bc1 |
95 | |
96 | //! Sets the bounds of the parametric interval on |
97 | //! the guide line. |
98 | //! This determines the derivatives in these values if the |
99 | //! function is not Cn. |
79104795 |
100 | Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; |
42cf5bc1 |
101 | |
79104795 |
102 | Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE; |
42cf5bc1 |
103 | |
79104795 |
104 | Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE; |
42cf5bc1 |
105 | |
79104795 |
106 | Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE; |
42cf5bc1 |
107 | |
108 | //! Returns the minimal Distance beetween two |
109 | //! extremitys of calculed sections. |
110 | Standard_EXPORT virtual Standard_Real GetMinimalDistance() const Standard_OVERRIDE; |
111 | |
79104795 |
112 | Standard_EXPORT const gp_Pnt& PointOnRst1() const Standard_OVERRIDE; |
42cf5bc1 |
113 | |
79104795 |
114 | Standard_EXPORT const gp_Pnt& PointOnRst2() const Standard_OVERRIDE; |
42cf5bc1 |
115 | |
116 | //! Returns U,V coordinates of the point on the surface. |
79104795 |
117 | Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst1() const Standard_OVERRIDE; |
42cf5bc1 |
118 | |
119 | //! Returns U,V coordinates of the point on the curve on |
120 | //! surface. |
79104795 |
121 | Standard_EXPORT const gp_Pnt2d& Pnt2dOnRst2() const Standard_OVERRIDE; |
42cf5bc1 |
122 | |
123 | //! Returns parameter of the point on the curve. |
79104795 |
124 | Standard_EXPORT Standard_Real ParameterOnRst1() const Standard_OVERRIDE; |
42cf5bc1 |
125 | |
126 | //! Returns parameter of the point on the curve. |
79104795 |
127 | Standard_EXPORT Standard_Real ParameterOnRst2() const Standard_OVERRIDE; |
42cf5bc1 |
128 | |
79104795 |
129 | Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; |
42cf5bc1 |
130 | |
79104795 |
131 | Standard_EXPORT const gp_Vec& TangentOnRst1() const Standard_OVERRIDE; |
42cf5bc1 |
132 | |
79104795 |
133 | Standard_EXPORT const gp_Vec2d& Tangent2dOnRst1() const Standard_OVERRIDE; |
42cf5bc1 |
134 | |
79104795 |
135 | Standard_EXPORT const gp_Vec& TangentOnRst2() const Standard_OVERRIDE; |
42cf5bc1 |
136 | |
79104795 |
137 | Standard_EXPORT const gp_Vec2d& Tangent2dOnRst2() const Standard_OVERRIDE; |
42cf5bc1 |
138 | |
139 | //! Enables implementation of a criterion of decrochage |
140 | //! specific to the function. |
79104795 |
141 | Standard_EXPORT Blend_DecrochStatus Decroch (const math_Vector& Sol, gp_Vec& NRst1, gp_Vec& TgRst1, gp_Vec& NRst2, gp_Vec& TgRst2) const Standard_OVERRIDE; |
42cf5bc1 |
142 | |
143 | Standard_EXPORT void Set (const Standard_Integer Choix); |
144 | |
145 | //! Sets the type of section generation for the |
146 | //! approximations. |
147 | Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection); |
148 | |
149 | //! Gives the center of circle defined by PtRst1, PtRst2 and |
150 | //! radius ray. |
151 | Standard_EXPORT Standard_Boolean CenterCircleRst1Rst2 (const gp_Pnt& PtRst1, const gp_Pnt& PtRst2, const gp_Vec& np, gp_Pnt& Center, gp_Vec& VdMed) const; |
152 | |
153 | Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U, const Standard_Real V, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Circ& C); |
154 | |
155 | //! Returns if the section is rationnal |
79104795 |
156 | Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; |
42cf5bc1 |
157 | |
158 | //! Returns the length of the maximum section |
79104795 |
159 | Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; |
42cf5bc1 |
160 | |
161 | //! Compute the minimal value of weight for each poles |
162 | //! of all sections. |
79104795 |
163 | Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; |
42cf5bc1 |
164 | |
165 | //! Returns the number of intervals for continuity |
166 | //! <S>. May be one if Continuity(me) >= <S> |
79104795 |
167 | Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
42cf5bc1 |
168 | |
169 | //! Stores in <T> the parameters bounding the intervals |
170 | //! of continuity <S>. |
171 | //! The array must provide enough room to accomodate |
172 | //! for the parameters. i.e. T.Length() > NbIntervals() |
79104795 |
173 | Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; |
42cf5bc1 |
174 | |
79104795 |
175 | Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE; |
42cf5bc1 |
176 | |
177 | //! Returns the tolerance to reach in approximation |
178 | //! to respecte |
179 | //! BoundTol error at the Boundary |
180 | //! AngleTol tangent error at the Boundary |
181 | //! SurfTol error inside the surface. |
79104795 |
182 | 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; |
42cf5bc1 |
183 | |
79104795 |
184 | Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; |
42cf5bc1 |
185 | |
79104795 |
186 | Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; |
42cf5bc1 |
187 | |
188 | //! Used for the first and last section |
79104795 |
189 | 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) Standard_OVERRIDE; |
42cf5bc1 |
190 | |
79104795 |
191 | Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; |
42cf5bc1 |
192 | |
193 | //! Used for the first and last section |
194 | //! The method returns Standard_True if the derivatives |
195 | //! are computed, otherwise it returns Standard_False. |
79104795 |
196 | 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) Standard_OVERRIDE; |
42cf5bc1 |
197 | |
79104795 |
198 | Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; |
42cf5bc1 |
199 | |
200 | |
201 | |
202 | |
203 | protected: |
204 | |
205 | |
206 | |
207 | |
208 | |
209 | private: |
210 | |
211 | |
212 | |
213 | Handle(Adaptor3d_HSurface) surf1; |
214 | Handle(Adaptor3d_HSurface) surf2; |
215 | Handle(Adaptor2d_HCurve2d) rst1; |
216 | Handle(Adaptor2d_HCurve2d) rst2; |
217 | Adaptor3d_CurveOnSurface cons1; |
218 | Adaptor3d_CurveOnSurface cons2; |
219 | Handle(Adaptor3d_HCurve) guide; |
220 | Handle(Adaptor3d_HCurve) tguide; |
221 | gp_Pnt ptrst1; |
222 | gp_Pnt ptrst2; |
223 | gp_Pnt2d pt2drst1; |
224 | gp_Pnt2d pt2drst2; |
225 | Standard_Real prmrst1; |
226 | Standard_Real prmrst2; |
227 | Standard_Boolean istangent; |
228 | gp_Vec tgrst1; |
229 | gp_Vec2d tg2drst1; |
230 | gp_Vec tgrst2; |
231 | gp_Vec2d tg2drst2; |
232 | Standard_Real ray; |
233 | Standard_Real dray; |
234 | Standard_Integer choix; |
235 | gp_Pnt ptgui; |
236 | gp_Vec d1gui; |
237 | gp_Vec d2gui; |
238 | gp_Vec nplan; |
239 | Standard_Real normtg; |
240 | Standard_Real theD; |
241 | Handle(Adaptor3d_HSurface) surfref1; |
242 | Handle(Adaptor2d_HCurve2d) rstref1; |
243 | Handle(Adaptor3d_HSurface) surfref2; |
244 | Handle(Adaptor2d_HCurve2d) rstref2; |
245 | Standard_Real maxang; |
246 | Standard_Real minang; |
247 | Standard_Real distmin; |
248 | BlendFunc_SectionShape mySShape; |
249 | Convert_ParameterisationType myTConv; |
250 | Handle(Law_Function) tevol; |
251 | Handle(Law_Function) fevol; |
252 | |
253 | |
254 | }; |
255 | |
256 | |
257 | |
258 | |
259 | |
260 | |
261 | |
262 | #endif // _BRepBlend_RstRstEvolRad_HeaderFile |