Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1991-08-09
0002 // Created by: Jean Claude VAUTHIER
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 _BSplCLib_HeaderFile
0018 #define _BSplCLib_HeaderFile
0019 
0020 #include <BSplCLib_EvaluatorFunction.hxx>
0021 #include <BSplCLib_KnotDistribution.hxx>
0022 #include <BSplCLib_MultDistribution.hxx>
0023 #include <GeomAbs_BSplKnotDistribution.hxx>
0024 #include <Standard.hxx>
0025 #include <Standard_DefineAlloc.hxx>
0026 #include <Standard_Handle.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <Standard_Real.hxx>
0029 #include <TColgp_Array1OfPnt.hxx>
0030 #include <TColgp_Array1OfPnt2d.hxx>
0031 #include <TColStd_Array1OfReal.hxx>
0032 #include <TColStd_Array2OfReal.hxx>
0033 #include <TColStd_HArray1OfInteger.hxx>
0034 #include <TColStd_HArray1OfReal.hxx>
0035 
0036 class gp_Pnt;
0037 class gp_Pnt2d;
0038 class gp_Vec;
0039 class gp_Vec2d;
0040 class math_Matrix;
0041 
0042 
0043 //! BSplCLib   B-spline curve Library.
0044 //!
0045 //! The BSplCLib package is  a basic library  for BSplines. It
0046 //! provides three categories of functions.
0047 //!
0048 //! * Management methods to  process knots and multiplicities.
0049 //!
0050 //! * Multi-Dimensions  spline methods.  BSpline methods where
0051 //! poles have an arbitrary number of dimensions. They divides
0052 //! in two groups :
0053 //!
0054 //! - Global methods modifying the  whole set of  poles. The
0055 //! poles are    described   by an array   of   Reals and  a
0056 //! Dimension. Example : Inserting knots.
0057 //!
0058 //! - Local methods  computing  points and derivatives.  The
0059 //! poles  are described by a pointer  on  a local array  of
0060 //! Reals and a Dimension. The local array is modified.
0061 //!
0062 //! *  2D  and 3D spline   curves  methods.
0063 //!
0064 //! Methods  for 2d and 3d BSplines  curves  rational or not
0065 //! rational.
0066 //!
0067 //! Those methods have the following structure :
0068 //!
0069 //! - They extract the pole information in a working array.
0070 //!
0071 //! -  They      process the  working   array    with   the
0072 //! multi-dimension  methods. (for example  a  3d  rational
0073 //! curve is processed as a 4 dimension curve).
0074 //!
0075 //! - They get back the result in the original dimension.
0076 //!
0077 //! Note that the  bspline   surface methods found   in the
0078 //! package BSplSLib  uses  the same  structure and rely on
0079 //! BSplCLib.
0080 //!
0081 //! In the following list  of methods the  2d and 3d  curve
0082 //! methods   will be  described   with  the  corresponding
0083 //! multi-dimension method.
0084 //!
0085 //! The 3d or 2d B-spline curve is defined with :
0086 //!
0087 //! . its control points : TColgp_Array1OfPnt(2d)        Poles
0088 //! . its weights        : TColStd_Array1OfReal          Weights
0089 //! . its knots          : TColStd_Array1OfReal          Knots
0090 //! . its multiplicities : TColStd_Array1OfInteger       Mults
0091 //! . its degree         : Standard_Integer              Degree
0092 //! . its periodicity    : Standard_Boolean              Periodic
0093 //!
0094 //! Warnings :
0095 //! The bounds of Poles and Weights should be the same.
0096 //! The bounds of Knots and Mults   should be the same.
0097 //!
0098 //! Note: weight and multiplicity arrays can be passed by pointer for
0099 //! some functions so that NULL pointer is valid.
0100 //! That means no weights/no multiplicities passed.
0101 //!
0102 //! No weights (BSplCLib::NoWeights()) means the curve is non rational.
0103 //! No mults (BSplCLib::NoMults()) means the knots are "flat" knots.
0104 //!
0105 //! KeyWords :
0106 //! B-spline curve, Functions, Library
0107 //!
0108 //! References :
0109 //! . A survey of curves and surfaces methods in CADG Wolfgang
0110 //! BOHM CAGD 1 (1984)
0111 //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM
0112 //! cagd 5 (1988)
0113 //! . Blossoming and knot insertion algorithms for B-spline curves
0114 //! Ronald N. GOLDMAN
0115 //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
0116 //! . Curves and Surfaces for Computer Aided Geometric Design,
0117 //! a practical guide Gerald Farin
0118 class BSplCLib 
0119 {
0120 public:
0121 
0122   DEFINE_STANDARD_ALLOC
0123 
0124   
0125   //! This routine searches the position of the real value theX
0126   //! in the monotonically increasing set of real values theArray using bisection algorithm.
0127   //!
0128   //! If the given value is out of range or array values, algorithm returns either
0129   //! theArray.Lower()-1 or theArray.Upper()+1 depending on theX position in the ordered set.
0130   //!
0131   //! This routine is used to locate a knot value in a set of knots.
0132   Standard_EXPORT static void Hunt (const TColStd_Array1OfReal& theArray,
0133                                     const Standard_Real theX,
0134                                     Standard_Integer& theXPos);
0135   
0136   //! Computes the index of the knots value which gives
0137   //! the start point of the curve.
0138   Standard_EXPORT static Standard_Integer FirstUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
0139   
0140   //! Computes the index of the knots value which gives
0141   //! the end point of the curve.
0142   Standard_EXPORT static Standard_Integer LastUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
0143   
0144   //! Computes the index  of  the  flats knots  sequence
0145   //! corresponding  to  <Index> in  the  knots sequence
0146   //! which multiplicities are <Mults>.
0147   Standard_EXPORT static Standard_Integer FlatIndex (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic);
0148   
0149   //! Locates  the parametric value    U  in the knots
0150   //! sequence  between  the  knot K1   and the knot  K2.
0151   //! The value return in Index verifies.
0152   //!
0153   //! Knots(Index) <= U < Knots(Index + 1)
0154   //! if U <= Knots (K1) then Index = K1
0155   //! if U >= Knots (K2) then Index = K2 - 1
0156   //!
0157   //! If Periodic is True U  may be  modified  to fit in
0158   //! the range  Knots(K1), Knots(K2).  In any case  the
0159   //! correct value is returned in NewU.
0160   //!
0161   //! Warnings :Index is used  as input   data to initialize  the
0162   //! searching  function.
0163   //! Warning: Knots have to be "withe repetitions"
0164   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
0165   
0166   //! Locates  the parametric value    U  in the knots
0167   //! sequence  between  the  knot K1   and the knot  K2.
0168   //! The value return in Index verifies.
0169   //!
0170   //! Knots(Index) <= U < Knots(Index + 1)
0171   //! if U <= Knots (K1) then Index = K1
0172   //! if U >= Knots (K2) then Index = K2 - 1
0173   //!
0174   //! If Periodic is True U  may be  modified  to fit in
0175   //! the range  Knots(K1), Knots(K2).  In any case  the
0176   //! correct value is returned in NewU.
0177   //!
0178   //! Warnings :Index is used  as input   data to initialize  the
0179   //! searching  function.
0180   //! Warning: Knots have to be "flat"
0181   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
0182   
0183   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, const Standard_Real U, const Standard_Boolean Periodic, Standard_Integer& Index, Standard_Real& NewU);
0184   
0185   //! Finds the greatest multiplicity in a set of knots
0186   //! between  K1  and K2.   Mults  is  the  multiplicity
0187   //! associated with each knot value.
0188   Standard_EXPORT static Standard_Integer MaxKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
0189   
0190   //! Finds the lowest multiplicity in  a  set of knots
0191   //! between   K1  and K2.   Mults is  the  multiplicity
0192   //! associated with each knot value.
0193   Standard_EXPORT static Standard_Integer MinKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
0194   
0195   //! Returns the number of poles of the curve. Returns 0 if
0196   //! one of the multiplicities is incorrect.
0197   //!
0198   //! * Non positive.
0199   //!
0200   //! * Greater than Degree,  or  Degree+1  at the first and
0201   //! last knot of a non periodic curve.
0202   //!
0203   //! *  The  last periodicity  on  a periodic  curve is not
0204   //! equal to the first.
0205   Standard_EXPORT static Standard_Integer NbPoles (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
0206   
0207   //! Returns the length  of the sequence  of knots with
0208   //! repetition.
0209   //!
0210   //! Periodic :
0211   //!
0212   //! Sum(Mults(i), i = Mults.Lower(); i <= Mults.Upper());
0213   //!
0214   //! Non Periodic :
0215   //!
0216   //! Sum(Mults(i); i = Mults.Lower(); i < Mults.Upper())
0217   //! + 2 * Degree
0218   Standard_EXPORT static Standard_Integer KnotSequenceLength (const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic);
0219   
0220   Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
0221   
0222   //! Computes  the  sequence   of knots KnotSeq  with
0223   //! repetition  of the  knots  of multiplicity  greater
0224   //! than 1.
0225   //!
0226   //! Length of KnotSeq must be KnotSequenceLength(Mults,Degree,Periodic)
0227   Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic, TColStd_Array1OfReal& KnotSeq);
0228   
0229   //! Returns the  length  of the   sequence of  knots  (and
0230   //! Mults)  without repetition.
0231   Standard_EXPORT static Standard_Integer KnotsLength (const TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
0232   
0233   //! Computes  the  sequence   of knots Knots  without
0234   //! repetition  of the  knots  of multiplicity  greater
0235   //! than 1.
0236   //!
0237   //! Length  of <Knots> and  <Mults> must be
0238   //! KnotsLength(KnotSequence,Periodic)
0239   Standard_EXPORT static void Knots (const TColStd_Array1OfReal& KnotSeq, TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic = Standard_False);
0240   
0241   //! Analyses if the  knots distribution is "Uniform"
0242   //! or  "NonUniform" between  the  knot  FromK1 and the
0243   //! knot ToK2.  There is  no repetition of  knot in the
0244   //! knots'sequence <Knots>.
0245   Standard_EXPORT static BSplCLib_KnotDistribution KnotForm (const TColStd_Array1OfReal& Knots, const Standard_Integer FromK1, const Standard_Integer ToK2);
0246   
0247 
0248   //! Analyses the distribution of multiplicities between
0249   //! the knot FromK1 and the Knot ToK2.
0250   Standard_EXPORT static BSplCLib_MultDistribution MultForm (const TColStd_Array1OfInteger& Mults, const Standard_Integer FromK1, const Standard_Integer ToK2);
0251   
0252   //! Analyzes the array of knots.
0253   //! Returns the form and the maximum knot multiplicity.
0254   Standard_EXPORT static void KnotAnalysis (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& CKnots, const TColStd_Array1OfInteger& CMults, GeomAbs_BSplKnotDistribution& KnotForm, Standard_Integer& MaxKnotMult);
0255   
0256 
0257   //! Reparametrizes a B-spline curve to [U1, U2].
0258   //! The knot values are recomputed such that Knots (Lower) = U1
0259   //! and Knots (Upper) = U2   but the knot form is not modified.
0260   //! Warnings :
0261   //! In the array Knots the values must be in ascending order.
0262   //! U1 must not be equal to U2 to avoid division by zero.
0263   Standard_EXPORT static void Reparametrize (const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& Knots);
0264   
0265   //! Reverses  the  array   knots  to  become  the knots
0266   //! sequence of the reversed curve.
0267   Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Knots);
0268   
0269   //! Reverses  the  array of multiplicities.
0270   Standard_EXPORT static void Reverse (TColStd_Array1OfInteger& Mults);
0271   
0272   //! Reverses the array of poles. Last is the  index of
0273   //! the new first pole. On  a  non periodic curve last
0274   //! is Poles.Upper(). On a periodic curve last is
0275   //!
0276   //! (number of flat knots - degree - 1)
0277   //!
0278   //! or
0279   //!
0280   //! (sum of multiplicities(but  for the last) + degree
0281   //! - 1)
0282   Standard_EXPORT static void Reverse (TColgp_Array1OfPnt& Poles, const Standard_Integer Last);
0283   
0284   //! Reverses the array of poles.
0285   Standard_EXPORT static void Reverse (TColgp_Array1OfPnt2d& Poles, const Standard_Integer Last);
0286   
0287   //! Reverses the array of poles.
0288   Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Weights, const Standard_Integer Last);
0289   
0290 
0291   //! Returns False if all the weights  of the  array <Weights>
0292   //! between   I1 an I2   are  identic.   Epsilon  is used for
0293   //! comparing  weights. If Epsilon  is 0. the  Epsilon of the
0294   //! first weight is used.
0295   Standard_EXPORT static Standard_Boolean IsRational (const TColStd_Array1OfReal& Weights, const Standard_Integer I1, const Standard_Integer I2, const Standard_Real Epsilon = 0.0);
0296   
0297   //! returns the degree maxima for a BSplineCurve.
0298     static Standard_Integer MaxDegree();
0299   
0300   //! Perform the Boor  algorithm  to  evaluate a point at
0301   //! parameter <U>, with <Degree> and <Dimension>.
0302   //!
0303   //! Poles is  an array of  Reals of size
0304   //!
0305   //! <Dimension> *  <Degree>+1
0306   //!
0307   //! Containing  the poles.  At  the end <Poles> contains
0308   //! the current point.
0309   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
0310   
0311   //! Performs the  Boor Algorithm  at  parameter <U> with
0312   //! the given <Degree> and the  array of <Knots> on  the
0313   //! poles <Poles> of dimension  <Dimension>.  The schema
0314   //! is  computed  until  level  <Depth>  on a   basis of
0315   //! <Length+1> poles.
0316   //!
0317   //! * Knots is an array of reals of length :
0318   //!
0319   //! <Length> + <Degree>
0320   //!
0321   //! * Poles is an array of reals of length :
0322   //!
0323   //! (2 * <Length> + 1) * <Dimension>
0324   //!
0325   //! The poles values  must be  set  in the array at the
0326   //! positions.
0327   //!
0328   //! 0..Dimension,
0329   //!
0330   //! 2 * Dimension ..
0331   //! 3 * Dimension
0332   //!
0333   //! 4  * Dimension ..
0334   //! 5  * Dimension
0335   //!
0336   //! ...
0337   //!
0338   //! The results are found in the array poles depending
0339   //! on the Depth. (See the method GetPole).
0340   Standard_EXPORT static void BoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length);
0341   
0342   //! Compute  the content of  Pole before the BoorScheme.
0343   //! This method is used to remove poles.
0344   //!
0345   //! U is the poles to  remove, Knots should contains the
0346   //! knots of the curve after knot removal.
0347   //!
0348   //! The first  and last poles  do not  change, the other
0349   //! poles are computed by averaging two possible values.
0350   //! The distance between  the  two   possible  poles  is
0351   //! computed, if it  is higher than <Tolerance> False is
0352   //! returned.
0353   Standard_EXPORT static Standard_Boolean AntiBoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length, const Standard_Real Tolerance);
0354   
0355   //! Computes   the   poles of  the    BSpline  giving the
0356   //! derivatives of order <Order>.
0357   //!
0358   //! The formula for the first order is
0359   //!
0360   //! Pole(i) = Degree * (Pole(i+1) - Pole(i)) /
0361   //! (Knots(i+Degree+1) - Knots(i+1))
0362   //!
0363   //! This formula  is repeated  (Degree  is decremented at
0364   //! each step).
0365   Standard_EXPORT static void Derivative (const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, const Standard_Integer Length, const Standard_Integer Order, Standard_Real& Poles);
0366   
0367   //! Performs the Bohm  Algorithm at  parameter <U>. This
0368   //! algorithm computes the value and all the derivatives
0369   //! up to order N (N <= Degree).
0370   //!
0371   //! <Poles> is the original array of poles.
0372   //!
0373   //! The   result in  <Poles>  is    the value and    the
0374   //! derivatives.  Poles[0] is  the value,  Poles[Degree]
0375   //! is the last  derivative.
0376   Standard_EXPORT static void Bohm (const Standard_Real U, const Standard_Integer Degree, const Standard_Integer N, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
0377   
0378   //! Used as argument for a non rational curve.
0379     static TColStd_Array1OfReal* NoWeights();
0380   
0381   //! Used as argument for a flatknots evaluation.
0382     static TColStd_Array1OfInteger* NoMults();
0383   
0384   //! Stores in LK the useful knots for the BoorSchem
0385   //! on the span Knots(Index) - Knots(Index+1)
0386   Standard_EXPORT static void BuildKnots (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& LK);
0387   
0388   //! Return the index of the  first Pole to  use on the
0389   //! span  Mults(Index)  - Mults(Index+1).  This  index
0390   //! must be added to Poles.Lower().
0391   Standard_EXPORT static Standard_Integer PoleIndex (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
0392   
0393   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
0394   
0395   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
0396   
0397   //! Copy in <LP>  the poles and  weights for  the Eval
0398   //! scheme. starting from  Poles(Poles.Lower()+Index)
0399   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
0400   
0401   //! Copy in <LP>  poles for <Dimension>  Boor  scheme.
0402   //! Starting  from    <Index>     *  <Dimension>, copy
0403   //! <Length+1> poles.
0404   Standard_EXPORT static void BuildBoor (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, Standard_Real& LP);
0405   
0406   //! Returns the index in  the Boor result array of the
0407   //! poles <Index>. If  the Boor  algorithm was perform
0408   //! with <Length> and <Depth>.
0409   Standard_EXPORT static Standard_Integer BoorIndex (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth);
0410   
0411   //! Copy  the  pole at  position  <Index>  in  the Boor
0412   //! scheme of   dimension <Dimension> to  <Position> in
0413   //! the array <Pole>. <Position> is updated.
0414   Standard_EXPORT static void GetPole (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth, const Standard_Integer Dimension, Standard_Real& LocPoles, Standard_Integer& Position, TColStd_Array1OfReal& Pole);
0415   
0416   //! Returns in <NbPoles, NbKnots> the  new number of poles
0417   //! and  knots    if  the  sequence   of  knots <AddKnots,
0418   //! AddMults> is inserted in the sequence <Knots, Mults>.
0419   //!
0420   //! Epsilon is used to compare knots for equality.
0421   //!
0422   //! If Add is True  the multiplicities on  equal knots are
0423   //! added.
0424   //!
0425   //! If Add is False the max value of the multiplicities is
0426   //! kept.
0427   //!
0428   //! Return False if :
0429   //! The knew knots are knot increasing.
0430   //! The new knots are not in the range.
0431   Standard_EXPORT static Standard_Boolean PrepareInsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, Standard_Integer& NbPoles, Standard_Integer& NbKnots, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
0432   
0433   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
0434   
0435   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
0436   
0437   //! Insert   a  sequence  of  knots <AddKnots> with
0438   //! multiplicities   <AddMults>. <AddKnots>   must  be a   non
0439   //! decreasing sequence and verifies :
0440   //!
0441   //! Knots(Knots.Lower()) <= AddKnots(AddKnots.Lower())
0442   //! Knots(Knots.Upper()) >= AddKnots(AddKnots.Upper())
0443   //!
0444   //! The NewPoles and NewWeights arrays must have a length :
0445   //! Poles.Length() + Sum(AddMults())
0446   //!
0447   //! When a knot  to insert is identic  to an existing knot the
0448   //! multiplicities   are added.
0449   //!
0450   //! Epsilon is used to test knots for equality.
0451   //!
0452   //! When AddMult is negative or null the knot is not inserted.
0453   //! No multiplicity will becomes higher than the degree.
0454   //!
0455   //! The new Knots and Multiplicities  are copied in <NewKnots>
0456   //! and  <NewMults>.
0457   //!
0458   //! All the New arrays should be correctly dimensioned.
0459   //!
0460   //! When all  the new knots  are existing knots, i.e. only the
0461   //! multiplicities  will  change it is   safe to  use the same
0462   //! arrays as input and output.
0463   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
0464   
0465   Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
0466   
0467   //! Insert a new knot U of multiplicity UMult in the
0468   //! knot sequence.
0469   //!
0470   //! The  location of the new Knot  should be given as an input
0471   //! data.  UIndex locates the new knot U  in the knot sequence
0472   //! and Knots (UIndex) < U < Knots (UIndex + 1).
0473   //!
0474   //! The new control points corresponding to this insertion are
0475   //! returned. Knots and Mults are not updated.
0476   Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
0477   
0478   Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
0479   
0480   //! Raise the multiplicity of knot to <UMult>.
0481   //!
0482   //! The new control points  are  returned. Knots and Mults are
0483   //! not updated.
0484   Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
0485   
0486   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
0487   
0488   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
0489   
0490   //! Decrement the  multiplicity  of <Knots(Index)>
0491   //! to <Mult>. If <Mult>   is  null the   knot  is
0492   //! removed.
0493   //!
0494   //! As there are two ways to compute the new poles
0495   //! the midlle   will  be used  as  long    as the
0496   //! distance is lower than Tolerance.
0497   //!
0498   //! If a  distance is  bigger  than  tolerance the
0499   //! methods returns False  and  the new arrays are
0500   //! not modified.
0501   //!
0502   //! A low  tolerance can be  used  to test  if the
0503   //! knot  can be  removed  without  modifying  the
0504   //! curve.
0505   //!
0506   //! A high tolerance  can be used  to "smooth" the
0507   //! curve.
0508   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
0509   
0510   //! Returns the   number   of  knots   of  a  curve   with
0511   //! multiplicities <Mults> after elevating the degree from
0512   //! <Degree> to <NewDegree>. See the IncreaseDegree method
0513   //! for more comments.
0514   Standard_EXPORT static Standard_Integer IncreaseDegreeCountKnots (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
0515   
0516   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
0517   
0518   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
0519   
0520   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
0521   
0522   Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
0523   
0524   //! Increase the degree of a bspline (or bezier) curve
0525   //! of dimension theDimension form theDegree to theNewDegree.
0526   //!
0527   //! The number of poles in the new curve is:
0528   //! @code
0529   //!   Poles.Length() + (NewDegree - Degree) * Number of spans
0530   //! @endcode
0531   //! Where the number of spans is:
0532   //! @code
0533   //!   LastUKnotIndex(Mults) - FirstUKnotIndex(Mults) + 1
0534   //! @endcode
0535   //! for a non-periodic curve, and
0536   //! @code
0537   //!   Knots.Length() - 1
0538   //! @endcode
0539   //! for a periodic curve.
0540   //!
0541   //! The multiplicities of all knots are increased by the degree elevation.
0542   //!
0543   //! The new knots are usually the same knots with the
0544   //! exception of a non-periodic curve with the first
0545   //! and last multiplicity not  equal to Degree+1 where
0546   //! knots are removed form the start and the bottom
0547   //! until the sum of the multiplicities is equal to
0548   //! NewDegree+1  at the knots corresponding to the
0549   //! first and last parameters of the curve.
0550   //!
0551   //! Example: Suppose a curve of degree 3 starting
0552   //! with following knots and multiplicities:
0553   //! @code
0554   //!   knot : 0.  1.  2.
0555   //!   mult : 1   2   1
0556   //! @endcode
0557   //!
0558   //! The FirstUKnot is 2.0 because the sum of multiplicities is
0559   //! @code
0560   //!   Degree+1 : 1 + 2 + 1 = 4 = 3 + 1
0561   //! @endcode
0562   //! i.e. the first parameter of the curve is 2.0 and
0563   //! will still be 2.0 after degree elevation.
0564   //! Let raise this curve to degree 4.
0565   //! The multiplicities are increased by 2.
0566   //!
0567   //! They  become 2 3 2.
0568   //! But we need a sum of multiplicities of 5 at knot 2.
0569   //! So the first knot is removed and the new knots are:
0570   //! @code
0571   //!   knot : 1.  2.
0572   //!   mult : 3   2
0573   //! @endcode
0574   //! The multipicity of the first knot may also be reduced if the sum is still to big.
0575   //!
0576   //! In the most common situations (periodic curve or curve with first
0577   //! and last multiplicities equals to Degree+1) the knots are knot changes.
0578   //!
0579   //! The method IncreaseDegreeCountKnots can be used to compute the new number of knots.
0580   Standard_EXPORT static void IncreaseDegree (const Standard_Integer theNewDegree,
0581                                               const TColgp_Array1OfPnt2d& thePoles,
0582                                               const TColStd_Array1OfReal* theWeights,
0583                                               TColgp_Array1OfPnt2d& theNewPoles,
0584                                               TColStd_Array1OfReal* theNewWeights);
0585 
0586   //! Set in <NbKnots> and <NbPolesToAdd> the number of Knots and
0587   //! Poles   of  the NotPeriodic  Curve   identical  at the
0588   //! periodic     curve with    a  degree    <Degree>  ,  a
0589   //! knots-distribution with Multiplicities <Mults>.
0590   Standard_EXPORT static void PrepareUnperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
0591   
0592   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const Standard_Integer Dimension, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfReal& Poles, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfReal& NewPoles);
0593   
0594   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
0595   
0596   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
0597   
0598   //! Set in <NbKnots> and <NbPoles> the number of Knots and
0599   //! Poles of the curve resulting from  the trimming of the
0600   //! BSplinecurve defined with <degree>, <knots>, <mults>
0601   Standard_EXPORT static void PrepareTrimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U1, const Standard_Real U2, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
0602   
0603   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Poles, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewPoles);
0604   
0605   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
0606   
0607   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
0608   
0609   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P);
0610   
0611   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P);
0612   
0613   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P);
0614   
0615   Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P);
0616   
0617   Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P);
0618   
0619   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V);
0620   
0621   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V);
0622   
0623   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V);
0624   
0625   Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V);
0626   
0627   Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V);
0628   
0629   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2);
0630   
0631   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
0632   
0633   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
0634   
0635   Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
0636   
0637   Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
0638   
0639   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3);
0640   
0641   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
0642   
0643   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
0644   
0645   Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
0646   
0647   Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
0648   
0649   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& VN);
0650   
0651   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec& VN);
0652   
0653   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec2d& V);
0654   
0655   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt& P, gp_Vec& VN);
0656   
0657   //! The  above  functions  compute   values and
0658   //! derivatives in the following situations :
0659   //!
0660   //! * 3D, 2D and 1D
0661   //!
0662   //! * Rational or not Rational.
0663   //!
0664   //! * Knots  and multiplicities or "flat knots" without
0665   //! multiplicities.
0666   //!
0667   //! * The  <Index>  is   the localization  of  the
0668   //! parameter in the knot sequence.  If <Index> is  out
0669   //! of range the correct value will be searched.
0670   //!
0671   //! VERY IMPORTANT!!!
0672   //! USE  BSplCLib::NoWeights()  as Weights argument for non
0673   //! rational curves computations.
0674   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt2d& P, gp_Vec2d& VN);
0675   
0676   //! This  evaluates  the Bspline  Basis  at  a
0677   //! given  parameter  Parameter   up   to  the
0678   //! requested   DerivativeOrder  and store the
0679   //! result  in the  array BsplineBasis  in the
0680   //! following   fashion
0681   //! BSplineBasis(1,1)   =
0682   //! value of first non vanishing
0683   //! Bspline function which has Index FirstNonZeroBsplineIndex
0684   //! BsplineBasis(1,2)   =
0685   //! value of second non vanishing
0686   //! Bspline   function which  has   Index
0687   //! FirstNonZeroBsplineIndex + 1
0688   //! BsplineBasis(1,n)   =
0689   //! value of second non vanishing non vanishing
0690   //! Bspline   function which  has   Index
0691   //! FirstNonZeroBsplineIndex + n (n <= Order)
0692   //! BSplineBasis(2,1)   =
0693   //! value of derivative of first non vanishing
0694   //! Bspline function which has Index FirstNonZeroBsplineIndex
0695   //! BSplineBasis(N,1)   =
0696   //! value of Nth derivative of first non vanishing
0697   //! Bspline function which has Index FirstNonZeroBsplineIndex
0698   //! if N <= DerivativeOrder + 1
0699   Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer DerivativeOrder,
0700                                                             const Standard_Integer Order,
0701                                                             const TColStd_Array1OfReal& FlatKnots,
0702                                                             const Standard_Real Parameter,
0703                                                             Standard_Integer& FirstNonZeroBsplineIndex,
0704                                                             math_Matrix& BsplineBasis,
0705                                                             const Standard_Boolean isPeriodic = Standard_False);
0706   
0707   //! This Builds   a fully  blown   Matrix of
0708   //! (ni)
0709   //! Bi    (tj)
0710   //!
0711   //! with i  and j within 1..Order + NumPoles
0712   //! The  integer ni is   the ith slot of the
0713   //! array OrderArray, tj is the jth slot of
0714   //! the array Parameters
0715   Standard_EXPORT static Standard_Integer BuildBSpMatrix (const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& OrderArray, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, math_Matrix& Matrix, Standard_Integer& UpperBandWidth, Standard_Integer& LowerBandWidth);
0716   
0717   //! this  factors  the Banded Matrix in
0718   //! the LU form with a Banded storage of
0719   //! components of the L matrix
0720   //! WARNING : do not use if the Matrix is
0721   //! totally positive (It is the case for
0722   //! Bspline matrices build as above with
0723   //! parameters being the Schoenberg points
0724   Standard_EXPORT static Standard_Integer FactorBandedMatrix (math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, Standard_Integer& PivotIndexProblem);
0725   
0726   //! This solves  the system Matrix.X =  B
0727   //! with when Matrix is factored in LU form
0728   //! The  Array   is    an   seen   as    an
0729   //! Array[1..N][1..ArrayDimension] with N =
0730   //! the  rank  of the  matrix  Matrix.  The
0731   //! result is stored   in Array  when  each
0732   //! coordinate is  solved that is  B is the
0733   //! array whose values are
0734   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
0735   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Integer ArrayDimension, Standard_Real& Array);
0736   
0737   //! This solves  the system Matrix.X =  B
0738   //! with when Matrix is factored in LU form
0739   //! The  Array   has the length of
0740   //! the  rank  of the  matrix  Matrix.  The
0741   //! result is stored   in Array  when  each
0742   //! coordinate is  solved that is  B is the
0743   //! array whose values are
0744   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
0745   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt2d& Array);
0746   
0747   //! This solves  the system Matrix.X =  B
0748   //! with when Matrix is factored in LU form
0749   //! The  Array   has the length of
0750   //! the  rank  of the  matrix  Matrix.  The
0751   //! result is stored   in Array  when  each
0752   //! coordinate is  solved that is  B is the
0753   //! array whose values are
0754   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
0755   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt& Array);
0756   
0757   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogenousFlag, const Standard_Integer ArrayDimension, Standard_Real& Array, Standard_Real& Weights);
0758   
0759   //! This solves the  system Matrix.X =  B
0760   //! with when Matrix is factored in LU form
0761   //! The    Array   is    an   seen  as   an
0762   //! Array[1..N][1..ArrayDimension] with N =
0763   //! the  rank  of  the  matrix Matrix.  The
0764   //! result is  stored   in Array when  each
0765   //! coordinate is  solved that is B  is the
0766   //! array  whose   values     are   B[i]  =
0767   //! Array[i][p]       for     each  p    in
0768   //! 1..ArrayDimension. If  HomogeneousFlag ==
0769   //! 0  the  Poles  are  multiplied by   the
0770   //! Weights   upon   Entry   and      once
0771   //! interpolation   is    carried  over the
0772   //! result of the  poles are divided by the
0773   //! result of   the   interpolation of  the
0774   //! weights. Otherwise if HomogenousFlag == 1
0775   //! the Poles and Weigths are treated homogeneously
0776   //! that is that those are interpolated as they
0777   //! are and result is returned without division
0778   //! by the interpolated weigths.
0779   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogenousFlag, TColgp_Array1OfPnt2d& Array, TColStd_Array1OfReal& Weights);
0780   
0781   //! This solves  the system Matrix.X =  B
0782   //! with when Matrix is factored in LU form
0783   //! The  Array   is    an   seen   as    an
0784   //! Array[1..N][1..ArrayDimension] with N =
0785   //! the  rank  of the  matrix  Matrix.  The
0786   //! result is stored   in Array  when  each
0787   //! coordinate is  solved that is  B is the
0788   //! array whose values are
0789   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
0790   //! If  HomogeneousFlag ==
0791   //! 0  the  Poles  are  multiplied by   the
0792   //! Weights   upon   Entry   and      once
0793   //! interpolation   is    carried  over the
0794   //! result of the  poles are divided by the
0795   //! result of   the   interpolation of  the
0796   //! weights. Otherwise if HomogenousFlag == 1
0797   //! the Poles and Weigths are treated homogeneously
0798   //! that is that those are interpolated as they
0799   //! are and result is returned without division
0800   //! by the interpolated weigths.
0801   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogeneousFlag, TColgp_Array1OfPnt& Array, TColStd_Array1OfReal& Weights);
0802   
0803   //! Merges  two knot vector by   setting the starting and
0804   //! ending values to StartValue and EndValue
0805   Standard_EXPORT static void MergeBSplineKnots (const Standard_Real Tolerance, const Standard_Real StartValue, const Standard_Real EndValue, const Standard_Integer Degree1, const TColStd_Array1OfReal& Knots1, const TColStd_Array1OfInteger& Mults1, const Standard_Integer Degree2, const TColStd_Array1OfReal& Knots2, const TColStd_Array1OfInteger& Mults2, Standard_Integer& NumPoles, Handle(TColStd_HArray1OfReal)& NewKnots, Handle(TColStd_HArray1OfInteger)& NewMults);
0806   
0807   //! This function will compose  a given Vectorial BSpline F(t)
0808   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0809   //! its Poles  array which are coded as  an array of Real
0810   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
0811   //! function     a(t) which is   assumed to   satisfy the
0812   //! following:
0813   //!
0814   //! 1. F(a(t))  is a polynomial BSpline
0815   //! that can be expressed  exactly as a BSpline of degree
0816   //! NewDegree on the knots FlatKnots
0817   //!
0818   //! 2. a(t) defines a differentiable
0819   //! isomorphism between the range of FlatKnots to the range
0820   //! of BSplineFlatKnots which is the
0821   //! same as the  range of F(t)
0822   //!
0823   //! Warning: it is
0824   //! the caller's responsibility to insure that conditions
0825   //! 1. and  2. above are  satisfied : no check whatsoever
0826   //! is made in this method
0827   //!
0828   //! theStatus will return 0 if OK else it will return the pivot index
0829   //! of the matrix that was inverted to compute the multiplied
0830   //! BSpline : the method used is interpolation at Schoenenberg
0831   //! points of F(a(t))
0832   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
0833   
0834   //! This function will compose  a given Vectorial BSpline F(t)
0835   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0836   //! its Poles  array which are coded as  an array of Real
0837   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
0838   //! function     a(t) which is   assumed to   satisfy the
0839   //! following:
0840   //!
0841   //! 1. F(a(t))  is a polynomial BSpline
0842   //! that can be expressed  exactly as a BSpline of degree
0843   //! NewDegree on the knots FlatKnots
0844   //!
0845   //! 2. a(t) defines a differentiable
0846   //! isomorphism between the range of FlatKnots to the range
0847   //! of BSplineFlatKnots which is the
0848   //! same as the  range of F(t)
0849   //!
0850   //! Warning: it is
0851   //! the caller's responsibility to insure that conditions
0852   //! 1. and  2. above are  satisfied : no check whatsoever
0853   //! is made in this method
0854   //!
0855   //! theStatus will return 0 if OK else it will return the pivot index
0856   //! of the matrix that was inverted to compute the multiplied
0857   //! BSpline : the method used is interpolation at Schoenenberg
0858   //! points of F(a(t))
0859   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
0860   
0861   //! this will compose  a given Vectorial BSpline F(t)
0862   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0863   //! its Poles  array which are coded as  an array of Real
0864   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
0865   //! function     a(t) which is   assumed to   satisfy the
0866   //! following  : 1. F(a(t))  is a polynomial BSpline
0867   //! that can be expressed  exactly as a BSpline of degree
0868   //! NewDegree on the knots FlatKnots
0869   //! 2. a(t) defines a differentiable
0870   //! isomorphism between the range of FlatKnots to the range
0871   //! of BSplineFlatKnots which is the
0872   //! same as the  range of F(t)
0873   //! Warning: it is
0874   //! the caller's responsibility to insure that conditions
0875   //! 1. and  2. above are  satisfied : no check whatsoever
0876   //! is made in this method
0877   //! theStatus will return 0 if OK else it will return the pivot index
0878   //! of the matrix that was inverted to compute the multiplied
0879   //! BSpline : the method used is interpolation at Schoenenberg
0880   //! points of F(a(t))
0881   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
0882   
0883   //! this will compose  a given Vectorial BSpline F(t)
0884   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0885   //! its Poles  array which are coded as  an array of Real
0886   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
0887   //! function     a(t) which is   assumed to   satisfy the
0888   //! following  : 1. F(a(t))  is a polynomial BSpline
0889   //! that can be expressed  exactly as a BSpline of degree
0890   //! NewDegree on the knots FlatKnots
0891   //! 2. a(t) defines a differentiable
0892   //! isomorphism between the range of FlatKnots to the range
0893   //! of BSplineFlatKnots which is the
0894   //! same as the  range of F(t)
0895   //! Warning: it is
0896   //! the caller's responsibility to insure that conditions
0897   //! 1. and  2. above are  satisfied : no check whatsoever
0898   //! is made in this method
0899   //! theStatus will return 0 if OK else it will return the pivot index
0900   //! of the matrix that was inverted to compute the multiplied
0901   //! BSpline : the method used is interpolation at Schoenenberg
0902   //! points of F(a(t))
0903   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
0904   
0905   //! this will  multiply a given Vectorial BSpline F(t)
0906   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0907   //! its Poles  array which are coded as  an array of Real
0908   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
0909   //! function     a(t) which is   assumed to   satisfy the
0910   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
0911   //! that can be expressed  exactly as a BSpline of degree
0912   //! NewDegree on the knots FlatKnots 2. the range of a(t)
0913   //! is the same as the  range of F(t)
0914   //! Warning: it is
0915   //! the caller's responsibility to insure that conditions
0916   //! 1. and  2. above are  satisfied : no check whatsoever
0917   //! is made in this method
0918   //! theStatus will return 0 if OK else it will return the pivot index
0919   //! of the matrix that was inverted to compute the multiplied
0920   //! BSpline : the method used is interpolation at Schoenenberg
0921   //! points of a(t)*F(t)
0922   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
0923   
0924   //! this will  multiply a given Vectorial BSpline F(t)
0925   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0926   //! its Poles  array which are coded as  an array of Real
0927   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
0928   //! function     a(t) which is   assumed to   satisfy the
0929   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
0930   //! that can be expressed  exactly as a BSpline of degree
0931   //! NewDegree on the knots FlatKnots 2. the range of a(t)
0932   //! is the same as the  range of F(t)
0933   //! Warning: it is
0934   //! the caller's responsibility to insure that conditions
0935   //! 1. and  2. above are  satisfied : no check whatsoever
0936   //! is made in this method
0937   //! theStatus will return 0 if OK else it will return the pivot index
0938   //! of the matrix that was inverted to compute the multiplied
0939   //! BSpline : the method used is interpolation at Schoenenberg
0940   //! points of a(t)*F(t)
0941   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
0942   
0943   //! this will  multiply a given Vectorial BSpline F(t)
0944   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0945   //! its Poles  array which are coded as  an array of Real
0946   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
0947   //! function     a(t) which is   assumed to   satisfy the
0948   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
0949   //! that can be expressed  exactly as a BSpline of degree
0950   //! NewDegree on the knots FlatKnots 2. the range of a(t)
0951   //! is the same as the  range of F(t)
0952   //! Warning: it is
0953   //! the caller's responsibility to insure that conditions
0954   //! 1. and  2. above are  satisfied : no check whatsoever
0955   //! is made in this method
0956   //! theStatus will return 0 if OK else it will return the pivot index
0957   //! of the matrix that was inverted to compute the multiplied
0958   //! BSpline : the method used is interpolation at Schoenenberg
0959   //! points of a(t)*F(t)
0960   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
0961   
0962   //! this will  multiply a given Vectorial BSpline F(t)
0963   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
0964   //! its Poles  array which are coded as  an array of Real
0965   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
0966   //! function     a(t) which is   assumed to   satisfy the
0967   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
0968   //! that can be expressed  exactly as a BSpline of degree
0969   //! NewDegree on the knots FlatKnots 2. the range of a(t)
0970   //! is the same as the  range of F(t)
0971   //! Warning: it is
0972   //! the caller's responsibility to insure that conditions
0973   //! 1. and  2. above are  satisfied : no check whatsoever
0974   //! is made in this method
0975   //! theStatus will return 0 if OK else it will return the pivot index
0976   //! of the matrix that was inverted to compute the multiplied
0977   //! BSpline : the method used is interpolation at Schoenenberg
0978   //! points of a(t)*F(t)
0979   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
0980   
0981   //! Perform the De Boor   algorithm  to  evaluate a point at
0982   //! parameter <U>, with <Degree> and <Dimension>.
0983   //!
0984   //! Poles is  an array of  Reals of size
0985   //!
0986   //! <Dimension> *  <Degree>+1
0987   //!
0988   //! Containing the  poles.  At  the end <Poles> contains
0989   //! the current point.   Poles Contain all  the poles of
0990   //! the BsplineCurve, Knots  also Contains all the knots
0991   //! of the BsplineCurve.  ExtrapMode has two slots [0] =
0992   //! Degree used to extrapolate before the first knot [1]
0993   //! = Degre used to  extrapolate after the last knot has
0994   //! to be between 1 and  Degree
0995   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Integer DerivativeRequest, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Result);
0996   
0997   //! Perform the  De Boor algorithm  to evaluate a point at
0998   //! parameter   <U>,  with   <Degree>    and  <Dimension>.
0999   //! Evaluates by multiplying the  Poles by the Weights and
1000   //! gives  the homogeneous  result  in PolesResult that is
1001   //! the results of the evaluation of the numerator once it
1002   //! has     been  multiplied   by  the     weights and  in
1003   //! WeightsResult one has  the result of the evaluation of
1004   //! the denominator
1005   //!
1006   //! Warning:   <PolesResult> and <WeightsResult>  must be   dimensionned
1007   //! properly.
1008   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Integer DerivativeRequest, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Weights, Standard_Real& PolesResult, Standard_Real& WeightsResult);
1009   
1010   //! Perform the evaluation of the Bspline Basis
1011   //! and then multiplies by the weights
1012   //! this just evaluates the current point
1013   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Boolean HomogeneousFlag, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt& Point, Standard_Real& Weight);
1014   
1015   //! Perform the evaluation of the Bspline Basis
1016   //! and then multiplies by the weights
1017   //! this just evaluates the current point
1018   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Boolean HomogeneousFlag, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt2d& Point, Standard_Real& Weight);
1019   
1020   //! Extend a BSpline nD using the tangency map
1021   //! <C1Coefficient> is the coefficient of reparametrisation
1022   //! <Continuity> must be equal to 1, 2 or 3.
1023   //! <Degree> must be greater or equal than <Continuity> + 1.
1024   //!
1025   //! Warning:   <KnotsResult> and <PolesResult>  must be   dimensionned
1026   //! properly.
1027   Standard_EXPORT static void TangExtendToConstraint (const TColStd_Array1OfReal& FlatKnots, const Standard_Real C1Coefficient, const Standard_Integer NumPoles, Standard_Real& Poles, const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& ConstraintPoint, const Standard_Integer Continuity, const Standard_Boolean After, Standard_Integer& NbPolesResult, Standard_Integer& NbKnotsRsult, Standard_Real& KnotsResult, Standard_Real& PolesResult);
1028   
1029   //! Perform the evaluation of the of the cache
1030   //! the parameter must be normalized between
1031   //! the 0 and 1 for the span.
1032   //! The Cache must be valid when calling this
1033   //! routine. Geom Package will insure that.
1034   //! and then multiplies by the weights
1035   //! this just evaluates the current point
1036   //! the CacheParameter is where the Cache was
1037   //! constructed the SpanLength is to normalize
1038   //! the polynomial in the cache to avoid bad conditioning
1039   //! effects
1040   Standard_EXPORT static void CacheD0 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
1041   
1042   //! Perform the evaluation of the Bspline Basis
1043   //! and then multiplies by the weights
1044   //! this just evaluates the current point
1045   //! the parameter must be normalized between
1046   //! the 0 and 1 for the span.
1047   //! The Cache must be valid when calling this
1048   //! routine. Geom Package will insure that.
1049   //! and then multiplies by the weights
1050   //! ththe CacheParameter is where the Cache was
1051   //! constructed the SpanLength is to normalize
1052   //! the polynomial in the cache to avoid bad conditioning
1053   //! effectsis just evaluates the current point
1054   Standard_EXPORT static void CacheD0 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
1055   
1056   //! Calls CacheD0 for Bezier  Curves Arrays computed with
1057   //! the method PolesCoefficients.
1058   //! Warning: To be used for Beziercurves ONLY!!!
1059     static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
1060   
1061   //! Calls CacheD0 for Bezier  Curves Arrays computed with
1062   //! the method PolesCoefficients.
1063   //! Warning: To be used for Beziercurves ONLY!!!
1064     static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
1065   
1066   //! Perform the evaluation of the of the cache
1067   //! the parameter must be normalized between
1068   //! the 0 and 1 for the span.
1069   //! The Cache must be valid when calling this
1070   //! routine. Geom Package will insure that.
1071   //! and then multiplies by the weights
1072   //! this just evaluates the current point
1073   //! the CacheParameter is where the Cache was
1074   //! constructed the SpanLength is to normalize
1075   //! the polynomial in the cache to avoid bad conditioning
1076   //! effects
1077   Standard_EXPORT static void CacheD1 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
1078   
1079   //! Perform the evaluation of the Bspline Basis
1080   //! and then multiplies by the weights
1081   //! this just evaluates the current point
1082   //! the parameter must be normalized between
1083   //! the 0 and 1 for the span.
1084   //! The Cache must be valid when calling this
1085   //! routine. Geom Package will insure that.
1086   //! and then multiplies by the weights
1087   //! ththe CacheParameter is where the Cache was
1088   //! constructed the SpanLength is to normalize
1089   //! the polynomial in the cache to avoid bad conditioning
1090   //! effectsis just evaluates the current point
1091   Standard_EXPORT static void CacheD1 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
1092   
1093   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1094   //! the method PolesCoefficients.
1095   //! Warning: To be used for Beziercurves ONLY!!!
1096     static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
1097   
1098   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1099   //! the method PolesCoefficients.
1100   //! Warning: To be used for Beziercurves ONLY!!!
1101     static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
1102   
1103   //! Perform the evaluation of the of the cache
1104   //! the parameter must be normalized between
1105   //! the 0 and 1 for the span.
1106   //! The Cache must be valid when calling this
1107   //! routine. Geom Package will insure that.
1108   //! and then multiplies by the weights
1109   //! this just evaluates the current point
1110   //! the CacheParameter is where the Cache was
1111   //! constructed the SpanLength is to normalize
1112   //! the polynomial in the cache to avoid bad conditioning
1113   //! effects
1114   Standard_EXPORT static void CacheD2 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2);
1115   
1116   //! Perform the evaluation of the Bspline Basis
1117   //! and then multiplies by the weights
1118   //! this just evaluates the current point
1119   //! the parameter must be normalized between
1120   //! the 0 and 1 for the span.
1121   //! The Cache must be valid when calling this
1122   //! routine. Geom Package will insure that.
1123   //! and then multiplies by the weights
1124   //! ththe CacheParameter is where the Cache was
1125   //! constructed the SpanLength is to normalize
1126   //! the polynomial in the cache to avoid bad conditioning
1127   //! effectsis just evaluates the current point
1128   Standard_EXPORT static void CacheD2 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2);
1129   
1130   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1131   //! the method PolesCoefficients.
1132   //! Warning: To be used for Beziercurves ONLY!!!
1133     static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2);
1134   
1135   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1136   //! the method PolesCoefficients.
1137   //! Warning: To be used for Beziercurves ONLY!!!
1138     static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2);
1139   
1140   //! Perform the evaluation of the of the cache
1141   //! the parameter must be normalized between
1142   //! the 0 and 1 for the span.
1143   //! The Cache must be valid when calling this
1144   //! routine. Geom Package will insure that.
1145   //! and then multiplies by the weights
1146   //! this just evaluates the current point
1147   //! the CacheParameter is where the Cache was
1148   //! constructed the SpanLength is to normalize
1149   //! the polynomial in the cache to avoid bad conditioning
1150   //! effects
1151   Standard_EXPORT static void CacheD3 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2, gp_Vec& Vec3);
1152   
1153   //! Perform the evaluation of the Bspline Basis
1154   //! and then multiplies by the weights
1155   //! this just evaluates the current point
1156   //! the parameter must be normalized between
1157   //! the 0 and 1 for the span.
1158   //! The Cache must be valid when calling this
1159   //! routine. Geom Package will insure that.
1160   //! and then multiplies by the weights
1161   //! ththe CacheParameter is where the Cache was
1162   //! constructed the SpanLength is to normalize
1163   //! the polynomial in the cache to avoid bad conditioning
1164   //! effectsis just evaluates the current point
1165   Standard_EXPORT static void CacheD3 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2, gp_Vec2d& Vec3);
1166   
1167   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1168   //! the method PolesCoefficients.
1169   //! Warning: To be used for Beziercurves ONLY!!!
1170     static void CoefsD3 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2, gp_Vec& Vec3);
1171   
1172   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1173   //! the method PolesCoefficients.
1174   //! Warning: To be used for Beziercurves ONLY!!!
1175     static void CoefsD3 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2, gp_Vec2d& Vec3);
1176   
1177   //! Perform the evaluation of the Taylor expansion
1178   //! of the Bspline normalized between 0 and 1.
1179   //! If rational computes the homogeneous Taylor expension
1180   //! for the numerator and stores it in CachePoles
1181   Standard_EXPORT static void BuildCache (const Standard_Real U, const Standard_Real InverseOfSpanDomain, const Standard_Boolean PeriodicFlag, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
1182   
1183   //! Perform the evaluation of the Taylor expansion
1184   //! of the Bspline normalized between 0 and 1.
1185   //! If rational computes the homogeneous Taylor expension
1186   //! for the numerator and stores it in CachePoles
1187   Standard_EXPORT static void BuildCache (const Standard_Real U, const Standard_Real InverseOfSpanDomain, const Standard_Boolean PeriodicFlag, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
1188   
1189   //! Perform the evaluation of the Taylor expansion
1190   //! of the Bspline normalized between 0 and 1.
1191   //! Structure of result optimized for BSplCLib_Cache.
1192   Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1193   
1194   //! Perform the evaluation of the Taylor expansion
1195   //! of the Bspline normalized between 0 and 1.
1196   //! Structure of result optimized for BSplCLib_Cache.
1197   Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt2d& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1198   
1199     static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
1200   
1201   Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
1202   
1203     static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt& CachePoles);
1204   
1205   //! Encapsulation   of  BuildCache    to   perform   the
1206   //! evaluation  of the Taylor expansion for beziercurves
1207   //! at parameter 0.
1208   //! Warning: To be used for Beziercurves ONLY!!!
1209   Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
1210   
1211   //! Returns pointer to statically allocated array representing
1212   //! flat knots for bezier curve of the specified degree.
1213   //! Raises OutOfRange if Degree > MaxDegree()
1214   Standard_EXPORT static const Standard_Real& FlatBezierKnots (const Standard_Integer Degree);
1215   
1216   //! builds the Schoenberg points from the flat knot
1217   //! used to interpolate a BSpline since the
1218   //! BSpline matrix is invertible.
1219   Standard_EXPORT static void BuildSchoenbergPoints (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, TColStd_Array1OfReal& Parameters);
1220   
1221   //! Performs the interpolation of  the data given in
1222   //! the Poles  array  according  to the  requests in
1223   //! ContactOrderArray    that is      :           if
1224   //! ContactOrderArray(i) has value  d it means  that
1225   //! Poles(i)   contains the dth  derivative of  the
1226   //! function to be interpolated. The length L of the
1227   //! following arrays must be the same :
1228   //! Parameters, ContactOrderArray, Poles,
1229   //! The length of FlatKnots is Degree + L + 1
1230   //! Warning:
1231   //! the method used to do that interpolation is
1232   //! gauss elimination WITHOUT pivoting. Thus if the
1233   //! diagonal is not dominant there is no guarantee
1234   //! that the algorithm will work. Nevertheless for
1235   //! Cubic interpolation or interpolation at Scheonberg
1236   //! points the method will work
1237   //! The InversionProblem will report 0 if there was no
1238   //! problem else it will give the index of the faulty
1239   //! pivot
1240   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt& Poles, Standard_Integer& InversionProblem);
1241   
1242   //! Performs the interpolation of  the data given in
1243   //! the Poles  array  according  to the  requests in
1244   //! ContactOrderArray    that is      :           if
1245   //! ContactOrderArray(i) has value  d it means  that
1246   //! Poles(i)   contains the dth  derivative of  the
1247   //! function to be interpolated. The length L of the
1248   //! following arrays must be the same :
1249   //! Parameters, ContactOrderArray, Poles,
1250   //! The length of FlatKnots is Degree + L + 1
1251   //! Warning:
1252   //! the method used to do that interpolation is
1253   //! gauss elimination WITHOUT pivoting. Thus if the
1254   //! diagonal is not dominant there is no guarantee
1255   //! that the algorithm will work. Nevertheless for
1256   //! Cubic interpolation at knots or interpolation at Scheonberg
1257   //! points the method will work.
1258   //! The InversionProblem w
1259   //! ll report 0 if there was no
1260   //! problem else it will give the index of the faulty
1261   //! pivot
1262   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt2d& Poles, Standard_Integer& InversionProblem);
1263   
1264   //! Performs the interpolation of  the data given in
1265   //! the Poles  array  according  to the  requests in
1266   //! ContactOrderArray    that is      :           if
1267   //! ContactOrderArray(i) has value  d it means  that
1268   //! Poles(i)   contains the dth  derivative of  the
1269   //! function to be interpolated. The length L of the
1270   //! following arrays must be the same :
1271   //! Parameters, ContactOrderArray, Poles,
1272   //! The length of FlatKnots is Degree + L + 1
1273   //! Warning:
1274   //! the method used to do that interpolation is
1275   //! gauss elimination WITHOUT pivoting. Thus if the
1276   //! diagonal is not dominant there is no guarantee
1277   //! that the algorithm will work. Nevertheless for
1278   //! Cubic interpolation at knots or interpolation at Scheonberg
1279   //! points the method will work.
1280   //! The InversionProblem will report 0 if there was no
1281   //! problem else it will give the index of the faulty
1282   //! pivot
1283   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt& Poles, TColStd_Array1OfReal& Weights, Standard_Integer& InversionProblem);
1284   
1285   //! Performs the interpolation of  the data given in
1286   //! the Poles  array  according  to the  requests in
1287   //! ContactOrderArray    that is      :           if
1288   //! ContactOrderArray(i) has value  d it means  that
1289   //! Poles(i)   contains the dth  derivative of  the
1290   //! function to be interpolated. The length L of the
1291   //! following arrays must be the same :
1292   //! Parameters, ContactOrderArray, Poles,
1293   //! The length of FlatKnots is Degree + L + 1
1294   //! Warning:
1295   //! the method used to do that interpolation is
1296   //! gauss elimination WITHOUT pivoting. Thus if the
1297   //! diagonal is not dominant there is no guarantee
1298   //! that the algorithm will work. Nevertheless for
1299   //! Cubic interpolation at knots or interpolation at Scheonberg
1300   //! points the method will work.
1301   //! The InversionProblem w
1302   //! ll report 0 if there was no
1303   //! problem else it will give the i
1304   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt2d& Poles, TColStd_Array1OfReal& Weights, Standard_Integer& InversionProblem);
1305   
1306   //! Performs the interpolation of  the data given in
1307   //! the Poles  array  according  to the  requests in
1308   //! ContactOrderArray    that is      :           if
1309   //! ContactOrderArray(i) has value  d it means  that
1310   //! Poles(i)   contains the dth  derivative of  the
1311   //! function to be interpolated. The length L of the
1312   //! following arrays must be the same :
1313   //! Parameters, ContactOrderArray
1314   //! The length of FlatKnots is Degree + L + 1
1315   //! The  PolesArray   is    an   seen   as    an
1316   //! Array[1..N][1..ArrayDimension] with N = tge length
1317   //! of the parameters array
1318   //! Warning:
1319   //! the method used to do that interpolation is
1320   //! gauss elimination WITHOUT pivoting. Thus if the
1321   //! diagonal is not dominant there is no guarantee
1322   //! that the algorithm will work. Nevertheless for
1323   //! Cubic interpolation or interpolation at Scheonberg
1324   //! points the method will work
1325   //! The InversionProblem will report 0 if there was no
1326   //! problem else it will give the index of the faulty
1327   //! pivot
1328   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Integer& InversionProblem);
1329   
1330   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Weights, Standard_Integer& InversionProblem);
1331   
1332   //! Find the new poles which allows  an old point (with a
1333   //! given  u as parameter) to reach a new position
1334   //! Index1 and Index2 indicate the range of poles we can move
1335   //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1336   //! don't enter (1,NbPoles) -> error: rigid move
1337   //! (2, NbPoles-1) -> the ends are enforced
1338   //! (3, NbPoles-2) -> the ends and the tangency are enforced
1339   //! if Problem in BSplineBasis calculation, no change for the curve
1340   //! and FirstIndex, LastIndex = 0
1341   Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec2d& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt2d& NewPoles);
1342   
1343   //! Find the new poles which allows  an old point (with a
1344   //! given  u as parameter) to reach a new position
1345   //! Index1 and Index2 indicate the range of poles we can move
1346   //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1347   //! don't enter (1,NbPoles) -> error: rigid move
1348   //! (2, NbPoles-1) -> the ends are enforced
1349   //! (3, NbPoles-2) -> the ends and the tangency are enforced
1350   //! if Problem in BSplineBasis calculation, no change for the curve
1351   //! and FirstIndex, LastIndex = 0
1352   Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt& NewPoles);
1353   
1354   //! This is the dimension free version of the utility
1355   //! U is the parameter  must be within the  first FlatKnots and the
1356   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1357   //! DeltaDerivative is the  amount the derivative  has to be moved.
1358   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1359   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1360   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1361   //! -1 means the starting point of the curve can move
1362   //! = 0 means the
1363   //! starting  point  of the curve  cannot  move but  tangent  starting
1364   //! point of the curve cannot move
1365   //! = 1 means the starting point and tangents cannot move
1366   //! = 2 means the starting point tangent and curvature cannot move
1367   //! = ...
1368   //! Same holds for EndingCondition
1369   //! Poles are the poles of the curve
1370   //! Weights are the weights of the curve if not NULL
1371   //! NewPoles are the poles of the deformed curve
1372   //! ErrorStatus will be 0 if no error happened
1373   //! 1 if there are not enough knots/poles
1374   //! the imposed conditions
1375   //! The way to solve this problem is to add knots to the BSpline
1376   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1377   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1378   //! have at least 2 internal knots.
1379   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const Standard_Integer ArrayDimension, Standard_Real& Delta, Standard_Real& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Real& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Real& NewPoles, Standard_Integer& ErrorStatus);
1380   
1381   //! This is the dimension free version of the utility
1382   //! U is the parameter  must be within the  first FlatKnots and the
1383   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1384   //! DeltaDerivative is the  amount the derivative  has to be moved.
1385   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1386   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1387   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1388   //! -1 means the starting point of the curve can move
1389   //! = 0 means the
1390   //! starting  point  of the curve  cannot  move but  tangent  starting
1391   //! point of the curve cannot move
1392   //! = 1 means the starting point and tangents cannot move
1393   //! = 2 means the starting point tangent and curvature cannot move
1394   //! = ...
1395   //! Same holds for EndingCondition
1396   //! Poles are the poles of the curve
1397   //! Weights are the weights of the curve if not NULL
1398   //! NewPoles are the poles of the deformed curve
1399   //! ErrorStatus will be 0 if no error happened
1400   //! 1 if there are not enough knots/poles
1401   //! the imposed conditions
1402   //! The way to solve this problem is to add knots to the BSpline
1403   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1404   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1405   //! have at least 2 internal knots.
1406   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec& Delta, const gp_Vec& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt& NewPoles, Standard_Integer& ErrorStatus);
1407   
1408   //! This is the dimension free version of the utility
1409   //! U is the parameter  must be within the  first FlatKnots and the
1410   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1411   //! DeltaDerivative is the  amount the derivative  has to be moved.
1412   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1413   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1414   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1415   //! -1 means the starting point of the curve can move
1416   //! = 0 means the
1417   //! starting  point  of the curve  cannot  move but  tangent  starting
1418   //! point of the curve cannot move
1419   //! = 1 means the starting point and tangents cannot move
1420   //! = 2 means the starting point tangent and curvature cannot move
1421   //! = ...
1422   //! Same holds for EndingCondition
1423   //! Poles are the poles of the curve
1424   //! Weights are the weights of the curve if not NULL
1425   //! NewPoles are the poles of the deformed curve
1426   //! ErrorStatus will be 0 if no error happened
1427   //! 1 if there are not enough knots/poles
1428   //! the imposed conditions
1429   //! The way to solve this problem is to add knots to the BSpline
1430   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1431   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1432   //! have at least 2 internal knots.
1433   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec2d& Delta, const gp_Vec2d& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& ErrorStatus);
1434   
1435 
1436   //! given a tolerance in 3D space returns a
1437   //! tolerance    in U parameter space such that
1438   //! all u1 and u0 in the domain of the curve f(u)
1439   //! | u1 - u0 | < UTolerance and
1440   //! we have |f (u1) - f (u0)| < Tolerance3D
1441   Standard_EXPORT static void Resolution (Standard_Real& PolesArray, const Standard_Integer ArrayDimension, const Standard_Integer NumPoles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1442   
1443 
1444   //! given a tolerance in 3D space returns a
1445   //! tolerance    in U parameter space such that
1446   //! all u1 and u0 in the domain of the curve f(u)
1447   //! | u1 - u0 | < UTolerance and
1448   //! we have |f (u1) - f (u0)| < Tolerance3D
1449   Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1450   
1451 
1452   //! given a tolerance in 3D space returns a
1453   //! tolerance    in U parameter space such that
1454   //! all u1 and u0 in the domain of the curve f(u)
1455   //! | u1 - u0 | < UTolerance and
1456   //! we have |f (u1) - f (u0)| < Tolerance3D
1457   Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1458 
1459   //! Splits the given range to BSpline intervals of given continuity
1460   //! @param[in] theKnots the knots of BSpline
1461   //! @param[in] theMults the knots' multiplicities
1462   //! @param[in] theDegree the degree of BSpline
1463   //! @param[in] isPeriodic the periodicity of BSpline
1464   //! @param[in] theContinuity the target interval's continuity 
1465   //! @param[in] theFirst the begin of the target range
1466   //! @param[in] theLast the end of the target range
1467   //! @param[in] theTolerance the tolerance
1468   //! @param[in,out] theIntervals the array to store intervals if isn't nullptr
1469   //! @return the number of intervals
1470   Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
1471                                                      const TColStd_Array1OfInteger& theMults,
1472                                                      Standard_Integer theDegree,
1473                                                      Standard_Boolean isPeriodic,
1474                                                      Standard_Integer theContinuity,
1475                                                      Standard_Real theFirst,
1476                                                      Standard_Real theLast,
1477                                                      Standard_Real theTolerance,
1478                                                      TColStd_Array1OfReal* theIntervals);
1479 
1480 protected:
1481 
1482 
1483 
1484 
1485 
1486 private:
1487 
1488   
1489   Standard_EXPORT static void LocateParameter (const TColStd_Array1OfReal& Knots, const Standard_Real U, const Standard_Boolean Periodic, const Standard_Integer K1, const Standard_Integer K2, Standard_Integer& Index, Standard_Real& NewU, const Standard_Real Uf, const Standard_Real Ue);
1490 
1491 
1492 
1493 
1494 };
1495 
1496 
1497 #include <BSplCLib.lxx>
1498 
1499 
1500 
1501 
1502 
1503 #endif // _BSplCLib_HeaderFile