Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-03-09
0002 // Created by: JCV
0003 // Copyright (c) 1993-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 _Geom_BSplineSurface_HeaderFile
0018 #define _Geom_BSplineSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Precision.hxx>
0024 #include <GeomAbs_BSplKnotDistribution.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TColgp_HArray2OfPnt.hxx>
0028 #include <TColStd_HArray2OfReal.hxx>
0029 #include <TColStd_HArray1OfReal.hxx>
0030 #include <TColStd_HArray1OfInteger.hxx>
0031 #include <Geom_BoundedSurface.hxx>
0032 #include <TColgp_Array2OfPnt.hxx>
0033 #include <TColStd_Array1OfReal.hxx>
0034 #include <TColStd_Array1OfInteger.hxx>
0035 #include <TColStd_Array2OfReal.hxx>
0036 #include <TColgp_Array1OfPnt.hxx>
0037 class gp_Pnt;
0038 class gp_Vec;
0039 class Geom_Curve;
0040 class gp_Trsf;
0041 class Geom_Geometry;
0042 
0043 
0044 class Geom_BSplineSurface;
0045 DEFINE_STANDARD_HANDLE(Geom_BSplineSurface, Geom_BoundedSurface)
0046 
0047 //! Describes a BSpline surface.
0048 //! In each parametric direction, a BSpline surface can be:
0049 //! - uniform or non-uniform,
0050 //! - rational or non-rational,
0051 //! - periodic or non-periodic.
0052 //! A BSpline surface is defined by:
0053 //! - its degrees, in the u and v parametric directions,
0054 //! - its periodic characteristic, in the u and v parametric directions,
0055 //! - a table of poles, also called control points (together
0056 //! with the associated weights if the surface is rational), and
0057 //! - a table of knots, together with the associated multiplicities.
0058 //! The degree of a Geom_BSplineSurface is limited to
0059 //! a value (25) which is defined and controlled by the
0060 //! system. This value is returned by the function MaxDegree.
0061 //! Poles and Weights
0062 //! Poles and Weights are manipulated using two associative double arrays:
0063 //! - the poles table, which is a double array of gp_Pnt points, and
0064 //! - the weights table, which is a double array of reals.
0065 //! The bounds of the poles and weights arrays are:
0066 //! - 1 and NbUPoles for the row bounds (provided
0067 //! that the BSpline surface is not periodic in the u
0068 //! parametric direction), where NbUPoles is the
0069 //! number of poles of the surface in the u parametric direction, and
0070 //! - 1 and NbVPoles for the column bounds (provided
0071 //! that the BSpline surface is not periodic in the v
0072 //! parametric direction), where NbVPoles is the
0073 //! number of poles of the surface in the v parametric direction.
0074 //! The poles of the surface are the points used to shape
0075 //! and reshape the surface. They comprise a rectangular network.
0076 //! If the surface is not periodic:
0077 //! - The points (1, 1), (NbUPoles, 1), (1,
0078 //! NbVPoles), and (NbUPoles, NbVPoles)
0079 //! are the four parametric "corners" of the surface.
0080 //! - The first column of poles and the last column of
0081 //! poles define two BSpline curves which delimit the
0082 //! surface in the v parametric direction. These are the
0083 //! v isoparametric curves corresponding to the two
0084 //! bounds of the v parameter.
0085 //! - The first row of poles and the last row of poles
0086 //! define two BSpline curves which delimit the surface
0087 //! in the u parametric direction. These are the u
0088 //! isoparametric curves corresponding to the two bounds of the u parameter.
0089 //! If the surface is periodic, these geometric properties are not verified.
0090 //! It is more difficult to define a geometrical significance
0091 //! for the weights. However they are useful for
0092 //! representing a quadric surface precisely. Moreover, if
0093 //! the weights of all the poles are equal, the surface has
0094 //! a polynomial equation, and hence is a "non-rational surface".
0095 //! The non-rational surface is a special, but frequently
0096 //! used, case, where all poles have identical weights.
0097 //! The weights are defined and used only in the case of
0098 //! a rational surface. The rational characteristic is
0099 //! defined in each parametric direction. A surface can be
0100 //! rational in the u parametric direction, and
0101 //! non-rational in the v parametric direction.
0102 //! Knots and Multiplicities
0103 //! For a Geom_BSplineSurface the table of knots is
0104 //! made up of two increasing sequences of reals, without
0105 //! repetition, one for each parametric direction. The
0106 //! multiplicities define the repetition of the knots.
0107 //! A BSpline surface comprises multiple contiguous
0108 //! patches, which are themselves polynomial or rational
0109 //! surfaces. The knots are the parameters of the
0110 //! isoparametric curves which limit these contiguous
0111 //! patches. The multiplicity of a knot on a BSpline
0112 //! surface (in a given parametric direction) is related to
0113 //! the degree of continuity of the surface at that knot in
0114 //! that parametric direction:
0115 //! Degree of continuity at knot(i) = Degree - Multi(i) where:
0116 //! - Degree is the degree of the BSpline surface in
0117 //! the given parametric direction, and
0118 //! - Multi(i) is the multiplicity of knot number i in
0119 //! the given parametric direction.
0120 //! There are some special cases, where the knots are
0121 //! regularly spaced in one parametric direction (i.e. the
0122 //! difference between two consecutive knots is a constant).
0123 //! - "Uniform": all the multiplicities are equal to 1.
0124 //! - "Quasi-uniform": all the multiplicities are equal to 1,
0125 //! except for the first and last knots in this parametric
0126 //! direction, and these are equal to Degree + 1.
0127 //! - "Piecewise Bezier": all the multiplicities are equal to
0128 //! Degree except for the first and last knots, which
0129 //! are equal to Degree + 1. This surface is a
0130 //! concatenation of Bezier patches in the given
0131 //! parametric direction.
0132 //! If the BSpline surface is not periodic in a given
0133 //! parametric direction, the bounds of the knots and
0134 //! multiplicities tables are 1 and NbKnots, where
0135 //! NbKnots is the number of knots of the BSpline
0136 //! surface in that parametric direction.
0137 //! If the BSpline surface is periodic in a given parametric
0138 //! direction, and there are k periodic knots and p
0139 //! periodic poles in that parametric direction:
0140 //! - the period is such that:
0141 //! period = Knot(k+1) - Knot(1), and
0142 //! - the poles and knots tables in that parametric
0143 //! direction can be considered as infinite tables, such that:
0144 //! Knot(i+k) = Knot(i) + period, and
0145 //! Pole(i+p) = Pole(i)
0146 //! Note: The data structure tables for a periodic BSpline
0147 //! surface are more complex than those of a non-periodic one.
0148 //! References :
0149 //! . A survey of curve and surface methods in CADG Wolfgang BOHM
0150 //! CAGD 1 (1984)
0151 //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM
0152 //! cagd 5 (1988)
0153 //! . Blossoming and knot insertion algorithms for B-spline curves
0154 //! Ronald N. GOLDMAN
0155 //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
0156 //! . Curves and Surfaces for Computer Aided Geometric Design,
0157 //! a practical guide Gerald Farin
0158 class Geom_BSplineSurface : public Geom_BoundedSurface
0159 {
0160 
0161 public:
0162 
0163   
0164   //! Creates  a non-rational b-spline surface (weights
0165   //! default value is 1.).
0166   //! The following conditions must be verified.
0167   //! 0 < UDegree <= MaxDegree.
0168   //! UKnots.Length() == UMults.Length() >= 2
0169   //! UKnots(i) < UKnots(i+1) (Knots are increasing)
0170   //! 1 <= UMults(i) <= UDegree
0171   //! On a   non  uperiodic   surface    the  first and    last
0172   //! umultiplicities  may  be     UDegree+1  (this   is   even
0173   //! recommended if you want the curve  to start and finish on
0174   //! the first and last pole).
0175   //! On a uperiodic     surface  the first    and   the   last
0176   //! umultiplicities must be the same.
0177   //! on non-uperiodic surfaces
0178   //! Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2
0179   //! on uperiodic surfaces
0180   //! Poles.ColLength() == Sum(UMults(i)) except the first or last
0181   //! The previous conditions for U holds  also for V, with the
0182   //! RowLength of the poles.
0183   Standard_EXPORT Geom_BSplineSurface(const TColgp_Array2OfPnt& Poles, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger& UMults, const TColStd_Array1OfInteger& VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean UPeriodic = Standard_False, const Standard_Boolean VPeriodic = Standard_False);
0184   
0185   //! Creates  a non-rational b-spline surface (weights
0186   //! default value is 1.).
0187   //!
0188   //! The following conditions must be verified.
0189   //! 0 < UDegree <= MaxDegree.
0190   //!
0191   //! UKnots.Length() == UMults.Length() >= 2
0192   //!
0193   //! UKnots(i) < UKnots(i+1) (Knots are increasing)
0194   //! 1 <= UMults(i) <= UDegree
0195   //!
0196   //! On a   non  uperiodic   surface    the  first and    last
0197   //! umultiplicities  may  be     UDegree+1  (this   is   even
0198   //! recommended if you want the curve  to start and finish on
0199   //! the first and last pole).
0200   //!
0201   //! On a uperiodic     surface  the first    and   the   last
0202   //! umultiplicities must be the same.
0203   //!
0204   //! on non-uperiodic surfaces
0205   //!
0206   //! Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2
0207   //!
0208   //! on uperiodic surfaces
0209   //!
0210   //! Poles.ColLength() == Sum(UMults(i)) except the first or
0211   //! last
0212   //!
0213   //! The previous conditions for U holds  also for V, with the
0214   //! RowLength of the poles.
0215   Standard_EXPORT Geom_BSplineSurface(const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal& Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger& UMults, const TColStd_Array1OfInteger& VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean UPeriodic = Standard_False, const Standard_Boolean VPeriodic = Standard_False);
0216   
0217   //! Exchanges the u and v parametric directions on
0218   //! this BSpline surface.
0219   //! As a consequence:
0220   //! - the poles and weights tables are transposed,
0221   //! - the knots and multiplicities tables are exchanged,
0222   //! - degrees of continuity, and rational, periodic and
0223   //! uniform characteristics are exchanged, and
0224   //! - the orientation of the surface is inverted.
0225   Standard_EXPORT void ExchangeUV();
0226   
0227   //! Sets the surface U periodic.
0228   //! Modifies this surface to be periodic in the U 
0229   //! parametric direction.
0230   //! To become periodic in a given parametric direction a
0231   //! surface must be closed in that parametric direction,
0232   //! and the knot sequence relative to that direction must be periodic.
0233   //! To generate this periodic sequence of knots, the
0234   //! functions FirstUKnotIndex and LastUKnotIndex  are used to
0235   //! compute I1 and I2. These are the indexes, in the
0236   //! knot array associated with the given parametric
0237   //! direction, of the knots that correspond to the first and
0238   //! last parameters of this BSpline surface in the given
0239   //! parametric direction. Hence the period is:
0240   //! Knots(I1) - Knots(I2)
0241   //! As a result, the knots and poles tables are modified.
0242   //! Exceptions
0243   //! Standard_ConstructionError if the surface is not
0244   //! closed in the given parametric direction.
0245   Standard_EXPORT void SetUPeriodic();
0246   
0247   //! Sets the surface V periodic.
0248   //! Modifies this surface to be periodic in the V
0249   //! parametric direction.
0250   //! To become periodic in a given parametric direction a
0251   //! surface must be closed in that parametric direction,
0252   //! and the knot sequence relative to that direction must be periodic.
0253   //! To generate this periodic sequence of knots, the
0254   //! functions FirstVKnotIndex and LastVKnotIndex are used to
0255   //! compute I1 and I2. These are the indexes, in the
0256   //! knot array associated with the given parametric
0257   //! direction, of the knots that correspond to the first and
0258   //! last parameters of this BSpline surface in the given
0259   //! parametric direction. Hence the period is:
0260   //! Knots(I1) - Knots(I2)
0261   //! As a result, the knots and poles tables are modified.
0262   //! Exceptions
0263   //! Standard_ConstructionError if the surface is not
0264   //! closed in the given parametric direction.
0265   Standard_EXPORT void SetVPeriodic();
0266   
0267   //! returns the parameter normalized within
0268   //! the period if the surface is periodic : otherwise
0269   //! does not do anything
0270   Standard_EXPORT void PeriodicNormalization (Standard_Real& U, Standard_Real& V) const;
0271   
0272   //! Assigns the knot of index Index in the knots table in
0273   //! the corresponding parametric direction to be the
0274   //! origin of this periodic BSpline surface. As a
0275   //! consequence, the knots and poles tables are modified.
0276   //! Exceptions
0277   //! Standard_NoSuchObject if this BSpline surface is
0278   //! not periodic in the given parametric direction.
0279   //! Standard_DomainError if Index is outside the
0280   //! bounds of the knots table in the given parametric direction.
0281   Standard_EXPORT void SetUOrigin (const Standard_Integer Index);
0282   
0283   //! Assigns the knot of index Index in the knots table in
0284   //! the corresponding parametric direction to be the
0285   //! origin of this periodic BSpline surface. As a
0286   //! consequence, the knots and poles tables are modified.
0287   //! Exceptions
0288   //! Standard_NoSuchObject if this BSpline surface is
0289   //! not periodic in the given parametric direction.
0290   //! Standard_DomainError if Index is outside the
0291   //! bounds of the knots table in the given parametric direction.
0292   Standard_EXPORT void SetVOrigin (const Standard_Integer Index);
0293   
0294   //! Sets the surface U not periodic.
0295   //! Changes this BSpline surface into a non-periodic
0296   //! surface along U direction. 
0297   //! If this surface is already non-periodic, it is not modified.
0298   //! Note: the poles and knots tables are modified.
0299   Standard_EXPORT void SetUNotPeriodic();
0300   
0301   //! Sets the surface V not periodic.
0302   //! Changes this BSpline surface into a non-periodic
0303   //! surface along V direction. 
0304   //! If this surface is already non-periodic, it is not modified.
0305   //! Note: the poles and knots tables are modified.
0306   Standard_EXPORT void SetVNotPeriodic();
0307   
0308   //! Changes the orientation of this BSpline surface in the
0309   //! U parametric direction. The bounds of the
0310   //! surface are not changed but the given parametric
0311   //! direction is reversed. Hence the orientation of the
0312   //! surface is reversed.
0313   //! The knots and poles tables are modified.
0314   Standard_EXPORT void UReverse() Standard_OVERRIDE;
0315   
0316   //! Changes the orientation of this BSpline surface in the
0317   //! V parametric direction. The bounds of the
0318   //! surface are not changed but the given parametric
0319   //! direction is reversed. Hence the orientation of the
0320   //! surface is reversed.
0321   //! The knots and poles tables are modified.
0322   Standard_EXPORT void VReverse() Standard_OVERRIDE;
0323   
0324   //! Computes the u parameter on the modified
0325   //! surface, produced by reversing its U parametric
0326   //! direction, for the point of u parameter U,  on this BSpline surface.
0327   //! For a BSpline surface, these functions return respectively:
0328   //! - UFirst + ULast - U, 
0329   //! where UFirst, ULast are
0330   //! the values of the first and last parameters of this
0331   //! BSpline surface, in the u parametric directions.
0332   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
0333   
0334   //! Computes the v parameter on the modified
0335   //! surface, produced by reversing its V parametric
0336   //! direction, for the point of v parameter V on this BSpline surface.
0337   //! For a BSpline surface, these functions return respectively:
0338   //! - VFirst + VLast - V,
0339   //! VFirst and VLast are
0340   //! the values of the first and last parameters of this
0341   //! BSpline surface, in the v pametric directions.
0342   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
0343   
0344   //! Increases the degrees of this BSpline surface to
0345   //! UDegree and VDegree in the u and v parametric
0346   //! directions respectively. As a result, the tables of poles,
0347   //! weights and multiplicities are modified. The tables of
0348   //! knots is not changed.
0349   //! Note: Nothing is done if the given degree is less than
0350   //! or equal to the current degree in the corresponding
0351   //! parametric direction.
0352   //! Exceptions
0353   //! Standard_ConstructionError if UDegree or
0354   //! VDegree is greater than
0355   //! Geom_BSplineSurface::MaxDegree().
0356   Standard_EXPORT void IncreaseDegree (const Standard_Integer UDegree, const Standard_Integer VDegree);
0357   
0358   //! Inserts into the knots table for the U
0359   //! parametric direction of this BSpline surface:
0360   //! - the values of the array Knots, with their respective
0361   //! multiplicities, Mults.
0362   //! If the knot value to insert already exists in the table, its multiplicity is:
0363   //! - increased by M, if Add is true (the default), or
0364   //! - increased to M, if Add is false.
0365   //! The tolerance criterion used to check the equality of
0366   //! the knots is the larger of the values ParametricTolerance and
0367   //! Standard_Real::Epsilon(val), where val is the knot value to be inserted.
0368   //! Warning
0369   //! - If a given multiplicity coefficient is null, or negative, nothing is done.
0370   //! - The new multiplicity of a knot is limited to the degree of this BSpline surface in the
0371   //! corresponding parametric direction.
0372   //! Exceptions
0373   //! Standard_ConstructionError if a knot value to
0374   //! insert is outside the bounds of this BSpline surface in
0375   //! the specified parametric direction. The comparison
0376   //! uses the precision criterion ParametricTolerance.
0377   Standard_EXPORT void InsertUKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True);
0378   
0379   //! Inserts into the knots table for the V
0380   //! parametric direction of this BSpline surface:
0381   //! - the values of the array Knots, with their respective
0382   //! multiplicities, Mults.
0383   //! If the knot value to insert already exists in the table, its multiplicity is:
0384   //! - increased by M, if Add is true (the default), or
0385   //! - increased to M, if Add is false.
0386   //! The tolerance criterion used to check the equality of
0387   //! the knots is the larger of the values ParametricTolerance and
0388   //! Standard_Real::Epsilon(val), where val is the knot value to be inserted.
0389   //! Warning
0390   //! - If a given multiplicity coefficient is null, or negative, nothing is done.
0391   //! - The new multiplicity of a knot is limited to the degree of this BSpline surface in the
0392   //! corresponding parametric direction.
0393   //! Exceptions
0394   //! Standard_ConstructionError if a knot value to
0395   //! insert is outside the bounds of this BSpline surface in
0396   //! the specified parametric direction. The comparison
0397   //! uses the precision criterion ParametricTolerance.
0398   Standard_EXPORT void InsertVKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True);
0399   
0400   //! Reduces to M the multiplicity of the knot of index
0401   //! Index in the U parametric direction. If M is 0, the knot is removed.
0402   //! With a modification of this type, the table of poles is also modified.
0403   //! Two different algorithms are used systematically to
0404   //! compute the new poles of the surface. For each
0405   //! pole, the distance between the pole calculated
0406   //! using the first algorithm and the same pole
0407   //! calculated using the second algorithm, is checked. If
0408   //! this distance is less than Tolerance it ensures that
0409   //! the surface is not modified by more than Tolerance.
0410   //! Under these conditions, the function returns true;
0411   //! otherwise, it returns false.
0412   //! A low tolerance prevents modification of the
0413   //! surface. A high tolerance "smoothes" the surface.
0414   //! Exceptions
0415   //! Standard_OutOfRange if Index is outside the
0416   //! bounds of the knots table of this BSpline surface.
0417   Standard_EXPORT Standard_Boolean RemoveUKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance);
0418   
0419   //! Reduces to M the multiplicity of the knot of index
0420   //! Index in the V parametric direction. If M is 0, the knot is removed.
0421   //! With a modification of this type, the table of poles is also modified.
0422   //! Two different algorithms are used systematically to
0423   //! compute the new poles of the surface. For each
0424   //! pole, the distance between the pole calculated
0425   //! using the first algorithm and the same pole
0426   //! calculated using the second algorithm, is checked. If
0427   //! this distance is less than Tolerance it ensures that
0428   //! the surface is not modified by more than Tolerance.
0429   //! Under these conditions, the function returns true;
0430   //! otherwise, it returns false.
0431   //! A low tolerance prevents modification of the
0432   //! surface. A high tolerance "smoothes" the surface.
0433   //! Exceptions
0434   //! Standard_OutOfRange if Index is outside the
0435   //! bounds of the knots table of this BSpline surface.
0436   Standard_EXPORT Standard_Boolean RemoveVKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance);
0437   
0438 
0439   //! Increases the multiplicity of the knot of range UIndex
0440   //! in the UKnots sequence.
0441   //! M is the new multiplicity. M must be greater than the
0442   //! previous multiplicity and lower or equal to the degree
0443   //! of the surface in the U parametric direction.
0444   //! Raised if M is not in the range [1, UDegree]
0445   //!
0446   //! Raised if UIndex is not in the range [FirstUKnotIndex,
0447   //! LastUKnotIndex] given by the methods with the same name.
0448   Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer UIndex, const Standard_Integer M);
0449   
0450 
0451   //! Increases until order M the multiplicity of the set of knots
0452   //! FromI1,...., ToI2 in the U direction. This method can be used
0453   //! to make a B_spline surface into a PiecewiseBezier B_spline
0454   //! surface.
0455   //! If <me> was uniform, it can become non uniform.
0456   //!
0457   //! Raised if FromI1 or ToI2 is out of the range [FirstUKnotIndex,
0458   //! LastUKnotIndex].
0459   //!
0460   //! M should be greater than the previous multiplicity of the
0461   //! all the knots FromI1,..., ToI2 and lower or equal to the
0462   //! Degree of the surface in the U parametric direction.
0463   Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M);
0464   
0465 
0466   //! Increments the multiplicity of the consecutives uknots FromI1..ToI2
0467   //! by step.   The multiplicity of each knot FromI1,.....,ToI2 must be
0468   //! lower or equal to the UDegree of the B_spline.
0469   //!
0470   //! Raised if FromI1 or ToI2 is not in the range
0471   //! [FirstUKnotIndex, LastUKnotIndex]
0472   //!
0473   //! Raised if one knot has a multiplicity greater than UDegree.
0474   Standard_EXPORT void IncrementUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step);
0475   
0476 
0477   //! Increases the multiplicity of a knot in the V direction.
0478   //! M is the new multiplicity.
0479   //!
0480   //! M should be greater than the previous multiplicity and lower
0481   //! than the degree of the surface in the V parametric direction.
0482   //!
0483   //! Raised if VIndex is not in the range [FirstVKnotIndex,
0484   //! LastVKnotIndex] given by the methods with the same name.
0485   Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer VIndex, const Standard_Integer M);
0486   
0487 
0488   //! Increases until order M the multiplicity of the set of knots
0489   //! FromI1,...., ToI2 in the V direction. This method can be used to
0490   //! make a BSplineSurface into a PiecewiseBezier B_spline
0491   //! surface. If <me> was uniform, it can become non-uniform.
0492   //!
0493   //! Raised if FromI1 or ToI2 is out of the range [FirstVKnotIndex,
0494   //! LastVKnotIndex] given by the methods with the same name.
0495   //!
0496   //! M should be greater than the previous multiplicity of the
0497   //! all the knots FromI1,..., ToI2 and lower or equal to the
0498   //! Degree of the surface in the V parametric direction.
0499   Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M);
0500   
0501 
0502   //! Increments the multiplicity of the consecutives vknots FromI1..ToI2
0503   //! by step.  The multiplicity of each knot FromI1,.....,ToI2 must be
0504   //! lower or equal to the VDegree of the B_spline.
0505   //!
0506   //! Raised if FromI1 or ToI2 is not in the range
0507   //! [FirstVKnotIndex, LastVKnotIndex]
0508   //!
0509   //! Raised if one knot has a multiplicity greater than VDegree.
0510   Standard_EXPORT void IncrementVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step);
0511   
0512 
0513   //! Inserts a knot value in the sequence of UKnots. If U is a knot
0514   //! value this method increases the multiplicity of the knot if the
0515   //! previous multiplicity was lower than M else it does nothing. The
0516   //! tolerance criterion is ParametricTolerance. ParametricTolerance
0517   //! should be greater or equal than Resolution from package gp.
0518   //!
0519   //! Raised if U is out of the bounds [U1, U2] given by the methods
0520   //! Bounds, the criterion ParametricTolerance is used.
0521   //! Raised if M is not in the range [1, UDegree].
0522   Standard_EXPORT void InsertUKnot (const Standard_Real U, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True);
0523   
0524 
0525   //! Inserts a knot value in the sequence of VKnots. If V is a knot
0526   //! value this method increases the multiplicity of the knot if the
0527   //! previous multiplicity was lower than M otherwise it does nothing.
0528   //! The tolerance criterion is ParametricTolerance.
0529   //! ParametricTolerance should be greater or equal than Resolution
0530   //! from package gp.
0531   //!
0532   //! raises if V is out of the Bounds [V1, V2] given by the methods
0533   //! Bounds, the criterion ParametricTolerance is used.
0534   //! raises if M is not in the range [1, VDegree].
0535   Standard_EXPORT void InsertVKnot (const Standard_Real V, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True);
0536   
0537 
0538   //! Segments the surface between U1 and U2 in the U-Direction.
0539   //! between V1 and V2 in the V-Direction.
0540   //! The control points are modified, the first and the last point
0541   //! are not the same.
0542   //!
0543   //! Parameters theUTolerance, theVTolerance define the possible proximity along the corresponding
0544   //! direction of the segment boundaries and B-spline knots to treat them as equal.
0545   //!
0546   //! Warnings :
0547   //! Even if <me> is not closed it can become closed after the
0548   //! segmentation for example if U1 or U2 are out of the bounds
0549   //! of the surface <me> or if the surface makes loop.
0550   //! raises if U2 < U1 or V2 < V1.
0551   //! Standard_DomainError if U2 - U1 exceeds the uperiod for uperiodic surfaces.
0552   //! i.e. ((U2 - U1) - UPeriod) > Precision::PConfusion().
0553   //! Standard_DomainError if V2 - V1 exceeds the vperiod for vperiodic surfaces.
0554   //! i.e. ((V2 - V1) - VPeriod) > Precision::PConfusion()).
0555   Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2,
0556                                 const Standard_Real theUTolerance = Precision::PConfusion(),
0557                                 const Standard_Real theVTolerance = Precision::PConfusion());
0558   
0559 
0560   //! Segments the surface between U1 and U2 in the U-Direction.
0561   //! between V1 and V2 in the V-Direction.
0562   //!
0563   //! same as Segment but do nothing if U1 and U2 (resp. V1 and V2) are
0564   //! equal to the bounds in U (resp. in V) of <me>.
0565   //! For example, if <me> is periodic in V, it will be always periodic
0566   //! in V after the segmentation if the bounds in V are unchanged
0567   //!
0568   //! Parameters theUTolerance, theVTolerance define the possible proximity along the corresponding
0569   //! direction of the segment boundaries and B-spline knots to treat them as equal.
0570   //!
0571   //! Warnings :
0572   //! Even if <me> is not closed it can become closed after the
0573   //! segmentation for example if U1 or U2 are out of the bounds
0574   //! of the surface <me> or if the surface makes loop.
0575   //! raises if U2 < U1 or V2 < V1.
0576   //! Standard_DomainError if U2 - U1 exceeds the uperiod for uperiodic surfaces.
0577   //! i.e. ((U2 - U1) - UPeriod) > Precision::PConfusion().
0578   //! Standard_DomainError if V2 - V1 exceeds the vperiod for vperiodic surfaces.
0579   //! i.e. ((V2 - V1) - VPeriod) > Precision::PConfusion()).
0580   Standard_EXPORT void CheckAndSegment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2,
0581                                         const Standard_Real theUTolerance = Precision::PConfusion(),
0582                                         const Standard_Real theVTolerance = Precision::PConfusion());
0583   
0584   //! Substitutes the UKnots of range UIndex with K.
0585   //!
0586   //! Raised if UIndex < 1 or UIndex > NbUKnots
0587   //!
0588   //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
0589   Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K);
0590   
0591   //! Changes all the U-knots of the surface.
0592   //! The multiplicity of the knots are not modified.
0593   //!
0594   //! Raised if there is an index such that UK (Index+1) <= UK (Index).
0595   //!
0596   //! Raised if  UK.Lower() < 1 or UK.Upper() > NbUKnots
0597   Standard_EXPORT void SetUKnots (const TColStd_Array1OfReal& UK);
0598   
0599 
0600   //! Changes the value of the UKnots of range UIndex and
0601   //! increases its multiplicity.
0602   //!
0603   //! Raised if UIndex is not in the range [FirstUKnotIndex,
0604   //! LastUKnotIndex] given by the methods with the same name.
0605   //!
0606   //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
0607   //! M must be lower than UDegree and greater than the previous
0608   //! multiplicity of the knot of range UIndex.
0609   Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K, const Standard_Integer M);
0610   
0611   //! Substitutes the VKnots of range VIndex with K.
0612   //!
0613   //! Raised if VIndex < 1 or VIndex > NbVKnots
0614   //!
0615   //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
0616   Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K);
0617   
0618   //! Changes all the V-knots of the surface.
0619   //! The multiplicity of the knots are not modified.
0620   //!
0621   //! Raised if there is an index such that VK (Index+1) <= VK (Index).
0622   //!
0623   //! Raised if  VK.Lower() < 1 or VK.Upper() > NbVKnots
0624   Standard_EXPORT void SetVKnots (const TColStd_Array1OfReal& VK);
0625   
0626 
0627   //! Changes the value of the VKnots of range VIndex and increases
0628   //! its multiplicity.
0629   //!
0630   //! Raised if VIndex is not in the range [FirstVKnotIndex,
0631   //! LastVKnotIndex] given by the methods with the same name.
0632   //!
0633   //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
0634   //! M must be lower than VDegree and greater than the previous
0635   //! multiplicity of the knot of range VIndex.
0636   Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K, const Standard_Integer M);
0637   
0638 
0639   //! Locates the parametric value U in the sequence of UKnots.
0640   //! If "WithKnotRepetition" is True we consider the knot's
0641   //! representation with repetition of multiple knot value,
0642   //! otherwise  we consider the knot's representation with
0643   //! no repetition of multiple knot values.
0644   //! UKnots (I1) <= U <= UKnots (I2)
0645   //! . if I1 = I2  U is a knot value (the tolerance criterion
0646   //! ParametricTolerance is used).
0647   //! . if I1 < 1  => U < UKnots(1) - Abs(ParametricTolerance)
0648   //! . if I2 > NbUKnots => U > UKnots(NbUKnots)+Abs(ParametricTolerance)
0649   Standard_EXPORT void LocateU (const Standard_Real U, const Standard_Real ParametricTolerance, Standard_Integer& I1, Standard_Integer& I2, const Standard_Boolean WithKnotRepetition = Standard_False) const;
0650   
0651 
0652   //! Locates the parametric value V in the sequence of knots.
0653   //! If "WithKnotRepetition" is True we consider the knot's
0654   //! representation with repetition of multiple knot value,
0655   //! otherwise  we consider the knot's representation with
0656   //! no repetition of multiple knot values.
0657   //! VKnots (I1) <= V <= VKnots (I2)
0658   //! . if I1 = I2  V is a knot value (the tolerance criterion
0659   //! ParametricTolerance is used).
0660   //! . if I1 < 1  => V < VKnots(1) - Abs(ParametricTolerance)
0661   //! . if I2 > NbVKnots => V > VKnots(NbVKnots)+Abs(ParametricTolerance)
0662   //! poles insertion and removing
0663   //! The following methods are available only if the surface
0664   //! is Uniform or QuasiUniform in the considered direction
0665   //! The knot repartition is modified.
0666   Standard_EXPORT void LocateV (const Standard_Real V, const Standard_Real ParametricTolerance, Standard_Integer& I1, Standard_Integer& I2, const Standard_Boolean WithKnotRepetition = Standard_False) const;
0667   
0668 
0669   //! Substitutes the pole of range (UIndex, VIndex) with P.
0670   //! If the surface is rational the weight of range (UIndex, VIndex)
0671   //! is not modified.
0672   //!
0673   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
0674   //! VIndex > NbVPoles.
0675   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P);
0676   
0677 
0678   //! Substitutes the pole and the weight of range (UIndex, VIndex)
0679   //! with P and W.
0680   //!
0681   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
0682   //! VIndex > NbVPoles.
0683   //! Raised if Weight <= Resolution from package gp.
0684   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P, const Standard_Real Weight);
0685   
0686 
0687   //! Changes a column of poles or a part of this column.
0688   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0689   //!
0690   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles.
0691   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
0692   
0693 
0694   //! Changes a column of poles or a part of this column with the
0695   //! corresponding weights. If the surface was rational it can
0696   //! become non rational. If the surface was non rational it can
0697   //! become rational.
0698   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0699   //!
0700   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
0701   //! Raised if the bounds of CPoleWeights are not the same as the
0702   //! bounds of CPoles.
0703   //! Raised if one of the weight value of CPoleWeights is lower or
0704   //! equal to Resolution from package gp.
0705   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
0706   
0707 
0708   //! Changes a row of poles or a part of this row with the
0709   //! corresponding weights. If the surface was rational it can
0710   //! become non rational. If the surface was non rational it can
0711   //! become rational.
0712   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0713   //!
0714   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
0715   //! raises if the bounds of CPoleWeights are not the same as the
0716   //! bounds of CPoles.
0717   //! Raised if one of the weight value of CPoleWeights is lower or
0718   //! equal to Resolution from package gp.
0719   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
0720   
0721 
0722   //! Changes a row of poles or a part of this row.
0723   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0724   //!
0725   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles.
0726   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
0727   
0728 
0729   //! Changes the weight of the pole of range UIndex, VIndex.
0730   //! If the surface was non rational it can become rational.
0731   //! If the surface was rational it can become non rational.
0732   //!
0733   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
0734   //! VIndex > NbVPoles
0735   //!
0736   //! Raised if weight is lower or equal to Resolution from
0737   //! package gp
0738   Standard_EXPORT void SetWeight (const Standard_Integer UIndex, const Standard_Integer VIndex, const Standard_Real Weight);
0739   
0740 
0741   //! Changes a column of weights of a part of this column.
0742   //!
0743   //! Raised if VIndex < 1 or VIndex > NbVPoles
0744   //!
0745   //! Raised if CPoleWeights.Lower() < 1 or
0746   //! CPoleWeights.Upper() > NbUPoles.
0747   //! Raised if a weight value is lower or equal to Resolution
0748   //! from package gp.
0749   Standard_EXPORT void SetWeightCol (const Standard_Integer VIndex, const TColStd_Array1OfReal& CPoleWeights);
0750   
0751 
0752   //! Changes a row of weights or a part of this row.
0753   //!
0754   //! Raised if UIndex < 1 or UIndex > NbUPoles
0755   //!
0756   //! Raised if CPoleWeights.Lower() < 1 or
0757   //! CPoleWeights.Upper() > NbVPoles.
0758   //! Raised  if a weight value is lower or equal to Resolution
0759   //! from package gp.
0760   Standard_EXPORT void SetWeightRow (const Standard_Integer UIndex, const TColStd_Array1OfReal& CPoleWeights);
0761   
0762   //! Move a point with parameter U and V to P.
0763   //! given u,v  as parameters)  to  reach a  new position
0764   //! UIndex1, UIndex2, VIndex1, VIndex2:
0765   //! indicates the poles which can be moved
0766   //! if Problem in BSplineBasis calculation, no change
0767   //! for the curve and
0768   //! UFirstIndex, VLastIndex = 0
0769   //! VFirstIndex, VLastIndex = 0
0770   //!
0771   //! Raised if UIndex1 < UIndex2 or VIndex1 < VIndex2 or
0772   //! UIndex1 < 1 || UIndex1 > NbUPoles or
0773   //! UIndex2 < 1 || UIndex2 > NbUPoles
0774   //! VIndex1 < 1 || VIndex1 > NbVPoles or
0775   //! VIndex2 < 1 || VIndex2 > NbVPoles
0776   //! characteristics of the surface
0777   Standard_EXPORT void MovePoint (const Standard_Real U, const Standard_Real V, const gp_Pnt& P, const Standard_Integer UIndex1, const Standard_Integer UIndex2, const Standard_Integer VIndex1, const Standard_Integer VIndex2, Standard_Integer& UFirstIndex, Standard_Integer& ULastIndex, Standard_Integer& VFirstIndex, Standard_Integer& VLastIndex);
0778   
0779 
0780   //! Returns true if the first control points row and the last
0781   //! control points row are identical. The tolerance criterion
0782   //! is Resolution from package gp.
0783   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0784   
0785 
0786   //! Returns true if the first control points column and the
0787   //! last last control points column are identical.
0788   //! The tolerance criterion is Resolution from package gp.
0789   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0790   
0791 
0792   //! Returns True if the order of continuity of the surface in the
0793   //! U direction  is N.
0794   //! Raised if N < 0.
0795   Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
0796   
0797 
0798   //! Returns True if the order of continuity of the surface
0799   //! in the V direction  is N.
0800   //! Raised if N < 0.
0801   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
0802   
0803 
0804   //! Returns True if the surface is closed in the U direction
0805   //! and if the B-spline has been turned into a periodic surface
0806   //! using the function SetUPeriodic.
0807   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0808   
0809 
0810   //! Returns False if for each row of weights all the weights
0811   //! are identical.
0812   //! The tolerance criterion is resolution from package gp.
0813   //! Example :
0814   //! |1.0, 1.0, 1.0|
0815   //! if Weights =  |0.5, 0.5, 0.5|   returns False
0816   //! |2.0, 2.0, 2.0|
0817   Standard_EXPORT Standard_Boolean IsURational() const;
0818   
0819 
0820   //! Returns True if the surface is closed in the V direction
0821   //! and if the B-spline has been turned into a periodic
0822   //! surface using the function SetVPeriodic.
0823   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0824   
0825 
0826   //! Returns False if for each column of weights all the weights
0827   //! are identical.
0828   //! The tolerance criterion is resolution from package gp.
0829   //! Examples :
0830   //! |1.0, 2.0, 0.5|
0831   //! if Weights =  |1.0, 2.0, 0.5|   returns False
0832   //! |1.0, 2.0, 0.5|
0833   Standard_EXPORT Standard_Boolean IsVRational() const;
0834   
0835 
0836   //! Returns the parametric bounds of the surface.
0837   //! Warnings :
0838   //! These parametric values are the bounds of the array of
0839   //! knots UKnots and VKnots only if the first knots and the
0840   //! last knots have a multiplicity equal to UDegree + 1 or
0841   //! VDegree + 1
0842   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
0843   
0844 
0845   //! Returns the continuity of the surface :
0846   //! C0 : only geometric continuity,
0847   //! C1 : continuity of the first derivative all along the Surface,
0848   //! C2 : continuity of the second derivative all along the Surface,
0849   //! C3 : continuity of the third derivative all along the Surface,
0850   //! CN : the order of continuity is infinite.
0851   //! A B-spline surface is infinitely continuously differentiable
0852   //! for the couple of parameters U, V such that U != UKnots(i)
0853   //! and V != VKnots(i). The continuity of the surface at a knot
0854   //! value depends on the multiplicity of this knot.
0855   //! Example :
0856   //! If the surface is C1 in the V direction and C2 in the U
0857   //! direction this function returns Shape = C1.
0858   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0859   
0860 
0861   //! Computes the Index of the UKnots which gives the first
0862   //! parametric value of the surface in the U direction.
0863   //! The UIso curve corresponding to this value is a
0864   //! boundary curve of the surface.
0865   Standard_EXPORT Standard_Integer FirstUKnotIndex() const;
0866   
0867 
0868   //! Computes the Index of the VKnots which gives the
0869   //! first parametric value of the surface in the V direction.
0870   //! The VIso curve corresponding to this knot is a boundary
0871   //! curve of the surface.
0872   Standard_EXPORT Standard_Integer FirstVKnotIndex() const;
0873   
0874 
0875   //! Computes the Index of the UKnots which gives the
0876   //! last parametric value of the surface in the U direction.
0877   //! The UIso curve corresponding to this knot is a boundary
0878   //! curve of the surface.
0879   Standard_EXPORT Standard_Integer LastUKnotIndex() const;
0880   
0881 
0882   //! Computes the Index of the VKnots which gives the
0883   //! last parametric value of the surface in the V direction.
0884   //! The VIso curve corresponding to this knot is a
0885   //! boundary curve of the surface.
0886   Standard_EXPORT Standard_Integer LastVKnotIndex() const;
0887   
0888   //! Returns the number of knots in the U direction.
0889   Standard_EXPORT Standard_Integer NbUKnots() const;
0890   
0891   //! Returns number of poles in the U direction.
0892   Standard_EXPORT Standard_Integer NbUPoles() const;
0893   
0894   //! Returns the number of knots in the V direction.
0895   Standard_EXPORT Standard_Integer NbVKnots() const;
0896   
0897   //! Returns the number of poles in the V direction.
0898   Standard_EXPORT Standard_Integer NbVPoles() const;
0899   
0900 
0901   //! Returns the pole of range (UIndex, VIndex).
0902   //!
0903   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
0904   //! VIndex > NbVPoles.
0905   Standard_EXPORT const gp_Pnt& Pole(const Standard_Integer UIndex, const Standard_Integer VIndex) const;
0906   
0907   //! Returns the poles of the B-spline surface.
0908   //!
0909   //! Raised if the length of P in the U and V direction
0910   //! is not equal to NbUpoles and NbVPoles.
0911   Standard_EXPORT void Poles (TColgp_Array2OfPnt& P) const;
0912   
0913   //! Returns the poles of the B-spline surface.
0914   Standard_EXPORT const TColgp_Array2OfPnt& Poles() const;
0915   
0916 
0917   //! Returns the degree of the normalized B-splines Ni,n in the U
0918   //! direction.
0919   Standard_EXPORT Standard_Integer UDegree() const;
0920   
0921 
0922   //! Returns the Knot value of range UIndex.
0923   //! Raised if UIndex < 1 or UIndex > NbUKnots
0924   Standard_EXPORT Standard_Real UKnot (const Standard_Integer UIndex) const;
0925   
0926 
0927   //! Returns NonUniform or Uniform or QuasiUniform or
0928   //! PiecewiseBezier.  If all the knots differ by a
0929   //! positive constant from the preceding knot in the U
0930   //! direction the B-spline surface can be :
0931   //! - Uniform if all the knots are of multiplicity 1,
0932   //! - QuasiUniform if all the knots are of multiplicity 1
0933   //! except for the first and last knot which are of
0934   //! multiplicity Degree + 1,
0935   //! - PiecewiseBezier if the first and last knots have
0936   //! multiplicity Degree + 1 and if interior knots have
0937   //! multiplicity Degree
0938   //! otherwise the surface is non uniform in the U direction
0939   //! The tolerance criterion is Resolution from package gp.
0940   Standard_EXPORT GeomAbs_BSplKnotDistribution UKnotDistribution() const;
0941   
0942   //! Returns the knots in the U direction.
0943   //!
0944   //! Raised if the length of Ku is not equal to the number of knots
0945   //! in the U direction.
0946   Standard_EXPORT void UKnots (TColStd_Array1OfReal& Ku) const;
0947   
0948   //! Returns the knots in the U direction.
0949   Standard_EXPORT const TColStd_Array1OfReal& UKnots() const;
0950   
0951   //! Returns the uknots sequence.
0952   //! In this sequence the knots with a multiplicity greater than 1
0953   //! are repeated.
0954   //! Example :
0955   //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
0956   //!
0957   //! Raised if the length of Ku is not equal to NbUPoles + UDegree + 1
0958   Standard_EXPORT void UKnotSequence (TColStd_Array1OfReal& Ku) const;
0959   
0960   //! Returns the uknots sequence.
0961   //! In this sequence the knots with a multiplicity greater than 1
0962   //! are repeated.
0963   //! Example :
0964   //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
0965   Standard_EXPORT const TColStd_Array1OfReal& UKnotSequence() const;
0966   
0967 
0968   //! Returns the multiplicity value of knot of range UIndex in
0969   //! the u direction.
0970   //! Raised if UIndex < 1 or UIndex > NbUKnots.
0971   Standard_EXPORT Standard_Integer UMultiplicity (const Standard_Integer UIndex) const;
0972   
0973 
0974   //! Returns the multiplicities of the knots in the U direction.
0975   //!
0976   //! Raised if the length of Mu is not equal to the number of
0977   //! knots in the U direction.
0978   Standard_EXPORT void UMultiplicities (TColStd_Array1OfInteger& Mu) const;
0979   
0980   //! Returns the multiplicities of the knots in the U direction.
0981   Standard_EXPORT const TColStd_Array1OfInteger& UMultiplicities() const;
0982   
0983 
0984   //! Returns the degree of the normalized B-splines Ni,d in the
0985   //! V direction.
0986   Standard_EXPORT Standard_Integer VDegree() const;
0987   
0988   //! Returns the Knot value of range VIndex.
0989   //! Raised if VIndex < 1 or VIndex > NbVKnots
0990   Standard_EXPORT Standard_Real VKnot (const Standard_Integer VIndex) const;
0991   
0992 
0993   //! Returns NonUniform or Uniform or QuasiUniform or
0994   //! PiecewiseBezier. If all the knots differ by a positive
0995   //! constant from the preceding knot in the V direction the
0996   //! B-spline surface can be :
0997   //! - Uniform if all the knots are of multiplicity 1,
0998   //! - QuasiUniform if all the knots are of multiplicity 1
0999   //! except for the first and last knot which are of
1000   //! multiplicity Degree + 1,
1001   //! - PiecewiseBezier if the first and last knots have
1002   //! multiplicity  Degree + 1 and if interior knots have
1003   //! multiplicity Degree
1004   //! otherwise the surface is non uniform in the V direction.
1005   //! The tolerance criterion is Resolution from package gp.
1006   Standard_EXPORT GeomAbs_BSplKnotDistribution VKnotDistribution() const;
1007   
1008   //! Returns the knots in the V direction.
1009   //!
1010   //! Raised if the length of Kv is not equal to the number of
1011   //! knots in the V direction.
1012   Standard_EXPORT void VKnots (TColStd_Array1OfReal& Kv) const;
1013   
1014   //! Returns the knots in the V direction.
1015   Standard_EXPORT const TColStd_Array1OfReal& VKnots() const;
1016   
1017   //! Returns the vknots sequence.
1018   //! In this sequence the knots with a multiplicity greater than 1
1019   //! are repeated.
1020   //! Example :
1021   //! Kv = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1022   //!
1023   //! Raised if the length of Kv is not equal to NbVPoles + VDegree + 1
1024   Standard_EXPORT void VKnotSequence (TColStd_Array1OfReal& Kv) const;
1025   
1026   //! Returns the vknots sequence.
1027   //! In this sequence the knots with a multiplicity greater than 1
1028   //! are repeated.
1029   //! Example :
1030   //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1031   Standard_EXPORT const TColStd_Array1OfReal& VKnotSequence() const;
1032   
1033 
1034   //! Returns the multiplicity value of knot of range VIndex in
1035   //! the v direction.
1036   //! Raised if VIndex < 1 or VIndex > NbVKnots
1037   Standard_EXPORT Standard_Integer VMultiplicity (const Standard_Integer VIndex) const;
1038   
1039 
1040   //! Returns the multiplicities of the knots in the V direction.
1041   //!
1042   //! Raised if the length of Mv is not equal to the number of
1043   //! knots in the V direction.
1044   Standard_EXPORT void VMultiplicities (TColStd_Array1OfInteger& Mv) const;
1045   
1046   //! Returns the multiplicities of the knots in the V direction.
1047   Standard_EXPORT const TColStd_Array1OfInteger& VMultiplicities() const;
1048   
1049   //! Returns the weight value of range UIndex, VIndex.
1050   //!
1051   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1
1052   //! or VIndex > NbVPoles.
1053   Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
1054   
1055   //! Returns the weights of the B-spline surface.
1056   //!
1057   //! Raised if the length of W in the U and V direction is
1058   //! not equal to NbUPoles and NbVPoles.
1059   Standard_EXPORT void Weights (TColStd_Array2OfReal& W) const;
1060   
1061   //! Returns the weights of the B-spline surface.
1062   //! value and derivatives computation
1063   Standard_EXPORT const TColStd_Array2OfReal* Weights() const;
1064   
1065   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
1066   
1067   //! Raised if the continuity of the surface is not C1.
1068   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
1069   
1070   //! Raised if the continuity of the surface is not C2.
1071   Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
1072   
1073   //! Raised if the continuity of the surface is not C3.
1074   Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
1075   
1076 
1077   //! Nu is the order of derivation in the U parametric direction and
1078   //! Nv is the order of derivation in the V parametric direction.
1079   //!
1080   //! Raised if the continuity of the surface is not CNu in the U
1081   //! direction and CNv in the V direction.
1082   //!
1083   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
1084   //!
1085   //! The following functions computes the point for the
1086   //! parametric values (U, V) and the derivatives at
1087   //! this point on the B-spline surface patch delimited
1088   //! with the knots FromUK1, FromVK1 and the knots ToUK2,
1089   //! ToVK2.  (U, V) can be out of these parametric bounds
1090   //! but for the computation we only use the definition
1091   //! of the surface between these knots. This method is
1092   //! useful to compute local derivative, if the order of
1093   //! continuity of the whole surface is not greater enough.
1094   //! Inside the parametric knot's domain previously defined
1095   //! the evaluations are the same as if we consider the whole
1096   //! definition of the surface. Of course the evaluations are
1097   //! different outside this parametric domain.
1098   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
1099   
1100   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1101   Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P) const;
1102   
1103 
1104   //! Raised if the local continuity of the surface is not C1
1105   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1106   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1107   Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
1108   
1109 
1110   //! Raised if the local continuity of the surface is not C2
1111   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1112   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1113   Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
1114   
1115 
1116   //! Raised if the local continuity of the surface is not C3
1117   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1118   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1119   Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
1120   
1121 
1122   //! Raised if the local continuity of the surface is not CNu
1123   //! between the knots FromUK1, ToUK2 and CNv between the knots
1124   //! FromVK1, ToVK2.
1125   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1126   Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, const Standard_Integer Nu, const Standard_Integer Nv) const;
1127   
1128 
1129   //! Computes the point of parameter U, V on the BSpline surface patch
1130   //! defines between the knots UK1 UK2, VK1, VK2. U can be out of the
1131   //! bounds [Knot UK1, Knot UK2] and V can be outof the bounds
1132   //! [Knot VK1, Knot VK2]  but for the computation we only use the
1133   //! definition of the surface between these knot values.
1134   //! Raises if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1135   Standard_EXPORT gp_Pnt LocalValue (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2) const;
1136   
1137 
1138   //! Computes the U isoparametric curve.
1139   //! A B-spline curve is returned.
1140   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
1141   
1142 
1143   //! Computes the V isoparametric curve.
1144   //! A B-spline curve is returned.
1145   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
1146   
1147 
1148   //! Computes the U isoparametric curve.
1149   //! If CheckRational=False, no try to make it non-rational.
1150   //! A B-spline curve is returned.
1151   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U, const Standard_Boolean CheckRational) const;
1152   
1153 
1154   //! Computes the V isoparametric curve.
1155   //! If CheckRational=False, no try to make it non-rational.
1156   //! A B-spline curve is returned.
1157   //! transformations
1158   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V, const Standard_Boolean CheckRational) const;
1159   
1160   //! Applies the transformation T to this BSpline surface.
1161   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
1162   
1163 
1164   //! Returns the value of the maximum degree of the normalized
1165   //! B-spline basis functions in the u and v directions.
1166   Standard_EXPORT static Standard_Integer MaxDegree();
1167   
1168   //! Computes two tolerance values for this BSpline
1169   //! surface, based on the given tolerance in 3D space
1170   //! Tolerance3D. The tolerances computed are:
1171   //! - UTolerance in the u parametric direction, and
1172   //! - VTolerance in the v parametric direction.
1173   //! If f(u,v) is the equation of this BSpline surface,
1174   //! UTolerance and VTolerance guarantee that :
1175   //! | u1 - u0 | < UTolerance and
1176   //! | v1 - v0 | < VTolerance
1177   //! ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D
1178   Standard_EXPORT void Resolution (const Standard_Real Tolerance3D, Standard_Real& UTolerance, Standard_Real& VTolerance);
1179   
1180   //! Creates a new object which is a copy of this BSpline surface.
1181   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
1182 
1183   //! Dumps the content of me into the stream
1184   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
1185 
1186 
1187 
1188 
1189   DEFINE_STANDARD_RTTIEXT(Geom_BSplineSurface,Geom_BoundedSurface)
1190 
1191 protected:
1192 
1193   //! Segments the surface between U1 and U2 in the U-Direction.
1194   //! between V1 and V2 in the V-Direction.
1195   //! The control points are modified, the first and the last point
1196   //! are not the same.
1197   //!
1198   //! Parameters EpsU, EpsV define the proximity along U-Direction and V-Direction respectively.
1199   void segment(const Standard_Real U1, const Standard_Real U2,
1200                const Standard_Real V1, const Standard_Real V2,
1201                const Standard_Real EpsU, const Standard_Real EpsV,
1202                const Standard_Boolean SegmentInU, const Standard_Boolean SegmentInV);
1203 
1204 
1205 private:
1206 
1207   
1208   //! Recompute  the  flatknots,  the knotsdistribution, the
1209   //! continuity for U.
1210   Standard_EXPORT void UpdateUKnots();
1211   
1212   //! Recompute  the  flatknots,  the knotsdistribution, the
1213   //! continuity for V.
1214   Standard_EXPORT void UpdateVKnots();
1215 
1216   Standard_Boolean urational;
1217   Standard_Boolean vrational;
1218   Standard_Boolean uperiodic;
1219   Standard_Boolean vperiodic;
1220   GeomAbs_BSplKnotDistribution uknotSet;
1221   GeomAbs_BSplKnotDistribution vknotSet;
1222   GeomAbs_Shape Usmooth;
1223   GeomAbs_Shape Vsmooth;
1224   Standard_Integer udeg;
1225   Standard_Integer vdeg;
1226   Handle(TColgp_HArray2OfPnt) poles;
1227   Handle(TColStd_HArray2OfReal) weights;
1228   Handle(TColStd_HArray1OfReal) ufknots;
1229   Handle(TColStd_HArray1OfReal) vfknots;
1230   Handle(TColStd_HArray1OfReal) uknots;
1231   Handle(TColStd_HArray1OfReal) vknots;
1232   Handle(TColStd_HArray1OfInteger) umults;
1233   Handle(TColStd_HArray1OfInteger) vmults;
1234   Standard_Real umaxderivinv;
1235   Standard_Real vmaxderivinv;
1236   Standard_Boolean maxderivinvok;
1237 
1238 
1239 };
1240 
1241 
1242 
1243 
1244 
1245 
1246 
1247 #endif // _Geom_BSplineSurface_HeaderFile