index,
num_knots ;
if (StartValue < EndValue - Tolerance) {
- TColStd_Array1OfReal knots1(1,Knots1.Length()) ;
- TColStd_Array1OfReal knots2(1,Knots2.Length()) ;
- degree = Degree1 + Degree2 ;
- index = 1 ;
-
- for (ii = Knots1.Lower() ; ii <= Knots1.Upper() ; ii++) {
- knots1(index) = Knots1(ii) ;
- index += 1 ;
+ TColStd_Array1OfReal knots1(1, Knots1.Length());
+ TColStd_Array1OfReal knots2(1, Knots2.Length());
+ degree = Degree1 + Degree2;
+ index = 1;
+
+ for (ii = Knots1.Lower(); ii <= Knots1.Upper(); ii++) {
+ knots1(index) = Knots1(ii);
+ index += 1;
}
- index = 1 ;
+ index = 1;
- for (ii = Knots2.Lower() ; ii <= Knots2.Upper() ; ii++) {
- knots2(index) = Knots2(ii) ;
- index += 1 ;
+ for (ii = Knots2.Lower(); ii <= Knots2.Upper(); ii++) {
+ knots2(index) = Knots2(ii);
+ index += 1;
}
BSplCLib::Reparametrize(StartValue,
- EndValue,
- knots1) ;
-
+ EndValue,
+ knots1);
+
BSplCLib::Reparametrize(StartValue,
- EndValue,
- knots2) ;
- num_knots = 0 ;
- jj = 1 ;
+ EndValue,
+ knots2);
+ num_knots = 0;
+ jj = 1;
- for (ii = 1 ; ii <= knots1.Length() ; ii++) {
+ for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
- jj += 1 ;
- num_knots += 1 ;
+ jj += 1;
+ num_knots += 1;
}
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
- jj += 1 ;
+ jj += 1;
}
- num_knots += 1 ;
+ num_knots += 1;
}
- NewKnots =
- new TColStd_HArray1OfReal(1,num_knots) ;
+ NewKnots =
+ new TColStd_HArray1OfReal(1, num_knots);
NewMults =
- new TColStd_HArray1OfInteger(1,num_knots) ;
- num_knots = 1 ;
- jj = 1 ;
+ new TColStd_HArray1OfInteger(1, num_knots);
+ num_knots = 1;
+ jj = 1;
- for (ii = 1 ; ii <= knots1.Length() ; ii++) {
+ for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
- NewKnots->ChangeArray1()(num_knots) = knots2(jj) ;
- NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1 ;
- jj += 1 ;
- num_knots += 1 ;
+ NewKnots->ChangeArray1()(num_knots) = knots2(jj);
+ NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1;
+ jj += 1;
+ num_knots += 1;
}
- set_mults_flag = 0 ;
+ set_mults_flag = 0;
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
- continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj)) ;
- set_mults_flag = 1 ;
- NewMults->ChangeArray1()(num_knots) = degree - continuity ;
- jj += 1 ;
+ continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj));
+ set_mults_flag = 1;
+ NewMults->ChangeArray1()(num_knots) = degree - continuity;
+ jj += 1;
}
- NewKnots->ChangeArray1()(num_knots) = knots1(ii) ;
- if (! set_mults_flag) {
- NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2 ;
+ NewKnots->ChangeArray1()(num_knots) = knots1(ii);
+ if (!set_mults_flag) {
+ NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2;
}
- num_knots += 1 ;
+ num_knots += 1;
}
- num_knots -= 1 ;
- NewMults->ChangeArray1()(1) = degree + 1 ;
- NewMults->ChangeArray1()(num_knots) = degree + 1 ;
- index = 0 ;
+ num_knots -= 1;
+ NewMults->ChangeArray1()(1) = degree + 1;
+ NewMults->ChangeArray1()(num_knots) = degree + 1;
+ index = 0;
- for (ii = 1 ; ii <= num_knots ; ii++) {
- index += NewMults->Value(ii) ;
+ for (ii = 1; ii <= num_knots; ii++) {
+ index += NewMults->Value(ii);
}
- NumPoles = index - degree - 1 ;
+ NumPoles = index - degree - 1;
+ }
+ else
+ {
+ degree = Degree1 + Degree2;
+ num_knots = 2;
+ NewKnots =
+ new TColStd_HArray1OfReal(1, num_knots);
+ NewKnots->ChangeArray1()(1) = StartValue;
+ NewKnots->ChangeArray1()(num_knots) = EndValue;
+
+ NewMults =
+ new TColStd_HArray1OfInteger(1, num_knots);
+ NewMults->ChangeArray1()(1) = degree + 1;
+ NewMults->ChangeArray1()(num_knots) = degree + 1;
+ NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
}
}
Handle(TColStd_HArray1OfReal) resKnots;
Handle(TColStd_HArray1OfInteger) resMults;
Standard_Real start_value,end_value;
- Standard_Real tolerance=Precision::Confusion();
Standard_Integer resNbPoles,degree,
ii,jj,
aStatus;
BS->KnotSequence(BSFlatKnots);
start_value = BSKnots(1);
end_value = BSKnots(BS->NbKnots());
+ Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
a->Knots(aKnots);
a->Poles(aPoles);
degree,
resDenPoles,
aStatus);
-// BSplCLib::FunctionMultiply(law_evaluator,
-// BS->Degree(),
-// BSFlatKnots,
-// BSPoles,
-// resFlatKnots,
-// degree,
-// resNumPoles,
-// aStatus);
-// BSplCLib::FunctionMultiply(law_evaluator,
-// BS->Degree(),
-// BSFlatKnots,
-// BSWeights,
-// resFlatKnots,
-// degree,
-// resDenPoles,
-// aStatus);
for (ii=1;ii<=resNbPoles;ii++)
for(jj=1;jj<=2;jj++)
resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii));
Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii));
//POP pour NT
Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient);
-// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Poles,
FlatKnots,
- aNewCurveDegree,
+ aNewCurveDegree,
NewPoles,
aStatus
);
- TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
-// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
+ TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Weights,
FlatKnots,
- aNewCurveDegree,
+ aNewCurveDegree,
NewWeights,
aStatus
);