0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BSplSLib / BSplSLib_BzSyntaxes.cxx
CommitLineData
b311480e 1// Created on: 1995-10-27
2// Created by: Laurent BOURESCHE
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17// pmn 16-10-96 : Correction de PolesCoefficient (PRO5782)
18// ColLength et RowLength avaient encore frappes !!
7fd59977 19
20#define No_Standard_RangeError
21#define No_Standard_OutOfRange
22
23#include <BSplSLib.hxx>
24#include <BSplCLib.hxx>
25#include <TColStd_Array1OfReal.hxx>
26
27//=======================================================================
28//function : PolesCoefficients
29//purpose :
30//=======================================================================
31
32void BSplSLib::PolesCoefficients (const TColgp_Array2OfPnt& Poles,
0e14656b 33 const TColStd_Array2OfReal* Weights,
7fd59977 34 TColgp_Array2OfPnt& CachePoles,
0e14656b 35 TColStd_Array2OfReal* CacheWeights)
7fd59977 36{
37 Standard_Integer i;
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);
42
43 for(i = 1; i <= uclas; i++) {
44 biduflatknots(i ) = 0.;
45 biduflatknots(i + uclas) = 1.;
46 }
47
48 for(i = 1; i <= vclas; i++) {
49 bidvflatknots(i ) = 0.;
50 bidvflatknots(i + vclas) = 1.;
51 }
52 if ( uclas > vclas) {
53 BSplSLib::BuildCache(0.,0.,
54 1.,1.,0,0,
55 uclas - 1,vclas - 1,0,0,
56 biduflatknots,bidvflatknots,
57 Poles,Weights,
58 CachePoles,CacheWeights);
59 }
60 else {
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.,
66 1.,1.,0,0,
67 uclas - 1,vclas - 1,0,0,
68 biduflatknots,bidvflatknots,
69 Poles,Weights,
0e14656b 70 CPoles,&CWeights);
71 if (Weights == NULL) {
7fd59977 72
73 for (ii = 1; ii <= uclas; ii++) {
74
75 for (jj = 1; jj <= vclas; jj++) {
76 CachePoles(ii, jj) = CPoles(jj, ii);
77 }
78 }
79 }
80 else {
81
82 for (ii = 1; ii <= uclas; ii++) {
83
84 for (jj = 1; jj <= vclas; jj++) {
85 CachePoles (ii, jj) = CPoles (jj, ii);
0e14656b 86 (*CacheWeights)(ii, jj) = CWeights(jj, ii);
7fd59977 87 }
88 }
89 }
90 }
91}
92