1 // Created on: 1995-10-27
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // pmn 16-10-96 : Correction de PolesCoefficient (PRO5782)
18 // ColLength et RowLength avaient encore frappes !!
20 #define No_Standard_RangeError
21 #define No_Standard_OutOfRange
23 #include <BSplSLib.hxx>
24 #include <BSplCLib.hxx>
25 #include <TColStd_Array1OfReal.hxx>
27 //=======================================================================
28 //function : PolesCoefficients
30 //=======================================================================
32 void BSplSLib::PolesCoefficients (const TColgp_Array2OfPnt& Poles,
33 const TColStd_Array2OfReal* Weights,
34 TColgp_Array2OfPnt& CachePoles,
35 TColStd_Array2OfReal* CacheWeights)
38 Standard_Integer uclas = Poles.ColLength();
39 Standard_Integer vclas = Poles.RowLength();
40 TColStd_Array1OfReal biduflatknots(1,uclas << 1);
41 TColStd_Array1OfReal bidvflatknots(1,vclas << 1);
43 for(i = 1; i <= uclas; i++) {
44 biduflatknots(i ) = 0.;
45 biduflatknots(i + uclas) = 1.;
48 for(i = 1; i <= vclas; i++) {
49 bidvflatknots(i ) = 0.;
50 bidvflatknots(i + vclas) = 1.;
53 BSplSLib::BuildCache(0.,0.,
55 uclas - 1,vclas - 1,0,0,
56 biduflatknots,bidvflatknots,
58 CachePoles,CacheWeights);
61 // BuilCache exige que les resultats soient formates en [MaxCoeff,MinCoeff]
62 TColgp_Array2OfPnt CPoles (1,vclas, 1, uclas);
63 TColStd_Array2OfReal CWeights(1,vclas, 1, uclas);
64 Standard_Integer ii, jj;
65 BSplSLib::BuildCache(0.,0.,
67 uclas - 1,vclas - 1,0,0,
68 biduflatknots,bidvflatknots,
71 if (Weights == NULL) {
73 for (ii = 1; ii <= uclas; ii++) {
75 for (jj = 1; jj <= vclas; jj++) {
76 CachePoles(ii, jj) = CPoles(jj, ii);
82 for (ii = 1; ii <= uclas; ii++) {
84 for (jj = 1; jj <= vclas; jj++) {
85 CachePoles (ii, jj) = CPoles (jj, ii);
86 (*CacheWeights)(ii, jj) = CWeights(jj, ii);