1 // Created on: 1995-10-13
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GeomFill_ConstrainedFilling_HeaderFile
18 #define _GeomFill_ConstrainedFilling_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Real.hxx>
26 #include <GeomFill_CornerState.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <TColgp_HArray1OfPnt.hxx>
30 #include <TColStd_HArray1OfInteger.hxx>
31 #include <TColStd_HArray1OfReal.hxx>
32 #include <TColgp_HArray2OfPnt.hxx>
33 class GeomFill_CoonsAlgPatch;
34 class GeomFill_TgtField;
35 class Geom_BSplineSurface;
36 class GeomFill_Boundary;
37 class GeomFill_BoundWithSurf;
40 //! An algorithm for constructing a BSpline surface filled
41 //! from a series of boundaries which serve as path
42 //! constraints and optionally, as tangency constraints.
43 //! The algorithm accepts three or four curves as the
44 //! boundaries of the target surface.
45 //! The only FillingStyle used is Coons.
46 //! A ConstrainedFilling object provides a framework for:
47 //! - defining the boundaries of the surface
48 //! - implementing the construction algorithm
49 //! - consulting the result.
51 //! This surface filling algorithm is specifically designed to
52 //! be used in connection with fillets. Satisfactory results
53 //! cannot be guaranteed for other uses.
54 class GeomFill_ConstrainedFilling
62 //! Constructs an empty framework for filling a surface from boundaries.
63 //! The boundaries of the surface will be defined, and the
64 //! surface will be built by using the function Init.
65 //! The surface will respect the following constraints:
66 //! - its degree will not be greater than MaxDeg
67 //! - the maximum number of segments MaxSeg which
68 //! BSpline surfaces can have.
69 Standard_EXPORT GeomFill_ConstrainedFilling(const Standard_Integer MaxDeg, const Standard_Integer MaxSeg);
71 Standard_EXPORT void Init (const Handle(GeomFill_Boundary)& B1, const Handle(GeomFill_Boundary)& B2, const Handle(GeomFill_Boundary)& B3, const Standard_Boolean NoCheck = Standard_False);
73 //! Constructs a BSpline surface filled from the series of
74 //! boundaries B1, B2, B3 and, if need be, B4, which serve:
75 //! - as path constraints
76 //! - and optionally, as tangency constraints if they are
77 //! GeomFill_BoundWithSurf curves.
78 //! The boundaries may be given in any order: they are
79 //! classified and if necessary, reversed and reparameterized.
80 //! The surface will also respect the following constraints:
81 //! - its degree will not be greater than the maximum
82 //! degree defined at the time of construction of this framework, and
83 //! - the maximum number of segments MaxSeg which BSpline surfaces can have
84 Standard_EXPORT void Init (const Handle(GeomFill_Boundary)& B1, const Handle(GeomFill_Boundary)& B2, const Handle(GeomFill_Boundary)& B3, const Handle(GeomFill_Boundary)& B4, const Standard_Boolean NoCheck = Standard_False);
86 //! Allows to modify domain on witch the blending function
87 //! associated to the constrained boundary B will propag
88 //! the influence of the field of tangency. Can be
89 //! usefull to reduce influence of boundaries on whitch
90 //! the Coons compatibility conditions are not respected.
91 //! l is a relative value of the parametric range of B.
92 //! Default value for l is 1 (used in Init).
93 //! Warning: Must be called after Init with a constrained boundary
94 //! used in the call to Init.
95 Standard_EXPORT void SetDomain (const Standard_Real l, const Handle(GeomFill_BoundWithSurf)& B);
97 //! Computes the new poles of the surface using the new
98 //! blending functions set by several calls to SetDomain.
99 Standard_EXPORT void ReBuild();
101 //! Returns the bound of index i after sort.
102 Standard_EXPORT Handle(GeomFill_Boundary) Boundary (const Standard_Integer I) const;
104 //! Returns the BSpline surface after computation of the fill by this framework.
105 Standard_EXPORT Handle(Geom_BSplineSurface) Surface() const;
107 //! Internal use for Advmath approximation call.
108 Standard_EXPORT Standard_Integer Eval (const Standard_Real W, const Standard_Integer Ord, Standard_Real& Result) const;
110 //! Computes the fields of tangents on 30 points along the
111 //! bound I, these are not the constraint tangents but
112 //! gives an idea of the coonsAlgPatch regularity.
113 Standard_EXPORT void CheckCoonsAlgPatch (const Standard_Integer I);
115 //! Computes the fields of tangents and normals on 30
116 //! points along the bound I, draw them, and computes the
117 //! max dot product that must be near than 0.
118 Standard_EXPORT void CheckTgteField (const Standard_Integer I);
120 //! Computes values and normals along the bound I and
121 //! compare them to the approx result curves (bound and
122 //! tgte field) , draw the normals and tangents.
123 Standard_EXPORT void CheckApprox (const Standard_Integer I);
125 //! Computes values and normals along the bound I on both
126 //! constraint surface and result surface, draw the
127 //! normals, and computes the max distance between values
128 //! and the max angle between normals.
129 Standard_EXPORT void CheckResult (const Standard_Integer I);
143 //! Performs the approximation an compute the poles of the
145 Standard_EXPORT void Build();
147 //! Performs the parallel approximation on two oppsite
149 Standard_EXPORT void PerformApprox();
151 //! matches the nodal vectors of the blending functions
152 //! and the results of the approx to allow the surface
154 Standard_EXPORT void MatchKnots();
156 //! performs the poles of the partial construction S0.
157 Standard_EXPORT void PerformS0();
159 //! performs the poles of the partial construction S1.
160 Standard_EXPORT void PerformS1();
162 //! performs the poles of the surface using the partial
163 //! constructions S0 and S1.
164 Standard_EXPORT void PerformSurface();
166 //! Checks if the field of tangency doesn t twist along the
168 Standard_EXPORT Standard_Boolean CheckTgte (const Standard_Integer I);
170 //! Evaluates the min magnitude of the field of tangency
171 //! along bound I to allow a simple evaluation of the
172 //! tolerance needed for the approximation of the field of
174 Standard_EXPORT void MinTgte (const Standard_Integer I);
177 Standard_Integer degmax;
178 Standard_Integer segmax;
179 Handle(GeomFill_CoonsAlgPatch) ptch;
180 Handle(GeomFill_TgtField) tgalg[4];
181 Standard_Real mig[4];
182 GeomFill_CornerState stcor[4];
184 Standard_Boolean appdone;
185 Standard_Integer degree[2];
186 Handle(TColgp_HArray1OfPnt) curvpol[4];
187 Handle(TColgp_HArray1OfPnt) tgtepol[4];
188 Handle(TColStd_HArray1OfInteger) mults[2];
189 Handle(TColStd_HArray1OfReal) knots[2];
190 Handle(TColStd_HArray1OfReal) ab[4];
191 Handle(TColStd_HArray1OfReal) pq[4];
192 Standard_Real dom[4];
193 Handle(TColgp_HArray1OfPnt) ncpol[4];
194 Handle(TColgp_HArray1OfPnt) ntpol[4];
195 Handle(TColStd_HArray1OfInteger) nm[2];
196 Handle(TColStd_HArray1OfReal) nk[2];
197 Standard_Integer ibound[2];
198 Standard_Integer ctr[2];
199 Standard_Integer nbd3;
200 Handle(TColgp_HArray2OfPnt) S0;
201 Handle(TColgp_HArray2OfPnt) S1;
202 Handle(Geom_BSplineSurface) surf;
213 #endif // _GeomFill_ConstrainedFilling_HeaderFile