Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BSplSLib / BSplSLib_BzSyntaxes.cxx
CommitLineData
7fd59977 1// File: BSplSLib_BzSyntaxes.cxx
2// Created: Fri Oct 27 12:49:43 1995
3// Author: Laurent BOURESCHE
4// <lbo@phylox>
5
6// pmn 16-10-96 : Correction de PolesCoefficient (PRO5782)
7// ColLength et RowLength avaient encore frappes !!
8//
9
10#define No_Standard_RangeError
11#define No_Standard_OutOfRange
12
13#include <BSplSLib.hxx>
14#include <BSplCLib.hxx>
15#include <TColStd_Array1OfReal.hxx>
16
17//=======================================================================
18//function : PolesCoefficients
19//purpose :
20//=======================================================================
21
22void BSplSLib::PolesCoefficients (const TColgp_Array2OfPnt& Poles,
23 const TColStd_Array2OfReal& Weights,
24 TColgp_Array2OfPnt& CachePoles,
25 TColStd_Array2OfReal& CacheWeights)
26{
27 Standard_Integer i;
28 Standard_Integer uclas = Poles.ColLength();
29 Standard_Integer vclas = Poles.RowLength();
30 TColStd_Array1OfReal biduflatknots(1,uclas << 1);
31 TColStd_Array1OfReal bidvflatknots(1,vclas << 1);
32
33 for(i = 1; i <= uclas; i++) {
34 biduflatknots(i ) = 0.;
35 biduflatknots(i + uclas) = 1.;
36 }
37
38 for(i = 1; i <= vclas; i++) {
39 bidvflatknots(i ) = 0.;
40 bidvflatknots(i + vclas) = 1.;
41 }
42 if ( uclas > vclas) {
43 BSplSLib::BuildCache(0.,0.,
44 1.,1.,0,0,
45 uclas - 1,vclas - 1,0,0,
46 biduflatknots,bidvflatknots,
47 Poles,Weights,
48 CachePoles,CacheWeights);
49 }
50 else {
51 // BuilCache exige que les resultats soient formates en [MaxCoeff,MinCoeff]
52 TColgp_Array2OfPnt CPoles (1,vclas, 1, uclas);
53 TColStd_Array2OfReal CWeights(1,vclas, 1, uclas);
54 Standard_Integer ii, jj;
55 BSplSLib::BuildCache(0.,0.,
56 1.,1.,0,0,
57 uclas - 1,vclas - 1,0,0,
58 biduflatknots,bidvflatknots,
59 Poles,Weights,
60 CPoles,CWeights);
61 if (&Weights == NULL) {
62
63 for (ii = 1; ii <= uclas; ii++) {
64
65 for (jj = 1; jj <= vclas; jj++) {
66 CachePoles(ii, jj) = CPoles(jj, ii);
67 }
68 }
69 }
70 else {
71
72 for (ii = 1; ii <= uclas; ii++) {
73
74 for (jj = 1; jj <= vclas; jj++) {
75 CachePoles (ii, jj) = CPoles (jj, ii);
76 CacheWeights(ii, jj) = CWeights(jj, ii);
77 }
78 }
79 }
80 }
81}
82