Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:18

0001 // Created on: 1991-08-26
0002 // Created by: JCV
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BSplSLib_HeaderFile
0018 #define _BSplSLib_HeaderFile
0019 
0020 #include <BSplSLib_EvaluatorFunction.hxx>
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <TColgp_Array1OfPnt.hxx>
0024 #include <TColgp_Array2OfPnt.hxx>
0025 #include <TColStd_Array1OfInteger.hxx>
0026 #include <TColStd_Array1OfReal.hxx>
0027 #include <TColStd_Array2OfReal.hxx>
0028 
0029 class gp_Pnt;
0030 class gp_Vec;
0031 
0032 //! BSplSLib   B-spline surface Library
0033 //! This  package provides   an  implementation  of  geometric
0034 //! functions for rational and non rational, periodic  and non
0035 //! periodic B-spline surface computation.
0036 //!
0037 //! this package uses   the  multi-dimensions splines  methods
0038 //! provided in the package BSplCLib.
0039 //!
0040 //! In this package the B-spline surface is defined with :
0041 //! . its control points :  Array2OfPnt     Poles
0042 //! . its weights        :  Array2OfReal    Weights
0043 //! . its knots and their multiplicity in the two parametric
0044 //! direction U and V  :  Array1OfReal    UKnots, VKnots and
0045 //! Array1OfInteger UMults, VMults.
0046 //! . the degree of the normalized Spline functions :
0047 //! UDegree, VDegree
0048 //!
0049 //! . the Booleans URational, VRational to know if the weights
0050 //! are constant in the U or V direction.
0051 //!
0052 //! . the Booleans UPeriodic,   VRational  to know if the  the
0053 //! surface is periodic in the U or V direction.
0054 //!
0055 //! Warnings : The  bounds of UKnots  and UMults should be the
0056 //! same, the bounds of VKnots and VMults should be  the same,
0057 //! the bounds of Poles and Weights should be the same.
0058 //!
0059 //! The Control points representation is :
0060 //! Poles(Uorigin,Vorigin) ...................Poles(Uorigin,Vend)
0061 //! .                                     .
0062 //! .                                     .
0063 //! Poles(Uend, Vorigin) .....................Poles(Uend, Vend)
0064 //!
0065 //! For  the double array  the row indice   corresponds to the
0066 //! parametric U direction  and the columns indice corresponds
0067 //! to the parametric V direction.
0068 //!
0069 //! Note: weight and multiplicity arrays can be passed by pointer for
0070 //! some functions so that NULL pointer is valid.
0071 //! That means no weights/no multiplicities passed.
0072 //! 
0073 //! KeyWords :
0074 //! B-spline surface, Functions, Library
0075 //!
0076 //! References :
0077 //! . A survey of curve and surface methods in CADG Wolfgang BOHM
0078 //! CAGD 1 (1984)
0079 //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM
0080 //! cagd 5 (1988)
0081 //! . Blossoming and knot insertion algorithms for B-spline curves
0082 //! Ronald N. GOLDMAN
0083 //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
0084 //! . Curves and Surfaces for Computer Aided Geometric Design,
0085 //! a practical guide Gerald Farin
0086 class BSplSLib 
0087 {
0088 public:
0089 
0090   DEFINE_STANDARD_ALLOC
0091 
0092   
0093 
0094   //! this is a one dimensional function
0095   //! typedef  void (*EvaluatorFunction)  (
0096   //! Standard_Integer     // Derivative Request
0097   //! Standard_Real    *   // StartEnd[2][2]
0098   //! //  [0] = U
0099   //! //  [1] = V
0100   //! //        [0] = start
0101   //! //        [1] = end
0102   //! Standard_Real        // UParameter
0103   //! Standard_Real        // VParamerer
0104   //! Standard_Real    &   // Result
0105   //! Standard_Integer &) ;// Error Code
0106   //! serves to multiply a given vectorial BSpline by a function
0107   //! Computes  the     derivatives   of  a    ratio  of
0108   //! two-variables functions  x(u,v) / w(u,v) at orders
0109   //! <N,M>,    x(u,v)    is   a  vector in    dimension
0110   //! <3>.
0111   //!
0112   //! <Ders> is  an array  containing the values  of the
0113   //! input derivatives from 0  to Min(<N>,<UDeg>), 0 to
0114   //! Min(<M>,<VDeg>).    For orders    higher      than
0115   //! <UDeg,VDeg>  the  input derivatives are assumed to
0116   //! be 0.
0117   //!
0118   //! The <Ders> is a 2d array and the  dimension of the
0119   //! lines is always (<VDeg>+1) * (<3>+1), even
0120   //! if   <N> is smaller  than  <Udeg> (the derivatives
0121   //! higher than <N> are not used).
0122   //!
0123   //! Content of <Ders> :
0124   //!
0125   //! x(i,j)[k] means :  the composant  k of x derivated
0126   //! (i) times in u and (j) times in v.
0127   //!
0128   //! ... First line ...
0129   //!
0130   //! x[1],x[2],...,x[3],w
0131   //! x(0,1)[1],...,x(0,1)[3],w(1,0)
0132   //! ...
0133   //! x(0,VDeg)[1],...,x(0,VDeg)[3],w(0,VDeg)
0134   //!
0135   //! ... Then second line ...
0136   //!
0137   //! x(1,0)[1],...,x(1,0)[3],w(1,0)
0138   //! x(1,1)[1],...,x(1,1)[3],w(1,1)
0139   //! ...
0140   //! x(1,VDeg)[1],...,x(1,VDeg)[3],w(1,VDeg)
0141   //!
0142   //! ...
0143   //!
0144   //! ... Last line ...
0145   //!
0146   //! x(UDeg,0)[1],...,x(UDeg,0)[3],w(UDeg,0)
0147   //! x(UDeg,1)[1],...,x(UDeg,1)[3],w(UDeg,1)
0148   //! ...
0149   //! x(Udeg,VDeg)[1],...,x(UDeg,VDeg)[3],w(Udeg,VDeg)
0150   //!
0151   //! If <All>  is false, only  the derivative  at order
0152   //! <N,M> is computed.  <RDers> is an  array of length
0153   //! 3 which will contain the result :
0154   //!
0155   //! x(1)/w , x(2)/w ,  ... derivated <N> <M> times
0156   //!
0157   //! If   <All>    is  true  multiples  derivatives are
0158   //! computed. All the  derivatives (i,j) with 0 <= i+j
0159   //! <= Max(N,M) are  computed.  <RDers> is an array of
0160   //! length 3 *  (<N>+1)  * (<M>+1) which  will
0161   //! contains :
0162   //!
0163   //! x(1)/w , x(2)/w ,  ...
0164   //! x(1)/w , x(2)/w ,  ... derivated <0,1> times
0165   //! x(1)/w , x(2)/w ,  ... derivated <0,2> times
0166   //! ...
0167   //! x(1)/w , x(2)/w ,  ... derivated <0,N> times
0168   //!
0169   //! x(1)/w , x(2)/w ,  ... derivated <1,0> times
0170   //! x(1)/w , x(2)/w ,  ... derivated <1,1> times
0171   //! ...
0172   //! x(1)/w , x(2)/w ,  ... derivated <1,N> times
0173   //!
0174   //! x(1)/w , x(2)/w ,  ... derivated <N,0> times
0175   //! ....
0176   //! Warning: <RDers> must be dimensionned properly.
0177   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);
0178   
0179   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);
0180   
0181   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);
0182   
0183   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);
0184   
0185   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);
0186   
0187   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);
0188   
0189   //! Computes the  poles and weights of an isoparametric
0190   //! curve at parameter  <Param> (UIso if <IsU> is True,
0191   //! VIso  else).
0192   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);
0193   
0194   //! Reverses the array of poles. Last is the Index of
0195   //! the new first Row( Col) of Poles.
0196   //! On  a  non periodic surface Last is
0197   //! Poles.Upper().
0198   //! On a periodic curve last is
0199   //! (number of flat knots - degree - 1)
0200   //! or
0201   //! (sum of multiplicities(but  for the last) + degree
0202   //! - 1)
0203   Standard_EXPORT static void Reverse (TColgp_Array2OfPnt& Poles, const Standard_Integer Last, const Standard_Boolean UDirection);
0204   
0205   //! Makes an homogeneous  evaluation of Poles and Weights
0206   //! any and returns in P the Numerator value and
0207   //! in W the Denominator value if Weights are present
0208   //! otherwise returns 1.0e0
0209   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);
0210   
0211   //! Makes an homogeneous  evaluation of Poles and Weights
0212   //! any and returns in P the Numerator value and
0213   //! in W the Denominator value if Weights are present
0214   //! otherwise returns 1.0e0
0215   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);
0216   
0217   //! Reverses the array of weights.
0218   Standard_EXPORT static void Reverse (TColStd_Array2OfReal& Weights, const Standard_Integer Last, const Standard_Boolean UDirection);
0219   
0220 
0221   //! Returns False if all the weights  of the  array <Weights>
0222   //! in the area [I1,I2] * [J1,J2] are  identic.
0223   //! Epsilon  is used for comparing  weights.
0224   //! If Epsilon  is 0. the  Epsilon of the first weight is used.
0225   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);
0226   
0227   //! Copy in FP the coordinates of the poles.
0228   Standard_EXPORT static void SetPoles (const TColgp_Array2OfPnt& Poles, TColStd_Array1OfReal& FP, const Standard_Boolean UDirection);
0229   
0230   //! Copy in FP the coordinates of the poles.
0231   Standard_EXPORT static void SetPoles (const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal& Weights, TColStd_Array1OfReal& FP, const Standard_Boolean UDirection);
0232   
0233   //! Get from FP the coordinates of the poles.
0234   Standard_EXPORT static void GetPoles (const TColStd_Array1OfReal& FP, TColgp_Array2OfPnt& Poles, const Standard_Boolean UDirection);
0235   
0236   //! Get from FP the coordinates of the poles.
0237   Standard_EXPORT static void GetPoles (const TColStd_Array1OfReal& FP, TColgp_Array2OfPnt& Poles, TColStd_Array2OfReal& Weights, const Standard_Boolean UDirection);
0238   
0239   //! Find the new poles which allows an old point (with a
0240   //! given u,v  as parameters)  to  reach a  new position
0241   //! UIndex1,UIndex2 indicate the  range of poles we can
0242   //! move for U
0243   //! (1, UNbPoles-1) or (2, UNbPoles) -> no constraint
0244   //! for one side in U
0245   //! (2, UNbPoles-1)   -> the ends are enforced for U
0246   //! don't enter (1,NbPoles) and (1,VNbPoles)
0247   //! -> error: rigid move
0248   //! if problem in BSplineBasis calculation, no change
0249   //! for the curve  and
0250   //! UFirstIndex, VLastIndex = 0
0251   //! VFirstIndex, VLastIndex = 0
0252   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);
0253   
0254   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);
0255   
0256   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);
0257   
0258   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);
0259   
0260   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);
0261   
0262   //! Used as argument for a non rational curve.
0263     static TColStd_Array2OfReal* NoWeights();
0264   
0265   //! Perform the evaluation of the Taylor expansion
0266   //! of the Bspline normalized between 0 and 1.
0267   //! If rational computes the homogeneous Taylor expension
0268   //! for the numerator and stores it in CachePoles
0269   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);
0270   
0271   //! Perform the evaluation of the Taylor expansion
0272   //! of the Bspline normalized between 0 and 1.
0273   //! Structure of result optimized for BSplSLib_Cache.
0274   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);
0275   
0276   //! Perform the evaluation of the of the cache
0277   //! the parameter must be normalized between
0278   //! the 0 and 1 for the span.
0279   //! The Cache must be valid when calling this
0280   //! routine. Geom Package will insure that.
0281   //! and then multiplies by the weights
0282   //! this just evaluates the current point
0283   //! the CacheParameter is where the Cache was
0284   //! constructed the SpanLength is to normalize
0285   //! the polynomial in the cache to avoid bad conditioning
0286   //! effects
0287   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);
0288   
0289   //! Calls CacheD0 for Bezier Surfaces Arrays computed with
0290   //! the method PolesCoefficients.
0291   //! Warning: To be used for BezierSurfaces ONLY!!!
0292     static void CoefsD0 (const Standard_Real U, const Standard_Real V, const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, gp_Pnt& Point);
0293   
0294   //! Perform the evaluation of the of the cache
0295   //! the parameter must be normalized between
0296   //! the 0 and 1 for the span.
0297   //! The Cache must be valid when calling this
0298   //! routine. Geom Package will insure that.
0299   //! and then multiplies by the weights
0300   //! this just evaluates the current point
0301   //! the CacheParameter is where the Cache was
0302   //! constructed the SpanLength is to normalize
0303   //! the polynomial in the cache to avoid bad conditioning
0304   //! effects
0305   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);
0306   
0307   //! Calls CacheD0 for Bezier Surfaces Arrays computed with
0308   //! the method PolesCoefficients.
0309   //! Warning: To be used for BezierSurfaces ONLY!!!
0310     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);
0311   
0312   //! Perform the evaluation of the of the cache
0313   //! the parameter must be normalized between
0314   //! the 0 and 1 for the span.
0315   //! The Cache must be valid when calling this
0316   //! routine. Geom Package will insure that.
0317   //! and then multiplies by the weights
0318   //! this just evaluates the current point
0319   //! the CacheParameter is where the Cache was
0320   //! constructed the SpanLength is to normalize
0321   //! the polynomial in the cache to avoid bad conditioning
0322   //! effects
0323   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);
0324   
0325   //! Calls CacheD0 for Bezier Surfaces Arrays computed with
0326   //! the method PolesCoefficients.
0327   //! Warning: To be used for BezierSurfaces ONLY!!!
0328     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);
0329   
0330   //! Warning! To be used for BezierSurfaces ONLY!!!
0331     static void PolesCoefficients (const TColgp_Array2OfPnt& Poles, TColgp_Array2OfPnt& CachePoles);
0332   
0333   //! Encapsulation   of  BuildCache    to   perform   the
0334   //! evaluation  of the Taylor expansion for beziersurfaces
0335   //! at parameters 0.,0.;
0336   //! Warning: To be used for BezierSurfaces ONLY!!!
0337   Standard_EXPORT static void PolesCoefficients (const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal* Weights, TColgp_Array2OfPnt& CachePoles, TColStd_Array2OfReal* CacheWeights);
0338   
0339   //! Given a tolerance in 3D space returns two
0340   //! tolerances, one in U one in V such that for
0341   //! all (u1,v1) and (u0,v0) in the domain of
0342   //! the surface f(u,v)  we have :
0343   //! | u1 - u0 | < UTolerance and
0344   //! | v1 - v0 | < VTolerance
0345   //! we have |f (u1,v1) - f (u0,v0)| < Tolerance3D
0346   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);
0347   
0348   //! Performs the interpolation of the data points given in
0349   //! the   Poles       array      in   the      form
0350   //! [1,...,RL][1,...,RC][1...PolesDimension]    .    The
0351   //! ColLength CL and the Length of UParameters must be the
0352   //! same. The length of VFlatKnots is VDegree + CL + 1.
0353   //!
0354   //! The  RowLength RL and the Length of VParameters must be
0355   //! the  same. The length of VFlatKnots is Degree + RL + 1.
0356   //!
0357   //! Warning: the method used  to do that  interpolation
0358   //! is gauss  elimination  WITHOUT pivoting.  Thus if  the
0359   //! diagonal is not  dominant  there is no guarantee  that
0360   //! the   algorithm will    work.  Nevertheless  for Cubic
0361   //! interpolation  at knots or interpolation at Scheonberg
0362   //! points  the method   will work.  The  InversionProblem
0363   //! will  report 0 if there   was no problem  else it will
0364   //! give the index of the faulty pivot
0365   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);
0366   
0367   //! Performs the interpolation of the data points given in
0368   //! the  Poles array.
0369   //! The  ColLength CL and the Length of UParameters must be
0370   //! the  same. The length of VFlatKnots is VDegree + CL + 1.
0371   //!
0372   //! The  RowLength RL and the Length of VParameters must be
0373   //! the  same. The length of VFlatKnots is Degree + RL + 1.
0374   //!
0375   //! Warning: the method used  to do that  interpolation
0376   //! is gauss  elimination  WITHOUT pivoting.  Thus if  the
0377   //! diagonal is not  dominant  there is no guarantee  that
0378   //! the   algorithm will    work.  Nevertheless  for Cubic
0379   //! interpolation  at knots or interpolation at Scheonberg
0380   //! points  the method   will work.  The  InversionProblem
0381   //! will  report 0 if there   was no problem  else it will
0382   //! give the index of the faulty pivot
0383   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);
0384   
0385   //! this will multiply  a given BSpline numerator  N(u,v)
0386   //! and    denominator    D(u,v)  defined     by   its
0387   //! U/VBSplineDegree   and    U/VBSplineKnots,     and
0388   //! U/VMults. Its Poles  and Weights are arrays which are
0389   //! coded   as      array2      of      the    form
0390   //! [1..UNumPoles][1..VNumPoles]  by  a function a(u,v)
0391   //! which  is assumed  to satisfy    the following :  1.
0392   //! a(u,v)  * N(u,v) and a(u,v) *  D(u,v)  is a polynomial
0393   //! BSpline that can be expressed exactly as a BSpline of
0394   //! degree U/VNewDegree  on  the knots U/VFlatKnots 2. the range
0395   //! of a(u,v) is   the   same as  the range   of  N(u,v)
0396   //! or D(u,v)
0397   //! ---Warning:  it is   the caller's  responsibility  to
0398   //! insure that conditions 1. and  2. above are satisfied
0399   //! : no  check  whatsoever is made   in  this method  --
0400   //! theStatus will  return 0 if  OK else it will return  the
0401   //! pivot index -- of the   matrix that was inverted to
0402   //! compute the multiplied -- BSpline  : the method used
0403   //! is  interpolation   at Schoenenberg   --  points  of
0404   //! a(u,v)* N(u,v) and a(u,v) * D(u,v)
0405   //! theStatus will return 0 if OK else it will return the pivot index
0406   //! of the matrix that was inverted to compute the multiplied
0407   //! BSpline : the method used is interpolation at Schoenenberg
0408   //! points of a(u,v)*F(u,v)
0409   //! --
0410   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);
0411 
0412 
0413 
0414 
0415 protected:
0416 
0417 
0418 
0419 
0420 
0421 private:
0422 
0423 
0424 
0425 
0426 
0427 };
0428 
0429 
0430 #include <BSplSLib.lxx>
0431 
0432 
0433 
0434 
0435 
0436 #endif // _BSplSLib_HeaderFile