-// File: Geom_BezierSurface.cxx
-// Created: Tue Mar 9 19:52:37 1993
-// Author: JCV
-// <fid@phylox>
-// Copyright: Matra Datavision 1993
+// Created on: 1993-03-09
+// Created by: JCV
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-//File Geom_BezierSurface.cxx Septembre 1990
//Passage en classe persistante - 23/01/91
//Modif suite a la deuxieme revue de projet toolkit Geometry -23/01/91
// pmn : 21/10/95 ; Correction de la methode segment (PRO5853)
#define No_Standard_OutOfRange
#define No_Standard_DimensionError
-#include <Geom_BezierSurface.ixx>
-#include <Geom_BezierCurve.hxx>
+#include <BSplCLib.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Geometry.hxx>
#include <gp.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <PLib.hxx>
-#include <BSplCLib.hxx>
-#include <BSplSLib.hxx>
#include <Precision.hxx>
-
+#include <Standard_ConstructionError.hxx>
+#include <Standard_DimensionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_RangeError.hxx>
-#include <Standard_DimensionError.hxx>
-#include <Standard_ConstructionError.hxx>
+#include <Standard_Type.hxx>
#include <TColStd_Array1OfInteger.hxx>
//=======================================================================
//function : Rational
//purpose : check rationality of an array of weights
//=======================================================================
-
static void Rational(const TColStd_Array2OfReal& Weights,
Standard_Boolean& Urational,
Standard_Boolean& Vrational)
Geom_BezierSurface::Geom_BezierSurface
(const TColgp_Array2OfPnt& SurfacePoles):
- ucacheparameter(0.),
- vcacheparameter(0.),
- ucachespanlenght(1.),
- vcachespanlenght(1.),
- validcache(0),
maxderivinvok(Standard_False)
{
Standard_Integer NbUPoles = SurfacePoles.ColLength();
Geom_BezierSurface::Geom_BezierSurface
(const TColgp_Array2OfPnt& SurfacePoles,
const TColStd_Array2OfReal& PoleWeights ):
- ucacheparameter(0.),
- vcacheparameter(0.),
- ucachespanlenght(1.),
- vcachespanlenght(1.),
- validcache(0),
maxderivinvok(Standard_False)
{
Standard_Integer NbUPoles = SurfacePoles.ColLength();
Geom_BezierSurface::Geom_BezierSurface
(const Handle(TColgp_HArray2OfPnt)& SurfacePoles,
- const Handle(TColgp_HArray2OfPnt)& SurfaceCoefs,
const Handle(TColStd_HArray2OfReal)& PoleWeights,
- const Handle(TColStd_HArray2OfReal)& CoefWeights,
const Standard_Boolean IsURational,
const Standard_Boolean IsVRational)
:maxderivinvok(Standard_False)
{
urational = IsURational;
vrational = IsVRational;
- ucachespanlenght = 1.;
- vcachespanlenght = 1.;
- validcache = 1;
- ucacheparameter =0.;
- vcacheparameter = 0.;
Standard_Integer NbUPoles = SurfacePoles->ColLength();
Standard_Integer NbVPoles = SurfacePoles->RowLength();
1,NbVPoles) ;
poles->ChangeArray2() = SurfacePoles->Array2();
- coeffs = new TColgp_HArray2OfPnt (1,SurfaceCoefs->ColLength(),
- 1,SurfaceCoefs->RowLength()) ;
- coeffs->ChangeArray2() = SurfaceCoefs->Array2();
-
if ( urational || vrational) {
weights = new TColStd_HArray2OfReal (1,NbUPoles,1,NbVPoles);
weights->ChangeArray2() = PoleWeights->Array2();
-
- wcoeffs = new TColStd_HArray2OfReal (1,SurfaceCoefs->ColLength(),
- 1,SurfaceCoefs->RowLength()) ;
- wcoeffs->ChangeArray2() = CoefWeights->Array2();
}
}
Standard_Boolean temp = urational;
urational = vrational;
vrational = temp;
- coeffs = new TColgp_HArray2OfPnt (LC, UC, LR, UR);
- wcoeffs = new TColStd_HArray2OfReal (LC, UC, LR, UR);
-
- UpdateCoefficients();
}
//=======================================================================
BSplSLib::IncreaseDegree(1, oldUDeg, UDeg, 0,
poles->Array2(),
- weights->Array2(),
+ &weights->Array2(),
biduknots, bidumults,
npoles->ChangeArray2(),
- nweights->ChangeArray2(),
+ &nweights->ChangeArray2(),
biduknots, bidumults);
weights = nweights;
}
else {
BSplSLib::IncreaseDegree(1, oldUDeg, UDeg, 0,
poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
+ BSplSLib::NoWeights(),
biduknots, bidumults,
npoles->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL),
+ BSplSLib::NoWeights(),
biduknots, bidumults);
}
poles = npoles;
BSplSLib::IncreaseDegree(0, oldVDeg, VDeg, 0,
poles->Array2(),
- weights->Array2(),
+ &weights->Array2(),
bidvknots, bidvmults,
npoles->ChangeArray2(),
- nweights->ChangeArray2(),
+ &nweights->ChangeArray2(),
bidvknots, bidvmults);
weights = nweights;
}
else {
BSplSLib::IncreaseDegree(0, oldVDeg, VDeg, 0,
poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
+ BSplSLib::NoWeights(),
bidvknots, bidvmults,
npoles->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL),
+ BSplSLib::NoWeights(),
bidvknots, bidvmults);
}
}
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
- UpdateCoefficients();
}
//=======================================================================
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
Rational(weights->Array2(), urational, vrational);
-
- UpdateCoefficients();
}
//=======================================================================
}
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
-
- UpdateCoefficients();
}
//=======================================================================
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
Rational(weights->Array2(), urational, vrational);
-
- UpdateCoefficients();
}
//=======================================================================
}
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
- UpdateCoefficients();
}
//=======================================================================
}
poles = npoles;
weights = nweights;
- coeffs = new TColgp_HArray2OfPnt(1,poles->ColLength(),
- 1,poles->RowLength());
- wcoeffs = new TColStd_HArray2OfReal(1,poles->ColLength(),
- 1,poles->RowLength());
- UpdateCoefficients();
}
//=======================================================================
Handle(TColgp_HArray2OfPnt) Coefs;
Handle(TColStd_HArray2OfReal) WCoefs;
- if (validcache == 0) UpdateCoefficients(0., 0.);
+ Standard_Integer aMinDegree = UDegree() <= VDegree() ? UDegree() : VDegree();
+ Standard_Integer aMaxDegree = UDegree() > VDegree() ? UDegree() : VDegree();
+ Coefs = new TColgp_HArray2OfPnt(1, aMaxDegree + 1, 1, aMinDegree + 1);
+ if (rat)
+ WCoefs = new TColStd_HArray2OfReal(1, aMaxDegree + 1, 1, aMinDegree + 1);
+
+ TColStd_Array1OfReal biduflatknots(BSplCLib::FlatBezierKnots(UDegree()), 1, 2 * (UDegree() + 1));
+ TColStd_Array1OfReal bidvflatknots(BSplCLib::FlatBezierKnots(VDegree()), 1, 2 * (VDegree() + 1));
+
+ Standard_Real uparameter_11 = 0.5;
+ Standard_Real uspanlenght_11 = 0.5;
+ Standard_Real vparameter_11 = 0.5;
+ Standard_Real vspanlenght_11 = 0.5;
+
+ if (urational || vrational) {
+ BSplSLib::BuildCache(uparameter_11, vparameter_11,
+ uspanlenght_11, vspanlenght_11, 0, 0,
+ UDegree(), VDegree(), 0, 0,
+ biduflatknots, bidvflatknots,
+ poles->Array2(),
+ &weights->Array2(),
+ Coefs->ChangeArray2(),
+ &WCoefs->ChangeArray2());
+ }
+ else {
+ BSplSLib::BuildCache(uparameter_11, vparameter_11,
+ uspanlenght_11, vspanlenght_11, 0, 0,
+ UDegree(), VDegree(), 0, 0,
+ biduflatknots, bidvflatknots,
+ poles->Array2(),
+ BSplSLib::NoWeights(),
+ Coefs->ChangeArray2(),
+ BSplSLib::NoWeights());
+ }
// Attention si udeg <= vdeg u et v sont intervertis
// dans les coeffs, il faut donc tout transposer.
if(UDegree() <= VDegree()) {
+ Handle(TColgp_HArray2OfPnt) coeffs = Coefs;
+ Handle(TColStd_HArray2OfReal) wcoeffs = WCoefs;
Standard_Integer ii, jj;
Coefs = new (TColgp_HArray2OfPnt)(1,UDegree()+1,1,VDegree()+1);
if (rat) {
if (rat) WCoefs->SetValue(ii, jj, wcoeffs->Value(jj,ii));
}
}
- else {
- Coefs = coeffs;
- if (rat) {WCoefs = wcoeffs;}
- }
// Trim dans la base cannonique et Update des Poles et Coeffs
vlast = 2*(V2 - 0.5);
if (rat) {
PLib::UTrimming (ufirst, ulast, Coefs->ChangeArray2(),
- WCoefs->ChangeArray2());
+ &WCoefs->ChangeArray2());
PLib::VTrimming (vfirst, vlast, Coefs->ChangeArray2(),
- WCoefs->ChangeArray2());
+ &WCoefs->ChangeArray2());
PLib::CoefficientsPoles(Coefs->Array2(),
- WCoefs->Array2(),
+ &WCoefs->Array2(),
poles->ChangeArray2(),
- weights->ChangeArray2());
+ &weights->ChangeArray2());
}
else {
- PLib::UTrimming (ufirst, ulast, Coefs->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL));
- PLib::VTrimming (vfirst, vlast, Coefs->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL));
- PLib::CoefficientsPoles (Coefs->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- poles->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL));
+ PLib::UTrimming (ufirst, ulast, Coefs->ChangeArray2(), PLib::NoWeights2());
+ PLib::VTrimming (vfirst, vlast, Coefs->ChangeArray2(), PLib::NoWeights2());
+ PLib::CoefficientsPoles (Coefs->Array2(), PLib::NoWeights2(),
+ poles->ChangeArray2(), PLib::NoWeights2());
}
- UpdateCoefficients();
}
//=======================================================================
VIndex > Poles.RowLength() ) Standard_OutOfRange::Raise();
Poles (UIndex, VIndex) = P;
- UpdateCoefficients();
}
//=======================================================================
for (Standard_Integer I = CPoles.Lower(); I <= CPoles.Upper(); I++) {
Poles (I, VIndex) = CPoles (I);
}
-
- UpdateCoefficients();
}
//=======================================================================
for (Standard_Integer I = CPoles.Lower(); I <= CPoles.Upper(); I++) {
Poles (UIndex, I) = CPoles (I);
}
- UpdateCoefficients();
}
//=======================================================================
Standard_Boolean wasrat = (urational||vrational);
if (!wasrat) {
// a weight of 1. does not turn to rational
- if (Abs(Weight - 1.) <= gp::Resolution()) {
- UpdateCoefficients(); //Pour l'appel via SetPole
+ if (Abs(Weight - 1.) <= gp::Resolution())
return;
- }
-
+
// set weights of 1.
weights = new TColStd_HArray2OfReal (1, poles->ColLength(),
1, poles->RowLength(), 1.);
- wcoeffs = new TColStd_HArray2OfReal (1, poles->ColLength(),
- 1, poles->RowLength());
}
TColStd_Array2OfReal & Weights = weights->ChangeArray2();
}
// is it turning into non rational
- if (wasrat) {
- if (!(urational || vrational)) {
- weights.Nullify();
- wcoeffs.Nullify();
- }
- }
-
- UpdateCoefficients(); //Dans tous cas :Attention a SetPoleCol !
+ if (wasrat && !(urational || vrational))
+ weights.Nullify();
}
//=======================================================================
// set weights of 1.
weights = new TColStd_HArray2OfReal (1, poles->ColLength(),
1, poles->RowLength(), 1.);
- wcoeffs = new TColStd_HArray2OfReal (1, poles->ColLength(),
- 1, poles->RowLength());
}
TColStd_Array2OfReal & Weights = weights->ChangeArray2();
Rational(Weights, urational, vrational);
// is it turning into non rational
- if (wasrat) {
- if (!(urational || vrational)) {
- weights.Nullify();
- wcoeffs.Nullify();
- }
- }
-
- UpdateCoefficients();
+ if (wasrat && !(urational || vrational))
+ weights.Nullify();
}
//=======================================================================
// set weights of 1.
weights = new TColStd_HArray2OfReal (1, poles->ColLength(),
1, poles->RowLength(), 1.);
- wcoeffs = new TColStd_HArray2OfReal (1, poles->ColLength(),
- 1, poles->RowLength());
}
TColStd_Array2OfReal & Weights = weights->ChangeArray2();
Rational(Weights, urational, vrational);
// is it turning into non rational
- if (wasrat) {
- if (!(urational || vrational)) {
- weights.Nullify();
- wcoeffs.Nullify();
- }
- }
-
- UpdateCoefficients();
+ if (wasrat && !(urational || vrational))
+ weights.Nullify();
}
//=======================================================================
}
}
}
- UpdateCoefficients();
}
//=======================================================================
}
}
}
- UpdateCoefficients();
}
//=======================================================================
const Standard_Real V,
gp_Pnt& P ) const
{
-
- if (validcache == 1) {
- //
- // XAB : cet algorithme devient instable pour les hauts degres
- // RBD : Beaucoup moins maintenant avec le calcul d'un nouveau cache
- // sur [-1,1].
- //
- Standard_Real uparameter_11 = (2*ucacheparameter + ucachespanlenght)/2,
- uspanlenght_11 = ucachespanlenght/2,
- vparameter_11 = (2*vcacheparameter + vcachespanlenght)/2,
- vspanlenght_11 = vcachespanlenght/2 ;
- if (urational || vrational) {
- BSplSLib::CacheD0(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- wcoeffs->Array2(),
- P);
- }
- else {
- BSplSLib::CacheD0(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- P);
- }
+ Standard_Real array_u[2];
+ Standard_Real array_v[2];
+ Standard_Integer mult_u[2];
+ Standard_Integer mult_v[2];
+ TColStd_Array1OfReal biduknots(array_u[0], 1, 2); biduknots(1) = 0.; biduknots(2) = 1.;
+ TColStd_Array1OfInteger bidumults(mult_u[0], 1, 2); bidumults.Init(UDegree() + 1);
+ TColStd_Array1OfReal bidvknots(array_v[0], 1, 2); bidvknots(1) = 0.; bidvknots(2) = 1.;
+ TColStd_Array1OfInteger bidvmults(mult_v[0], 1, 2); bidvmults.Init(VDegree() + 1);
+ if (urational || vrational) {
+ BSplSLib::D0(U, V, 1, 1, poles->Array2(),
+ &weights->Array2(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P);
}
else {
- Standard_Real array_u[2] ;
- Standard_Real array_v[2] ;
- Standard_Integer mult_u[2] ;
- Standard_Integer mult_v[2] ;
- TColStd_Array1OfReal biduknots(array_u[0],1,2); biduknots(1) = 0.; biduknots(2) = 1.;
- TColStd_Array1OfInteger bidumults(mult_u[0],1,2); bidumults.Init(UDegree() + 1);
- TColStd_Array1OfReal bidvknots(array_v[0],1,2); bidvknots(1) = 0.; bidvknots(2) = 1.;
- TColStd_Array1OfInteger bidvmults(mult_v[0],1,2); bidvmults.Init(VDegree() + 1);
- if (urational || vrational) {
- BSplSLib::D0(U, V, 1,1,poles->Array2(),
- weights->Array2(),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P) ;
- }
- else {
-
- BSplSLib::D0(U, V, 1,1,poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P) ;
- }
+
+ BSplSLib::D0(U, V, 1, 1, poles->Array2(),
+ BSplSLib::NoWeights(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P);
}
}
gp_Vec& D1U,
gp_Vec& D1V ) const
{
-
- if (validcache == 1) {
- //
- // XAB : cet algorithme devient instable pour les hauts degres
- // RBD : Beaucoup moins maintenant avec le calcul d'un nouveau cache
- // sur [-1,1].
- //
- Standard_Real uparameter_11 = (2*ucacheparameter + ucachespanlenght)/2,
- uspanlenght_11 = ucachespanlenght/2,
- vparameter_11 = (2*vcacheparameter + vcachespanlenght)/2,
- vspanlenght_11 = vcachespanlenght/2 ;
- if (urational || vrational) {
- BSplSLib::CacheD1(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- wcoeffs->Array2(),
- P, D1U, D1V);
- }
- else {
- BSplSLib::CacheD1(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- P, D1U, D1V);
- }
+ Standard_Real array_u[2];
+ Standard_Real array_v[2];
+ Standard_Integer mult_u[2];
+ Standard_Integer mult_v[2];
+ TColStd_Array1OfReal biduknots(array_u[0], 1, 2); biduknots(1) = 0.; biduknots(2) = 1.;
+ TColStd_Array1OfInteger bidumults(mult_u[0], 1, 2); bidumults.Init(UDegree() + 1);
+ TColStd_Array1OfReal bidvknots(array_v[0], 1, 2); bidvknots(1) = 0.; bidvknots(2) = 1.;
+ TColStd_Array1OfInteger bidvmults(mult_v[0], 1, 2); bidvmults.Init(VDegree() + 1);
+ if (urational || vrational) {
+ BSplSLib::D1(U, V, 1, 1, poles->Array2(),
+ &weights->Array2(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P, D1U, D1V);
}
else {
- Standard_Real array_u[2] ;
- Standard_Real array_v[2] ;
- Standard_Integer mult_u[2] ;
- Standard_Integer mult_v[2] ;
- TColStd_Array1OfReal biduknots(array_u[0],1,2); biduknots(1) = 0.; biduknots(2) = 1.;
- TColStd_Array1OfInteger bidumults(mult_u[0],1,2); bidumults.Init(UDegree() + 1);
- TColStd_Array1OfReal bidvknots(array_v[0],1,2); bidvknots(1) = 0.; bidvknots(2) = 1.;
- TColStd_Array1OfInteger bidvmults(mult_v[0],1,2); bidvmults.Init(VDegree() + 1);
- if (urational || vrational) {
- BSplSLib::D1(U, V, 1,1,poles->Array2(),
- weights->Array2(),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P,D1U, D1V) ;
- }
- else {
- BSplSLib::D1(U, V, 1,1,poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P,D1U, D1V) ;
- }
+ BSplSLib::D1(U, V, 1, 1, poles->Array2(),
+ BSplSLib::NoWeights(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P, D1U, D1V);
}
}
gp_Vec& D1U, gp_Vec& D1V,
gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV ) const
{
-
- if (validcache == 1) {
- //
- // XAB : cet algorithme devient instable pour les hauts degres
- // RBD : Beaucoup moins maintenant avec le calcul d'un nouveau cache
- // sur [-1,1].
- //
- Standard_Real uparameter_11 = (2*ucacheparameter + ucachespanlenght)/2,
- uspanlenght_11 = ucachespanlenght/2,
- vparameter_11 = (2*vcacheparameter + vcachespanlenght)/2,
- vspanlenght_11 = vcachespanlenght/2 ;
- if (urational || vrational) {
- //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
- BSplSLib::CacheD2(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- wcoeffs->Array2(),
- P, D1U, D1V, D2U, D2UV , D2V);
- }
- else {
- //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
- BSplSLib::CacheD2(U, V, UDegree(), VDegree(),
- uparameter_11, vparameter_11,
- uspanlenght_11, vspanlenght_11,
- coeffs->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- P, D1U, D1V, D2U, D2UV , D2V);
- }
+ Standard_Real array_u[2];
+ Standard_Real array_v[2];
+ Standard_Integer mult_u[2];
+ Standard_Integer mult_v[2];
+ TColStd_Array1OfReal biduknots(array_u[0], 1, 2); biduknots(1) = 0.; biduknots(2) = 1.;
+ TColStd_Array1OfInteger bidumults(mult_u[0], 1, 2); bidumults.Init(UDegree() + 1);
+ TColStd_Array1OfReal bidvknots(array_v[0], 1, 2); bidvknots(1) = 0.; bidvknots(2) = 1.;
+ TColStd_Array1OfInteger bidvmults(mult_v[0], 1, 2); bidvmults.Init(VDegree() + 1);
+ if (urational || vrational) {
+ //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
+ BSplSLib::D2(U, V, 1, 1, poles->Array2(),
+ &weights->Array2(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P, D1U, D1V, D2U, D2V, D2UV);
}
else {
- Standard_Real array_u[2] ;
- Standard_Real array_v[2] ;
- Standard_Integer mult_u[2] ;
- Standard_Integer mult_v[2] ;
- TColStd_Array1OfReal biduknots(array_u[0],1,2); biduknots(1) = 0.; biduknots(2) = 1.;
- TColStd_Array1OfInteger bidumults(mult_u[0],1,2); bidumults.Init(UDegree() + 1);
- TColStd_Array1OfReal bidvknots(array_v[0],1,2); bidvknots(1) = 0.; bidvknots(2) = 1.;
- TColStd_Array1OfInteger bidvmults(mult_v[0],1,2); bidvmults.Init(VDegree() + 1);
- if (urational || vrational) {
- //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
- BSplSLib::D2(U, V, 1,1,poles->Array2(),
- weights->Array2(),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P,D1U, D1V, D2U, D2V , D2UV) ;
- }
- else {
- //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
- BSplSLib::D2(U, V, 1,1,poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- biduknots,bidvknots,bidumults,bidvmults,
- UDegree(),VDegree(),
- urational,vrational,Standard_False,Standard_False,
- P,D1U, D1V, D2U, D2V, D2UV ) ;
- }
+ //-- ATTENTION a l'ORDRE d'appel ds BSPLSLIB
+ BSplSLib::D2(U, V, 1, 1, poles->Array2(),
+ BSplSLib::NoWeights(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
+ UDegree(), VDegree(),
+ urational, vrational, Standard_False, Standard_False,
+ P, D1U, D1V, D2U, D2V, D2UV);
}
}
TColStd_Array1OfInteger bidvmults(1,2); bidvmults.Init(VDegree() + 1);
if (urational || vrational) {
BSplSLib::D3 (U, V, 0, 0, poles->Array2(),
- weights->Array2(),
- biduknots, bidvknots, bidumults, bidvmults,
+ &weights->Array2(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
UDegree(), VDegree(), urational, vrational, 0, 0,
P,
D1U, D1V,
}
else {
BSplSLib::D3 (U, V, 0, 0, poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- biduknots, bidvknots, bidumults, bidvmults,
+ BSplSLib::NoWeights(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
UDegree(), VDegree(), urational, vrational, 0, 0,
P,
D1U, D1V,
TColStd_Array1OfInteger bidvmults(1,2); bidvmults.Init(VDegree() + 1);
if (urational || vrational) {
BSplSLib::DN (U, V, Nu, Nv, 0, 0, poles->Array2(),
- weights->Array2(),
- biduknots, bidvknots, bidumults, bidvmults,
+ &weights->Array2(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
UDegree(), VDegree(), urational, vrational, 0, 0,
Derivative);
}
else {
BSplSLib::DN (U, V, Nu, Nv, 0, 0, poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- biduknots, bidvknots, bidumults, bidvmults,
+ BSplSLib::NoWeights(),
+ biduknots, bidvknots, &bidumults, &bidvmults,
UDegree(), VDegree(), urational, vrational, 0, 0,
Derivative);
}
TColStd_Array1OfReal VCurveWeights
(Weights.LowerCol() , Weights.UpperCol());
BSplSLib::Iso (U, 1, Poles,
- Weights,
- biduknots, bidumults,
- UDegree(), 0, VCurvePoles, VCurveWeights);
+ &Weights,
+ biduknots, &bidumults,
+ UDegree(), 0, VCurvePoles, &VCurveWeights);
if (urational)
UIsoCurve = new Geom_BezierCurve (VCurvePoles, VCurveWeights);
else
}
else {
BSplSLib::Iso (U, 1, Poles,
- *((TColStd_Array2OfReal*) NULL),
- biduknots, bidumults,
+ BSplSLib::NoWeights(),
+ biduknots, &bidumults,
UDegree(), 0, VCurvePoles, PLib::NoWeights());
UIsoCurve = new Geom_BezierCurve (VCurvePoles);
}
TColStd_Array1OfReal VCurveWeights
(Weights.LowerRow() , Weights.UpperRow());
BSplSLib::Iso (V, 0, Poles,
- Weights,
- bidvknots, bidvmults,
- VDegree(), 0, VCurvePoles, VCurveWeights);
+ &Weights,
+ bidvknots, &bidvmults,
+ VDegree(), 0, VCurvePoles, &VCurveWeights);
if (vrational)
VIsoCurve = new Geom_BezierCurve (VCurvePoles, VCurveWeights);
else
}
else {
BSplSLib::Iso (V, 0, Poles,
- *((TColStd_Array2OfReal*) NULL),
- bidvknots, bidvmults,
+ BSplSLib::NoWeights(),
+ bidvknots, &bidvmults,
VDegree(), 0, VCurvePoles, PLib::NoWeights());
VIsoCurve = new Geom_BezierCurve (VCurvePoles);
}
Poles (I, J).Transform (T);
}
}
- UpdateCoefficients();
}
//=======================================================================
TColStd_Array1OfInteger bidvmults(1,2); bidvmults.Init(VDegree() + 1);
if(urational || vrational){
BSplSLib::Resolution(poles->Array2(),
- weights->Array2(),
+ &weights->Array2(),
biduknots,
bidvknots,
bidumults,
}
else{
BSplSLib::Resolution(poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
+ BSplSLib::NoWeights(),
biduknots,
bidvknots,
bidumults,
Handle(Geom_Geometry) Geom_BezierSurface::Copy() const
{
Handle(Geom_BezierSurface) S = new Geom_BezierSurface
- (poles, coeffs, weights, wcoeffs, urational, vrational);
+ (poles, weights, urational, vrational);
return S;
}
(const Handle(TColgp_HArray2OfPnt)& Poles,
const Handle(TColStd_HArray2OfReal)& Weights)
{
- Standard_Integer NbUPoles = Poles->ColLength();
- Standard_Integer NbVPoles = Poles->RowLength();
-
- Standard_Integer maxcls = Max(NbUPoles, NbVPoles);
- Standard_Integer mincls = Min(NbUPoles, NbVPoles);
-
// set fields
- poles = Poles;
- coeffs = new TColgp_HArray2OfPnt (1,maxcls,1,mincls);
-
- if (urational || vrational) {
+ poles = Poles;
+ if (urational || vrational)
weights = Weights;
- wcoeffs = new TColStd_HArray2OfReal (1,maxcls,1,mincls);
- }
- else {
+ else
weights.Nullify();
- wcoeffs.Nullify();
- }
-
- UpdateCoefficients();
-}
-
-
-//=======================================================================
-//function : UpdateCoefficients
-//purpose :
-//=======================================================================
-
-void Geom_BezierSurface::UpdateCoefficients(const Standard_Real ,
- const Standard_Real )
-{
- maxderivinvok = Standard_False;
- ucacheparameter = 0.;
- TColStd_Array1OfReal biduflatknots(BSplCLib::FlatBezierKnots(UDegree()),
- 1, 2*(UDegree()+1));
- vcacheparameter = 0.;
- TColStd_Array1OfReal bidvflatknots(BSplCLib::FlatBezierKnots(VDegree()),
- 1, 2*(VDegree()+1));
-
- Standard_Real uparameter_11 = (2*ucacheparameter + ucachespanlenght)/2,
- uspanlenght_11 = ucachespanlenght/2,
- vparameter_11 = (2*vcacheparameter + vcachespanlenght)/2,
- vspanlenght_11 = vcachespanlenght/2 ;
-
- if ( urational || vrational ) {
- BSplSLib::BuildCache(uparameter_11,vparameter_11,
- uspanlenght_11,vspanlenght_11,0,0,
- UDegree(),VDegree(),0,0,
- biduflatknots,bidvflatknots,
- poles->Array2(),
- weights->Array2(),
- coeffs->ChangeArray2(),
- wcoeffs->ChangeArray2());
- }
- else {
- BSplSLib::BuildCache(uparameter_11,vparameter_11,
- uspanlenght_11,vspanlenght_11,0,0,
- UDegree(),VDegree(),0,0,
- biduflatknots,bidvflatknots,
- poles->Array2(),
- *((TColStd_Array2OfReal*) NULL),
- coeffs->ChangeArray2(),
- *((TColStd_Array2OfReal*) NULL));
- }
- validcache = 1;
}