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