42cf5bc1 |
1 | // Created on: 1995-01-04 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1995-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 _BlendFunc_CSCircular_HeaderFile |
18 | #define _BlendFunc_CSCircular_HeaderFile |
19 | |
c22b52d6 |
20 | #include <Adaptor3d_Surface.hxx> |
42cf5bc1 |
21 | #include <gp_Pnt.hxx> |
22 | #include <gp_Pnt2d.hxx> |
42cf5bc1 |
23 | #include <gp_Vec.hxx> |
24 | #include <gp_Vec2d.hxx> |
42cf5bc1 |
25 | #include <BlendFunc_SectionShape.hxx> |
26 | #include <Convert_ParameterisationType.hxx> |
27 | #include <Blend_CSFunction.hxx> |
28 | #include <math_Vector.hxx> |
29 | #include <TColgp_Array1OfPnt.hxx> |
30 | #include <TColgp_Array1OfVec.hxx> |
31 | #include <TColgp_Array1OfPnt2d.hxx> |
32 | #include <TColgp_Array1OfVec2d.hxx> |
33 | #include <TColStd_Array1OfReal.hxx> |
34 | #include <GeomAbs_Shape.hxx> |
35 | #include <TColStd_Array1OfInteger.hxx> |
c22b52d6 |
36 | |
42cf5bc1 |
37 | class Law_Function; |
38 | class math_Matrix; |
42cf5bc1 |
39 | class gp_Circ; |
40 | class Blend_Point; |
41 | |
42cf5bc1 |
42 | class BlendFunc_CSCircular : public Blend_CSFunction |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
49 | //! Creates a function for a circular blending between |
50 | //! a curve <C> and a surface <S>. The direction of |
51 | //! the planes are given by <CGuide>. The position of |
52 | //! the plane is determined on the curve <C>. <L> |
53 | //! defines the change of parameter between <C> and |
54 | //! <CGuide>. So, the planes are defined as described |
55 | //! below : |
56 | //! t is the current parameter on the guide line. |
57 | //! Pguide = C(L(t)); Nguide = CGuide'(t)/||CGuide'(t)|| |
c22b52d6 |
58 | Standard_EXPORT BlendFunc_CSCircular(const Handle(Adaptor3d_Surface)& S, const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Curve)& CGuide, const Handle(Law_Function)& L); |
42cf5bc1 |
59 | |
60 | Standard_EXPORT virtual Standard_Integer NbVariables() const Standard_OVERRIDE; |
61 | |
62 | //! returns the number of equations of the function (3). |
79104795 |
63 | Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE; |
42cf5bc1 |
64 | |
65 | //! computes the values <F> of the Functions for the |
66 | //! variable <X>. |
67 | //! Returns True if the computation was done successfully, |
68 | //! False otherwise. |
79104795 |
69 | Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE; |
42cf5bc1 |
70 | |
71 | //! returns the values <D> of the derivatives for the |
72 | //! variable <X>. |
73 | //! Returns True if the computation was done successfully, |
74 | //! False otherwise. |
79104795 |
75 | Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE; |
42cf5bc1 |
76 | |
77 | //! returns the values <F> of the functions and the derivatives |
78 | //! <D> for the variable <X>. |
79 | //! Returns True if the computation was done successfully, |
80 | //! False otherwise. |
79104795 |
81 | Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE; |
42cf5bc1 |
82 | |
79104795 |
83 | Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE; |
42cf5bc1 |
84 | |
79104795 |
85 | Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; |
42cf5bc1 |
86 | |
79104795 |
87 | Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE; |
42cf5bc1 |
88 | |
79104795 |
89 | Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE; |
42cf5bc1 |
90 | |
79104795 |
91 | Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE; |
42cf5bc1 |
92 | |
79104795 |
93 | Standard_EXPORT const gp_Pnt& PointOnS() const Standard_OVERRIDE; |
42cf5bc1 |
94 | |
79104795 |
95 | Standard_EXPORT const gp_Pnt& PointOnC() const Standard_OVERRIDE; |
42cf5bc1 |
96 | |
97 | //! Returns U,V coordinates of the point on the surface. |
79104795 |
98 | Standard_EXPORT const gp_Pnt2d& Pnt2d() const Standard_OVERRIDE; |
42cf5bc1 |
99 | |
100 | //! Returns parameter of the point on the curve. |
79104795 |
101 | Standard_EXPORT Standard_Real ParameterOnC() const Standard_OVERRIDE; |
42cf5bc1 |
102 | |
79104795 |
103 | Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE; |
42cf5bc1 |
104 | |
79104795 |
105 | Standard_EXPORT const gp_Vec& TangentOnS() const Standard_OVERRIDE; |
42cf5bc1 |
106 | |
79104795 |
107 | Standard_EXPORT const gp_Vec2d& Tangent2d() const Standard_OVERRIDE; |
42cf5bc1 |
108 | |
79104795 |
109 | Standard_EXPORT const gp_Vec& TangentOnC() const Standard_OVERRIDE; |
42cf5bc1 |
110 | |
111 | //! Returns the tangent vector at the section, |
112 | //! at the beginning and the end of the section, and |
113 | //! returns the normal (of the surface) at |
114 | //! these points. |
79104795 |
115 | Standard_EXPORT void Tangent (const Standard_Real U, const Standard_Real V, gp_Vec& TgS, gp_Vec& NormS) const Standard_OVERRIDE; |
42cf5bc1 |
116 | |
117 | Standard_EXPORT void Set (const Standard_Real Radius, const Standard_Integer Choix); |
118 | |
119 | //! Sets the type of section generation for the |
120 | //! approximations. |
121 | Standard_EXPORT void Set (const BlendFunc_SectionShape TypeSection); |
122 | |
123 | 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); |
124 | |
125 | //! Used for the first and last section |
126 | //! The method returns Standard_True if the derivatives |
127 | //! are computed, otherwise it returns Standard_False. |
128 | 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) Standard_OVERRIDE; |
129 | |
130 | Standard_EXPORT Standard_Boolean GetSection (const Standard_Real Param, const Standard_Real U, const Standard_Real V, const Standard_Real W, TColgp_Array1OfPnt& tabP, TColgp_Array1OfVec& tabV); |
131 | |
132 | //! Returns if the section is rationnal |
79104795 |
133 | Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; |
42cf5bc1 |
134 | |
135 | //! Returns the length of the maximum section |
79104795 |
136 | Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE; |
42cf5bc1 |
137 | |
138 | //! Compute the minimal value of weight for each poles |
139 | //! of all sections. |
79104795 |
140 | Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE; |
42cf5bc1 |
141 | |
142 | //! Returns the number of intervals for continuity |
143 | //! <S>. May be one if Continuity(me) >= <S> |
79104795 |
144 | Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
42cf5bc1 |
145 | |
146 | //! Stores in <T> the parameters bounding the intervals |
147 | //! of continuity <S>. |
148 | //! |
21c7c457 |
149 | //! The array must provide enough room to accommodate |
42cf5bc1 |
150 | //! for the parameters. i.e. T.Length() > NbIntervals() |
151 | //! raises |
152 | //! OutOfRange from Standard |
79104795 |
153 | Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; |
42cf5bc1 |
154 | |
79104795 |
155 | Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE; |
42cf5bc1 |
156 | |
157 | //! Returns the tolerance to reach in approximation |
158 | //! to respecte |
159 | //! BoundTol error at the Boundary |
160 | //! AngleTol tangent error at the Boundary |
161 | //! SurfTol error inside the surface. |
79104795 |
162 | 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 |
163 | |
79104795 |
164 | Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE; |
42cf5bc1 |
165 | |
79104795 |
166 | Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE; |
42cf5bc1 |
167 | |
168 | //! Used for the first and last section |
79104795 |
169 | 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 |
170 | |
79104795 |
171 | Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE; |
42cf5bc1 |
172 | |
79104795 |
173 | Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; |
42cf5bc1 |
174 | |
175 | |
176 | |
177 | |
178 | protected: |
179 | |
180 | |
181 | |
182 | |
183 | |
184 | private: |
185 | |
186 | |
187 | |
c22b52d6 |
188 | Handle(Adaptor3d_Surface) surf; |
189 | Handle(Adaptor3d_Curve) curv; |
190 | Handle(Adaptor3d_Curve) guide; |
42cf5bc1 |
191 | Handle(Law_Function) law; |
192 | gp_Pnt pts; |
193 | gp_Pnt ptc; |
194 | gp_Pnt2d pt2d; |
195 | Standard_Real prmc; |
196 | Standard_Real dprmc; |
197 | Standard_Boolean istangent; |
198 | gp_Vec tgs; |
199 | gp_Vec2d tg2d; |
200 | gp_Vec tgc; |
201 | Standard_Real ray; |
202 | Standard_Integer choix; |
203 | gp_Vec d1gui; |
204 | gp_Vec d2gui; |
205 | gp_Vec nplan; |
206 | Standard_Real normtg; |
207 | Standard_Real maxang; |
208 | Standard_Real minang; |
209 | BlendFunc_SectionShape mySShape; |
210 | Convert_ParameterisationType myTConv; |
211 | |
212 | |
213 | }; |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | |
221 | #endif // _BlendFunc_CSCircular_HeaderFile |