0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BSplSLib / BSplSLib.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-08-26
2// Created by: JCV
3// Copyright (c) 1991-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 _BSplSLib_HeaderFile
18#define _BSplSLib_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Integer.hxx>
25#include <Standard_Real.hxx>
26#include <Standard_Boolean.hxx>
27#include <TColgp_Array2OfPnt.hxx>
28#include <TColStd_Array2OfReal.hxx>
29#include <TColStd_Array1OfReal.hxx>
30#include <TColStd_Array1OfInteger.hxx>
31#include <TColgp_Array1OfPnt.hxx>
32#include <BSplSLib_EvaluatorFunction.hxx>
33class gp_Pnt;
34class gp_Vec;
35
36
37//! BSplSLib B-spline surface Library
38//! This package provides an implementation of geometric
39//! functions for rational and non rational, periodic and non
40//! periodic B-spline surface computation.
41//!
42//! this package uses the multi-dimensions splines methods
43//! provided in the package BSplCLib.
44//!
45//! In this package the B-spline surface is defined with :
46//! . its control points : Array2OfPnt Poles
47//! . its weights : Array2OfReal Weights
48//! . its knots and their multiplicity in the two parametric
49//! direction U and V : Array1OfReal UKnots, VKnots and
50//! Array1OfInteger UMults, VMults.
51//! . the degree of the normalized Spline functions :
52//! UDegree, VDegree
53//!
54//! . the Booleans URational, VRational to know if the weights
55//! are constant in the U or V direction.
56//!
57//! . the Booleans UPeriodic, VRational to know if the the
58//! surface is periodic in the U or V direction.
59//!
60//! Warnings : The bounds of UKnots and UMults should be the
61//! same, the bounds of VKnots and VMults should be the same,
62//! the bounds of Poles and Weights shoud be the same.
63//!
64//! The Control points representation is :
65//! Poles(Uorigin,Vorigin) ...................Poles(Uorigin,Vend)
66//! . .
67//! . .
68//! Poles(Uend, Vorigin) .....................Poles(Uend, Vend)
69//!
70//! For the double array the row indice corresponds to the
71//! parametric U direction and the columns indice corresponds
72//! to the parametric V direction.
73//!
0e14656b 74//! Note: weight and multiplicity arrays can be passed by pointer for
75//! some functions so that NULL pointer is valid.
76//! That means no weights/no multiplicities passed.
77//!
42cf5bc1 78//! KeyWords :
79//! B-spline surface, Functions, Library
80//!
81//! References :
82//! . A survey of curve and surface methods in CADG Wolfgang BOHM
83//! CAGD 1 (1984)
84//! . On de Boor-like algorithms and blossoming Wolfgang BOEHM
85//! cagd 5 (1988)
86//! . Blossoming and knot insertion algorithms for B-spline curves
87//! Ronald N. GOLDMAN
88//! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
89//! . Curves and Surfaces for Computer Aided Geometric Design,
90//! a practical guide Gerald Farin
91class BSplSLib
92{
93public:
94
95 DEFINE_STANDARD_ALLOC
96
97
98
99 //! this is a one dimensional function
100 //! typedef void (*EvaluatorFunction) (
101 //! Standard_Integer // Derivative Request
102 //! Standard_Real * // StartEnd[2][2]
103 //! // [0] = U
104 //! // [1] = V
105 //! // [0] = start
106 //! // [1] = end
107 //! Standard_Real // UParameter
108 //! Standard_Real // VParamerer
109 //! Standard_Real & // Result
110 //! Standard_Integer &) ;// Error Code
111 //! serves to multiply a given vectorial BSpline by a function
112 //! Computes the derivatives of a ratio of
113 //! two-variables functions x(u,v) / w(u,v) at orders
114 //! <N,M>, x(u,v) is a vector in dimension
115 //! <3>.
116 //!
117 //! <Ders> is an array containing the values of the
118 //! input derivatives from 0 to Min(<N>,<UDeg>), 0 to
119 //! Min(<M>,<VDeg>). For orders higher than
120 //! <UDeg,VDeg> the input derivatives are assumed to
121 //! be 0.
122 //!
123 //! The <Ders> is a 2d array and the dimension of the
124 //! lines is always (<VDeg>+1) * (<3>+1), even
125 //! if <N> is smaller than <Udeg> (the derivatives
126 //! higher than <N> are not used).
127 //!
128 //! Content of <Ders> :
129 //!
130 //! x(i,j)[k] means : the composant k of x derivated
131 //! (i) times in u and (j) times in v.
132 //!
133 //! ... First line ...
134 //!
135 //! x[1],x[2],...,x[3],w
136 //! x(0,1)[1],...,x(0,1)[3],w(1,0)
137 //! ...
138 //! x(0,VDeg)[1],...,x(0,VDeg)[3],w(0,VDeg)
139 //!
140 //! ... Then second line ...
141 //!
142 //! x(1,0)[1],...,x(1,0)[3],w(1,0)
143 //! x(1,1)[1],...,x(1,1)[3],w(1,1)
144 //! ...
145 //! x(1,VDeg)[1],...,x(1,VDeg)[3],w(1,VDeg)
146 //!
147 //! ...
148 //!
149 //! ... Last line ...
150 //!
151 //! x(UDeg,0)[1],...,x(UDeg,0)[3],w(UDeg,0)
152 //! x(UDeg,1)[1],...,x(UDeg,1)[3],w(UDeg,1)
153 //! ...
154 //! x(Udeg,VDeg)[1],...,x(UDeg,VDeg)[3],w(Udeg,VDeg)
155 //!
156 //! If <All> is false, only the derivative at order
157 //! <N,M> is computed. <RDers> is an array of length
158 //! 3 which will contain the result :
159 //!
160 //! x(1)/w , x(2)/w , ... derivated <N> <M> times
161 //!
162 //! If <All> is true multiples derivatives are
163 //! computed. All the derivatives (i,j) with 0 <= i+j
164 //! <= Max(N,M) are computed. <RDers> is an array of
165 //! length 3 * (<N>+1) * (<M>+1) which will
166 //! contains :
167 //!
168 //! x(1)/w , x(2)/w , ...
169 //! x(1)/w , x(2)/w , ... derivated <0,1> times
170 //! x(1)/w , x(2)/w , ... derivated <0,2> times
171 //! ...
172 //! x(1)/w , x(2)/w , ... derivated <0,N> times
173 //!
174 //! x(1)/w , x(2)/w , ... derivated <1,0> times
175 //! x(1)/w , x(2)/w , ... derivated <1,1> times
176 //! ...
177 //! x(1)/w , x(2)/w , ... derivated <1,N> times
178 //!
179 //! x(1)/w , x(2)/w , ... derivated <N,0> times
180 //! ....
181 //! Warning: <RDers> must be dimensionned properly.
182 Standard_EXPORT static void RationalDerivative (const Standard_Integer UDeg, const Standard_Integer VDeg, const Standard_Integer N, const Standard_Integer M, Standard_Real& Ders, Standard_Real& RDers, const Standard_Boolean All = Standard_True);
183
0e14656b 184 Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Pnt& P);
42cf5bc1 185
0e14656b 186 Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer Degree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Pnt& P, gp_Vec& Vu, gp_Vec& Vv);
42cf5bc1 187
0e14656b 188 Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Pnt& P, gp_Vec& Vu, gp_Vec& Vv, gp_Vec& Vuu, gp_Vec& Vvv, gp_Vec& Vuv);
42cf5bc1 189
0e14656b 190 Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Pnt& P, gp_Vec& Vu, gp_Vec& Vv, gp_Vec& Vuu, gp_Vec& Vvv, gp_Vec& Vuv, gp_Vec& Vuuu, gp_Vec& Vvvv, gp_Vec& Vuuv, gp_Vec& Vuvv);
42cf5bc1 191
0e14656b 192 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Vec& Vn);
42cf5bc1 193
194 //! Computes the poles and weights of an isoparametric
195 //! curve at parameter <Param> (UIso if <IsU> is True,
196 //! VIso else).
0e14656b 197 Standard_EXPORT static void Iso (const Standard_Real Param, const Standard_Boolean IsU, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, const Standard_Integer Degree, const Standard_Boolean Periodic, TColgp_Array1OfPnt& CPoles, TColStd_Array1OfReal* CWeights);
42cf5bc1 198
199 //! Reverses the array of poles. Last is the Index of
200 //! the new first Row( Col) of Poles.
201 //! On a non periodic surface Last is
202 //! Poles.Upper().
203 //! On a periodic curve last is
204 //! (number of flat knots - degree - 1)
205 //! or
206 //! (sum of multiplicities(but for the last) + degree
207 //! - 1)
208 Standard_EXPORT static void Reverse (TColgp_Array2OfPnt& Poles, const Standard_Integer Last, const Standard_Boolean UDirection);
209
210 //! Makes an homogeneous evaluation of Poles and Weights
211 //! any and returns in P the Numerator value and
212 //! in W the Denominator value if Weights are present
213 //! otherwise returns 1.0e0
0e14656b 214 Standard_EXPORT static void HomogeneousD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, Standard_Real& W, gp_Pnt& P);
42cf5bc1 215
216 //! Makes an homogeneous evaluation of Poles and Weights
217 //! any and returns in P the Numerator value and
218 //! in W the Denominator value if Weights are present
219 //! otherwise returns 1.0e0
0e14656b 220 Standard_EXPORT static void HomogeneousD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, gp_Pnt& N, gp_Vec& Nu, gp_Vec& Nv, Standard_Real& D, Standard_Real& Du, Standard_Real& Dv);
42cf5bc1 221
222 //! Reverses the array of weights.
223 Standard_EXPORT static void Reverse (TColStd_Array2OfReal& Weights, const Standard_Integer Last, const Standard_Boolean UDirection);
224
225
226 //! Returns False if all the weights of the array <Weights>
227 //! in the area [I1,I2] * [J1,J2] are identic.
228 //! Epsilon is used for comparing weights.
229 //! If Epsilon is 0. the Epsilon of the first weight is used.
230 Standard_EXPORT static Standard_Boolean IsRational (const TColStd_Array2OfReal& Weights, const Standard_Integer I1, const Standard_Integer I2, const Standard_Integer J1, const Standard_Integer J2, const Standard_Real Epsilon = 0.0);
231
232 //! Copy in FP the coordinates of the poles.
233 Standard_EXPORT static void SetPoles (const TColgp_Array2OfPnt& Poles, TColStd_Array1OfReal& FP, const Standard_Boolean UDirection);
234
235 //! Copy in FP the coordinates of the poles.
236 Standard_EXPORT static void SetPoles (const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal& Weights, TColStd_Array1OfReal& FP, const Standard_Boolean UDirection);
237
238 //! Get from FP the coordinates of the poles.
239 Standard_EXPORT static void GetPoles (const TColStd_Array1OfReal& FP, TColgp_Array2OfPnt& Poles, const Standard_Boolean UDirection);
240
241 //! Get from FP the coordinates of the poles.
242 Standard_EXPORT static void GetPoles (const TColStd_Array1OfReal& FP, TColgp_Array2OfPnt& Poles, TColStd_Array2OfReal& Weights, const Standard_Boolean UDirection);
243
244 //! Find the new poles which allows an old point (with a
245 //! given u,v as parameters) to reach a new position
246 //! UIndex1,UIndex2 indicate the range of poles we can
247 //! move for U
248 //! (1, UNbPoles-1) or (2, UNbPoles) -> no constraint
249 //! for one side in U
250 //! (2, UNbPoles-1) -> the ends are enforced for U
251 //! don't enter (1,NbPoles) and (1,VNbPoles)
252 //! -> error: rigid move
253 //! if problem in BSplineBasis calculation, no change
254 //! for the curve and
255 //! UFirstIndex, VLastIndex = 0
256 //! VFirstIndex, VLastIndex = 0
257 Standard_EXPORT static void MovePoint (const Standard_Real U, const Standard_Real V, const gp_Vec& Displ, const Standard_Integer UIndex1, const Standard_Integer UIndex2, const Standard_Integer VIndex1, const Standard_Integer VIndex2, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean Rational, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal& Weights, const TColStd_Array1OfReal& UFlatKnots, const TColStd_Array1OfReal& VFlatKnots, Standard_Integer& UFirstIndex, Standard_Integer& ULastIndex, Standard_Integer& VFirstIndex, Standard_Integer& VLastIndex, TColgp_Array2OfPnt& NewPoles);
258
0e14656b 259 Standard_EXPORT static void InsertKnots (const Standard_Boolean UDirection, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array2OfPnt& NewPoles, TColStd_Array2OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
42cf5bc1 260
0e14656b 261 Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Boolean UDirection, const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array2OfPnt& NewPoles, TColStd_Array2OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
42cf5bc1 262
0e14656b 263 Standard_EXPORT static void IncreaseDegree (const Standard_Boolean UDirection, const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array2OfPnt& NewPoles, TColStd_Array2OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
42cf5bc1 264
0e14656b 265 Standard_EXPORT static void Unperiodize (const Standard_Boolean UDirection, const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array2OfPnt& NewPoles, TColStd_Array2OfReal* NewWeights);
42cf5bc1 266
267 //! Used as argument for a non rational curve.
0e14656b 268 static TColStd_Array2OfReal* NoWeights();
42cf5bc1 269
270 //! Perform the evaluation of the Taylor expansion
271 //! of the Bspline normalized between 0 and 1.
272 //! If rational computes the homogeneous Taylor expension
273 //! for the numerator and stores it in CachePoles
0e14656b 274 Standard_EXPORT static void BuildCache (const Standard_Real U, const Standard_Real V, const Standard_Real USpanDomain, const Standard_Real VSpanDomain, const Standard_Boolean UPeriodicFlag, const Standard_Boolean VPeriodicFlag, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Integer UIndex, const Standard_Integer VIndex, const TColStd_Array1OfReal& UFlatKnots, const TColStd_Array1OfReal& VFlatKnots, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, TColgp_Array2OfPnt& CachePoles, TColStd_Array2OfReal* CacheWeights);
42cf5bc1 275
276 //! Perform the evaluation of the Taylor expansion
277 //! of the Bspline normalized between 0 and 1.
278 //! Structure of result optimized for BSplSLib_Cache.
0e14656b 279 Standard_EXPORT static void BuildCache (const Standard_Real theU, const Standard_Real theV, const Standard_Real theUSpanDomain, const Standard_Real theVSpanDomain, const Standard_Boolean theUPeriodic, const Standard_Boolean theVPeriodic, const Standard_Integer theUDegree, const Standard_Integer theVDegree, const Standard_Integer theUIndex, const Standard_Integer theVIndex, const TColStd_Array1OfReal& theUFlatKnots, const TColStd_Array1OfReal& theVFlatKnots, const TColgp_Array2OfPnt& thePoles, const TColStd_Array2OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
42cf5bc1 280
281 //! Perform the evaluation of the of the cache
282 //! the parameter must be normalized between
283 //! the 0 and 1 for the span.
284 //! The Cache must be valid when calling this
285 //! routine. Geom Package will insure that.
286 //! and then multiplies by the weights
287 //! this just evaluates the current point
288 //! the CacheParameter is where the Cache was
289 //! constructed the SpanLength is to normalize
290 //! the polynomial in the cache to avoid bad conditioning
291 //! effects
0e14656b 292 Standard_EXPORT static void CacheD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Real UCacheParameter, const Standard_Real VCacheParameter, const Standard_Real USpanLenght, const Standard_Real VSpanLength, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point);
42cf5bc1 293
294 //! Calls CacheD0 for Bezier Surfaces Arrays computed with
295 //! the method PolesCoefficients.
296 //! Warning: To be used for BezierSurfaces ONLY!!!
0e14656b 297 static void CoefsD0 (const Standard_Real U, const Standard_Real V, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point);
42cf5bc1 298
299 //! Perform the evaluation of the of the cache
300 //! the parameter must be normalized between
301 //! the 0 and 1 for the span.
302 //! The Cache must be valid when calling this
303 //! routine. Geom Package will insure that.
304 //! and then multiplies by the weights
305 //! this just evaluates the current point
306 //! the CacheParameter is where the Cache was
307 //! constructed the SpanLength is to normalize
308 //! the polynomial in the cache to avoid bad conditioning
309 //! effects
0e14656b 310 Standard_EXPORT static void CacheD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Real UCacheParameter, const Standard_Real VCacheParameter, const Standard_Real USpanLenght, const Standard_Real VSpanLength, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point, gp_Vec& VecU, gp_Vec& VecV);
42cf5bc1 311
312 //! Calls CacheD0 for Bezier Surfaces Arrays computed with
313 //! the method PolesCoefficients.
314 //! Warning: To be used for BezierSurfaces ONLY!!!
0e14656b 315 static void CoefsD1 (const Standard_Real U, const Standard_Real V, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point, gp_Vec& VecU, gp_Vec& VecV);
42cf5bc1 316
317 //! Perform the evaluation of the of the cache
318 //! the parameter must be normalized between
319 //! the 0 and 1 for the span.
320 //! The Cache must be valid when calling this
321 //! routine. Geom Package will insure that.
322 //! and then multiplies by the weights
323 //! this just evaluates the current point
324 //! the CacheParameter is where the Cache was
325 //! constructed the SpanLength is to normalize
326 //! the polynomial in the cache to avoid bad conditioning
327 //! effects
0e14656b 328 Standard_EXPORT static void CacheD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Real UCacheParameter, const Standard_Real VCacheParameter, const Standard_Real USpanLenght, const Standard_Real VSpanLength, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point, gp_Vec& VecU, gp_Vec& VecV, gp_Vec& VecUU, gp_Vec& VecUV, gp_Vec& VecVV);
42cf5bc1 329
330 //! Calls CacheD0 for Bezier Surfaces Arrays computed with
331 //! the method PolesCoefficients.
332 //! Warning: To be used for BezierSurfaces ONLY!!!
0e14656b 333 static void CoefsD2 (const Standard_Real U, const Standard_Real V, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point, gp_Vec& VecU, gp_Vec& VecV, gp_Vec& VecUU, gp_Vec& VecUV, gp_Vec& VecVV);
42cf5bc1 334
335 //! Warning! To be used for BezierSurfaces ONLY!!!
336 static void PolesCoefficients (const TColgp_Array2OfPnt& Poles, TColgp_Array2OfPnt& CachePoles);
337
338 //! Encapsulation of BuildCache to perform the
339 //! evaluation of the Taylor expansion for beziersurfaces
340 //! at parameters 0.,0.;
341 //! Warning: To be used for BezierSurfaces ONLY!!!
0e14656b 342 Standard_EXPORT static void PolesCoefficients (const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, TColgp_Array2OfPnt& CachePoles, TColStd_Array2OfReal* CacheWeights);
42cf5bc1 343
344 //! Given a tolerance in 3D space returns two
345 //! tolerances, one in U one in V such that for
346 //! all (u1,v1) and (u0,v0) in the domain of
347 //! the surface f(u,v) we have :
348 //! | u1 - u0 | < UTolerance and
349 //! | v1 - v0 | < VTolerance
350 //! we have |f (u1,v1) - f (u0,v0)| < Tolerance3D
0e14656b 351 Standard_EXPORT static void Resolution (const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger& UMults, const TColStd_Array1OfInteger& VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean URat, const Standard_Boolean VRat, const Standard_Boolean UPer, const Standard_Boolean VPer, const Standard_Real Tolerance3D, Standard_Real& UTolerance, Standard_Real& VTolerance);
42cf5bc1 352
353 //! Performs the interpolation of the data points given in
354 //! the Poles array in the form
355 //! [1,...,RL][1,...,RC][1...PolesDimension] . The
356 //! ColLength CL and the Length of UParameters must be the
357 //! same. The length of VFlatKnots is VDegree + CL + 1.
358 //!
359 //! The RowLength RL and the Length of VParameters must be
360 //! the same. The length of VFlatKnots is Degree + RL + 1.
361 //!
362 //! Warning: the method used to do that interpolation
363 //! is gauss elimination WITHOUT pivoting. Thus if the
364 //! diagonal is not dominant there is no guarantee that
365 //! the algorithm will work. Nevertheless for Cubic
366 //! interpolation at knots or interpolation at Scheonberg
367 //! points the method will work. The InversionProblem
368 //! will report 0 if there was no problem else it will
369 //! give the index of the faulty pivot
370 Standard_EXPORT static void Interpolate (const Standard_Integer UDegree, const Standard_Integer VDegree, const TColStd_Array1OfReal& UFlatKnots, const TColStd_Array1OfReal& VFlatKnots, const TColStd_Array1OfReal& UParameters, const TColStd_Array1OfReal& VParameters, TColgp_Array2OfPnt& Poles, TColStd_Array2OfReal& Weights, Standard_Integer& InversionProblem);
371
372 //! Performs the interpolation of the data points given in
373 //! the Poles array.
374 //! The ColLength CL and the Length of UParameters must be
375 //! the same. The length of VFlatKnots is VDegree + CL + 1.
376 //!
377 //! The RowLength RL and the Length of VParameters must be
378 //! the same. The length of VFlatKnots is Degree + RL + 1.
379 //!
380 //! Warning: the method used to do that interpolation
381 //! is gauss elimination WITHOUT pivoting. Thus if the
382 //! diagonal is not dominant there is no guarantee that
383 //! the algorithm will work. Nevertheless for Cubic
384 //! interpolation at knots or interpolation at Scheonberg
385 //! points the method will work. The InversionProblem
386 //! will report 0 if there was no problem else it will
387 //! give the index of the faulty pivot
388 Standard_EXPORT static void Interpolate (const Standard_Integer UDegree, const Standard_Integer VDegree, const TColStd_Array1OfReal& UFlatKnots, const TColStd_Array1OfReal& VFlatKnots, const TColStd_Array1OfReal& UParameters, const TColStd_Array1OfReal& VParameters, TColgp_Array2OfPnt& Poles, Standard_Integer& InversionProblem);
389
390 //! this will multiply a given BSpline numerator N(u,v)
391 //! and denominator D(u,v) defined by its
392 //! U/VBSplineDegree and U/VBSplineKnots, and
393 //! U/VMults. Its Poles and Weights are arrays which are
394 //! coded as array2 of the form
395 //! [1..UNumPoles][1..VNumPoles] by a function a(u,v)
396 //! which is assumed to satisfy the following : 1.
397 //! a(u,v) * N(u,v) and a(u,v) * D(u,v) is a polynomial
398 //! BSpline that can be expressed exactly as a BSpline of
399 //! degree U/VNewDegree on the knots U/VFlatKnots 2. the range
400 //! of a(u,v) is the same as the range of N(u,v)
401 //! or D(u,v)
402 //! ---Warning: it is the caller's responsability to
403 //! insure that conditions 1. and 2. above are satisfied
404 //! : no check whatsoever is made in this method --
9fd2d2c3 405 //! theStatus will return 0 if OK else it will return the
42cf5bc1 406 //! pivot index -- of the matrix that was inverted to
407 //! compute the multiplied -- BSpline : the method used
408 //! is interpolation at Schoenenberg -- points of
409 //! a(u,v)* N(u,v) and a(u,v) * D(u,v)
9fd2d2c3 410 //! theStatus will return 0 if OK else it will return the pivot index
42cf5bc1 411 //! of the matrix that was inverted to compute the multiplied
412 //! BSpline : the method used is interpolation at Schoenenberg
413 //! points of a(u,v)*F(u,v)
414 //! --
9fd2d2c3 415 Standard_EXPORT static void FunctionMultiply (const BSplSLib_EvaluatorFunction& Function, const Standard_Integer UBSplineDegree, const Standard_Integer VBSplineDegree, const TColStd_Array1OfReal& UBSplineKnots, const TColStd_Array1OfReal& VBSplineKnots, const TColStd_Array1OfInteger* UMults, const TColStd_Array1OfInteger* VMults, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, const TColStd_Array1OfReal& UFlatKnots, const TColStd_Array1OfReal& VFlatKnots, const Standard_Integer UNewDegree, const Standard_Integer VNewDegree, TColgp_Array2OfPnt& NewNumerator, TColStd_Array2OfReal& NewDenominator, Standard_Integer& theStatus);
42cf5bc1 416
417
418
419
420protected:
421
422
423
424
425
426private:
427
428
429
430
431
432};
433
434
435#include <BSplSLib.lxx>
436
437
438
439
440
441#endif // _BSplSLib_HeaderFile