42cf5bc1 |
1 | // Created on: 1998-07-08 |
2 | // Created by: Stephanie HUMEAU |
3 | // Copyright (c) 1998-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 _GeomFill_LocationGuide_HeaderFile |
18 | #define _GeomFill_LocationGuide_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <TColgp_HArray2OfPnt2d.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <gp_Mat.hxx> |
28 | #include <math_Vector.hxx> |
29 | #include <GeomFill_PipeError.hxx> |
30 | #include <GeomFill_LocationLaw.hxx> |
31 | #include <TColgp_Array1OfPnt2d.hxx> |
32 | #include <TColgp_Array1OfVec2d.hxx> |
33 | #include <GeomAbs_Shape.hxx> |
34 | #include <TColStd_Array1OfReal.hxx> |
35 | #include <TColgp_HArray1OfPnt2d.hxx> |
36 | class GeomFill_TrihedronWithGuide; |
37 | class GeomFill_SectionLaw; |
42cf5bc1 |
38 | class Standard_NotImplemented; |
39 | class Standard_ConstructionError; |
40 | class Standard_OutOfRange; |
41 | class gp_Mat; |
42 | class GeomFill_LocationLaw; |
43 | class gp_Vec; |
44 | class gp_Pnt; |
45 | class Geom_Curve; |
46 | |
47 | |
48 | class GeomFill_LocationGuide; |
49 | DEFINE_STANDARD_HANDLE(GeomFill_LocationGuide, GeomFill_LocationLaw) |
50 | |
51 | |
52 | class GeomFill_LocationGuide : public GeomFill_LocationLaw |
53 | { |
54 | |
55 | public: |
56 | |
57 | |
58 | Standard_EXPORT GeomFill_LocationGuide(const Handle(GeomFill_TrihedronWithGuide)& Triedre); |
59 | |
60 | Standard_EXPORT void Set (const Handle(GeomFill_SectionLaw)& Section, const Standard_Boolean rotat, const Standard_Real SFirst, const Standard_Real SLast, const Standard_Real PrecAngle, Standard_Real& LastAngle); |
61 | |
62 | Standard_EXPORT void EraseRotation(); |
63 | |
c22b52d6 |
64 | Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE; |
42cf5bc1 |
65 | |
c22b52d6 |
66 | Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE; |
42cf5bc1 |
67 | |
68 | Standard_EXPORT virtual void SetTrsf (const gp_Mat& Transfo) Standard_OVERRIDE; |
69 | |
70 | Standard_EXPORT virtual Handle(GeomFill_LocationLaw) Copy() const Standard_OVERRIDE; |
71 | |
72 | //! compute Location |
73 | Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Mat& M, gp_Vec& V) Standard_OVERRIDE; |
74 | |
75 | //! compute Location and 2d points |
76 | Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Mat& M, gp_Vec& V, TColgp_Array1OfPnt2d& Poles2d) Standard_OVERRIDE; |
77 | |
78 | //! compute location 2d points and associated |
79 | //! first derivatives. |
80 | //! Warning : It used only for C1 or C2 aproximation |
81 | Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, gp_Mat& M, gp_Vec& V, gp_Mat& DM, gp_Vec& DV, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d) Standard_OVERRIDE; |
82 | |
83 | //! compute location 2d points and associated |
84 | //! first and seconde derivatives. |
85 | //! Warning : It used only for C2 aproximation |
86 | Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, gp_Mat& M, gp_Vec& V, gp_Mat& DM, gp_Vec& DV, gp_Mat& D2M, gp_Vec& D2V, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d) Standard_OVERRIDE; |
87 | |
88 | //! Say if the first restriction is defined in this class. |
89 | //! If it is true the first element of poles array in |
90 | //! D0,D1,D2... Correspond to this restriction. |
91 | //! Returns Standard_False (default implementation) |
92 | Standard_EXPORT virtual Standard_Boolean HasFirstRestriction() const Standard_OVERRIDE; |
93 | |
94 | //! Say if the last restriction is defined in this class. |
95 | //! If it is true the last element of poles array in |
96 | //! D0,D1,D2... Correspond to this restriction. |
97 | //! Returns Standard_False (default implementation) |
98 | Standard_EXPORT virtual Standard_Boolean HasLastRestriction() const Standard_OVERRIDE; |
99 | |
21c7c457 |
100 | //! Give the number of trace (Curves 2d which are not restriction) |
42cf5bc1 |
101 | //! Returns 1 (default implementation) |
102 | Standard_EXPORT virtual Standard_Integer TraceNumber() const Standard_OVERRIDE; |
103 | |
104 | //! Give a status to the Law |
105 | //! Returns PipeOk (default implementation) |
106 | Standard_EXPORT virtual GeomFill_PipeError ErrorStatus() const Standard_OVERRIDE; |
107 | |
108 | //! Returns the number of intervals for continuity |
109 | //! <S>. |
110 | //! May be one if Continuity(me) >= <S> |
111 | Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
112 | |
113 | //! Stores in <T> the parameters bounding the intervals |
114 | //! of continuity <S>. |
115 | //! |
21c7c457 |
116 | //! The array must provide enough room to accommodate |
42cf5bc1 |
117 | //! for the parameters. i.e. T.Length() > NbIntervals() |
118 | Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; |
119 | |
120 | //! Sets the bounds of the parametric interval on |
121 | //! the function |
122 | //! This determines the derivatives in these values if the |
123 | //! function is not Cn. |
124 | Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE; |
125 | |
126 | //! Gets the bounds of the parametric interval on |
127 | //! the function |
128 | Standard_EXPORT virtual void GetInterval (Standard_Real& First, Standard_Real& Last) const Standard_OVERRIDE; |
129 | |
130 | //! Gets the bounds of the function parametric domain. |
131 | //! Warning: This domain it is not modified by the |
132 | //! SetValue method |
133 | Standard_EXPORT virtual void GetDomain (Standard_Real& First, Standard_Real& Last) const Standard_OVERRIDE; |
134 | |
135 | //! Is usefull, if (me) have to run numerical |
136 | //! algorithm to perform D0, D1 or D2 |
137 | //! The default implementation make nothing. |
138 | Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) Standard_OVERRIDE; |
139 | |
140 | //! Returns the resolutions in the sub-space 2d <Index> |
141 | //! This information is usfull to find an good tolerance in |
142 | //! 2d approximation. |
143 | //! Warning: Used only if Nb2dCurve > 0 |
144 | Standard_EXPORT virtual void Resolution (const Standard_Integer Index, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE; |
145 | |
146 | //! Get the maximum Norm of the matrix-location part. It |
147 | //! is usful to find an good Tolerance to approx M(t). |
148 | Standard_EXPORT virtual Standard_Real GetMaximalNorm() Standard_OVERRIDE; |
149 | |
150 | //! Get average value of M(t) and V(t) it is usfull to |
151 | //! make fast approximation of rational surfaces. |
152 | Standard_EXPORT virtual void GetAverageLaw (gp_Mat& AM, gp_Vec& AV) Standard_OVERRIDE; |
153 | |
154 | //! Say if the Location Law, is an translation of Location |
155 | //! The default implementation is " returns False ". |
156 | Standard_EXPORT virtual Standard_Boolean IsTranslation (Standard_Real& Error) const Standard_OVERRIDE; |
157 | |
158 | //! Say if the Location Law, is a rotation of Location |
159 | //! The default implementation is " returns False ". |
160 | Standard_EXPORT virtual Standard_Boolean IsRotation (Standard_Real& Error) const Standard_OVERRIDE; |
161 | |
162 | Standard_EXPORT virtual void Rotation (gp_Pnt& Center) const Standard_OVERRIDE; |
163 | |
164 | Standard_EXPORT Handle(Geom_Curve) Section() const; |
165 | |
c22b52d6 |
166 | Standard_EXPORT Handle(Adaptor3d_Curve) Guide() const; |
42cf5bc1 |
167 | |
168 | Standard_EXPORT void SetOrigine (const Standard_Real Param1, const Standard_Real Param2); |
169 | |
170 | Standard_EXPORT GeomFill_PipeError ComputeAutomaticLaw (Handle(TColgp_HArray1OfPnt2d)& ParAndRad) const; |
171 | |
172 | |
173 | |
174 | |
92efcf78 |
175 | DEFINE_STANDARD_RTTIEXT(GeomFill_LocationGuide,GeomFill_LocationLaw) |
42cf5bc1 |
176 | |
177 | protected: |
178 | |
179 | |
180 | Handle(TColgp_HArray2OfPnt2d) myPoles2d; |
181 | |
182 | |
183 | private: |
184 | |
185 | |
186 | Standard_EXPORT void SetRotation (const Standard_Real PrecAngle, Standard_Real& LastAngle); |
187 | |
18434846 |
188 | Standard_EXPORT void InitX (const Standard_Real Param); |
42cf5bc1 |
189 | |
190 | Handle(GeomFill_TrihedronWithGuide) myLaw; |
191 | Handle(GeomFill_SectionLaw) mySec; |
c22b52d6 |
192 | Handle(Adaptor3d_Curve) myCurve; |
193 | Handle(Adaptor3d_Curve) myGuide; |
194 | Handle(Adaptor3d_Curve) myTrimmed; |
42cf5bc1 |
195 | Standard_Integer myNbPts; |
196 | Standard_Boolean rotation; |
197 | Standard_Real OrigParam1; |
198 | Standard_Real OrigParam2; |
199 | Standard_Real Uf; |
200 | Standard_Real Ul; |
201 | Standard_Real myFirstS; |
202 | Standard_Real myLastS; |
203 | Standard_Real ratio; |
204 | Standard_Boolean WithTrans; |
205 | gp_Mat Trans; |
206 | math_Vector TolRes; |
207 | math_Vector Inf; |
208 | math_Vector Sup; |
209 | math_Vector X; |
210 | math_Vector R; |
211 | GeomFill_PipeError myStatus; |
212 | |
213 | |
214 | }; |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | #endif // _GeomFill_LocationGuide_HeaderFile |