Fixed GeomAdaptor_Curve::LocalContinuity() for periodic surface within one period
Fixed GeomAdaptor_Curve::NbIntervals() method to periodic curves
Fixed GeomAdaptor_Curve::Intervals() method to periodic curves
if ( Abs(newFirst-TK(Index1+1))<Precision::PConfusion()) {
if (Index1 < Nb) Index1++;
}
- if ( Abs(newLast-TK(Index2))<Precision::PConfusion())
+ if (Abs(newLast - TK(Index2)) < Precision::PConfusion())
Index2--;
- Standard_Integer MultMax;
- // attention aux courbes peridiques.
- if ( (myBSplineCurve->IsPeriodic()) && (Index1 == Nb) )
- Index1 = 1;
+ Standard_Integer MultMax;
- if ( Index2 - Index1 <= 0) {
+ if (myBSplineCurve->IsPeriodic())
+ {
+ if (Index1 == Nb)
+ {
+ Index1 = 1;
+ }
+ if (Index2 == 0)
+ {
+ Index2 = Nb;
+ }
+ }
+
+ if (Index2 - Index1 <= 0) {
MultMax = 100; // CN entre 2 Noeuds consecutifs
}
else {
- MultMax = TM(Index1+1);
- for(Standard_Integer i = Index1+1;i<=Index2;i++) {
- if ( TM(i)>MultMax) MultMax=TM(i);
+ MultMax = TM(Index1 + 1);
+ for (Standard_Integer i = Index1 + 1; i <= Index2; i++) {
+ if (TM(i) > MultMax) MultMax = TM(i);
}
MultMax = myBSplineCurve->Degree() - MultMax;
}
+
if ( MultMax <= 0) {
return GeomAbs_C0;
}
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
+ Standard_Boolean isPeriodic = myBSplineCurve->IsPeriodic();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
Standard_Integer Cont;
TColStd_Array1OfInteger Mults (1, NbKnots);
myBSplineCurve->Multiplicities (Mults);
NbSplit = 1;
- Standard_Integer Index = FirstIndex;
+ Standard_Integer Index = FirstIndex;
Inter (NbSplit) = Index;
Index++;
NbSplit++;
- while (Index < LastIndex)
+ while (Index < LastIndex)
{
if (Degree - Mults (Index) < Cont)
{
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
myBSplineCurve->IsPeriodic(),
1,Nb,Index2,newLast);
- // Protection against myFirst = UFirst - eps, which located as ULast - eps
- if (myBSplineCurve->IsPeriodic() && (newLast - newFirst) < Precision::PConfusion())
- {
- if (Abs(newLast - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
- newLast += myBSplineCurve->Period();
- else
- newFirst -= myBSplineCurve->Period();
- }
+
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
if ( newLast-TK(Index2)> Eps) Index2++;
+ if (myBSplineCurve->IsPeriodic())
+ {
+ if (Index1 == Nb)
+ {
+ Index1 = 1;
+ }
+ if (Index2 == 1)
+ {
+ Index2 = Nb;
+ }
+ }
+
myNbIntervals = 1;
- for ( Standard_Integer i=1; i<=NbInt; i++)
- if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
+
+
+ // Calculating number of intervals if myBSplineCurve->IsPeriodic()
+ // |>----|....|---->|
+ // Index2 Index1
+ // | Period |
+ for (Standard_Integer i = 1; i <= NbInt; i++) {
+ if (isPeriodic && (Index1 >= Index2))
+ {
+ if ((Inter(i) > Index1 && Inter(i) < Nb) || (Inter(i) > 0 && Inter(i) < Index2))
+ {
+ myNbIntervals++;
+ }
+ }
+ else if (Inter(i) > Index1 && Inter(i) < Index2)
+ {
+ myNbIntervals++;
+ }
+ }
}
break;
}
{
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
+ Standard_Boolean isPeriodic = myBSplineCurve->IsPeriodic();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
- myBSplineCurve->IsPeriodic(),
+ isPeriodic,
1,Nb,Index1,newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myLast,
- myBSplineCurve->IsPeriodic(),
+ isPeriodic,
1,Nb,Index2,newLast);
FirstParam = newFirst;
LastParam = newLast;
- // Protection against myFirst = UFirst - eps, which located as ULast - eps
- if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
- {
- if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
- LastParam += myBSplineCurve->Period();
- else
- FirstParam -= myBSplineCurve->Period();
- }
+
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if ( Abs(FirstParam-TK(Index1+1))< Eps) Index1++;
if ( LastParam-TK(Index2)> Eps) Index2++;
+ if (myBSplineCurve->IsPeriodic())
+ {
+ if (Index1 == Nb)
+ {
+ Index1 = 1;
+ }
+ if (Index2 == 1)
+ {
+ Index2 = Nb;
+ }
+ }
+
myNbIntervals = 1;
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
aFinalIntervals(1) = Index1;
- for ( Standard_Integer i=1; i<=NbInt; i++) {
- if (Inter(i) > Index1 && Inter(i)<Index2 ) {
- myNbIntervals++;
- aFinalIntervals(myNbIntervals) = Inter(i);
- }
- }
- aFinalIntervals(myNbIntervals + 1) = Index2;
+
+ // Calculating number of intervals if myBSplineCurve->IsPeriodic()
+ // |>----|....|---->|
+ // Index2 Index1
+ // | Period |
- for (Standard_Integer I=1;I<=myNbIntervals+1;I++) {
+ if (isPeriodic && (Index1 >= Index2))
+ {
+ for (Standard_Integer i = Index1; i <= NbInt; i++)
+ {
+ if (Inter(i)>Index1 && Inter(i) < Nb)
+ {
+ myNbIntervals++;
+ aFinalIntervals(myNbIntervals) = Inter(i);
+ }
+ }
+ for (Standard_Integer i = 1; i <= Index2; i++)
+ {
+ if (Inter(i) > 0 && Inter(i) < Index2)
+ {
+ myNbIntervals++;
+ aFinalIntervals(myNbIntervals) = Inter(i);
+ }
+ }
+ }
+ else
+ {
+ for (Standard_Integer i = 1; i <= NbInt; i++)
+ {
+ if (Inter(i) > Index1 && Inter(i) < Index2)
+ {
+ myNbIntervals++;
+ aFinalIntervals(myNbIntervals) = Inter(i);
+ }
+ }
+ }
+
+ aFinalIntervals(myNbIntervals + 1) = Index2;
+
+ for (Standard_Integer I=1;I<=myNbIntervals;I++)
+ {
T(I) = TK(aFinalIntervals(I));
- }
- }
- break;
+ if (isPeriodic)
+ {
+ T(I) += myBSplineCurve->Period() * Ceiling((myFirst - T(I)) / myBSplineCurve->Period());
+ }
+ }
+ }
+ T(T.Lower()) = myFirst;
+ T(T.Lower() + myNbIntervals) = myLast;
+ return;
}
}
}
return 0;
}
+static Standard_Integer OCC29745 (Draw_Interpretor& /*theDI*/,
+ Standard_Integer /*theNbArgs*/,
+ const char** theArgVec)
+{
+ Standard_Integer a1 = Draw::Atoi(theArgVec[1]);
+ Standard_Integer a2 = Draw::Atoi(theArgVec[2]);
+ TColgp_Array2OfPnt Poles(1, 2, 1, 4);
+ Poles(1, 1) = gp_Pnt(0, 0, 0); Poles(2, 1) = gp_Pnt(0, 0, 1);
+ Poles(1, 2) = gp_Pnt(1, 0, 0); Poles(2, 2) = gp_Pnt(1, 0, 1);
+ Poles(1, 3) = gp_Pnt(0, 1, 0); Poles(2, 3) = gp_Pnt(0, 1, 1);
+ Poles(1, 4) = gp_Pnt(1, 1, 0); Poles(2, 4) = gp_Pnt(1, 1, 1);
+ TColStd_Array1OfReal UKnots(1, 2), VKnots(1, 5), ResultsB(1, abs(a1-a2)+1);
+ UKnots(1) = 0; UKnots(2) = 1;
+ VKnots(1) = 0; VKnots(2) = 1; VKnots(3) = 2; VKnots(4) = 3; VKnots(5) = 4;
+ TColStd_Array1OfInteger UMult(1, 2), VMult(1, 5);
+ UMult(1) = 2; UMult(2) = 2;
+ VMult(1) = 1; VMult(2) = 1; VMult(3) = 1; VMult(4) = 1; VMult(5) = 1;
+ Handle(Geom_BSplineSurface) S = new Geom_BSplineSurface(Poles, UKnots, VKnots, UMult, VMult, 1, 1, false, true);
+ GeomAdaptor_Surface B(S, 0, 1, a1, a2);
+ B.VIntervals(ResultsB, GeomAbs_C1);
+ for (TColStd_Array1OfReal::const_iterator i(ResultsB.begin()); i != ResultsB.end(); ++i) std::cout << *i << " ";
+ std::cout << std::endl;
+ return 0;
+}
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", __FILE__, OCC29311, group);
theCommands.Add("OCC30391", "OCC30391 result face LenBeforeUfirst LenAfterUlast LenBeforeVfirst LenAfterVlast", __FILE__, OCC30391, group);
theCommands.Add("OCC29195", "OCC29195 [nbRep] doc1 [doc2 [doc3 [doc4]]]", __FILE__, OCC29195, group);
- theCommands.Add("OCC30435", "OCC30435 result curve inverse nbit", __FILE__, OCC30435, group);
+ theCommands.Add("OCC30435", "OCC30435 result curve invers nbit", __FILE__, OCC30435, group);
theCommands.Add("OCC30990", "OCC30990 surface", __FILE__, OCC30990, group);
theCommands.Add("QAStartsWith",
theCommands.Add("OCC31785",
"OCC31785 file.xbf : test reading XBF file in another thread",
__FILE__, OCC31785, group);
-
+ theCommands.Add("OCC29745", "GeomAdaptor_Surface::VIntervals fails on periodic surfaces",
+ __FILE__, OCC29745, group);
theCommands.Add("QANullifyShape",
"Nullify shape. Usage: QANullifyShape shape",
+puts "TODO OCC30286 ALL: Error : HLRToShape is WRONG because number of VERTEX entities in shape "result" is 109"
+puts "TODO OCC30286 ALL: Error : HLRToShape is WRONG because number of EDGE entities in shape "result" is 55"
+puts "TODO OCC30286 ALL: Error : HLRToShape is WRONG because number of SHAPE entities in shape "result" is 165"
+
puts "============"
puts "OCC25908"
puts "============"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 6.34983, expected 6.34984"
+
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
puts "====================================="
-puts "TODO OCC30286 ALL: Error : The length of result shape is 1736.91, expected 1704.87"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 1736.86, expected 1704.87"
set viewname "vright"
set length 1704.87
+puts "TODO OCC30286 ALL: Error : The length of result shape is 484.062, expected 484.485"
+
puts "============"
puts "OCC25908"
puts "============"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 544.185, expected 544.616"
+
puts "============"
puts "OCC25908"
puts "============"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 6.30139, expected 6.30238"
+
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
puts "====================================="
-puts "TODO OCC30286 ALL: Error : The length of result shape is 8.06872, expected 8.05281"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 7.9487, expected 8.05281"
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 8.40196, expected 8.39744"
+
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
puts "====================================="
-puts "TODO OCC30286 ALL: Error : The length of result shape is 7.44464, expected 7.39488"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 7.4452, expected 7.39488"
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
-puts "TODO OCC30286 ALL: Error : The length of result shape is 9.10542, expected 9.47163"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 9.08401, expected 9.47163"
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
+puts "TODO OCC30286 ALL: Error : The length of result shape is 7.64618, expected 7.64599"
+
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
puts "====================================="
+puts "TODO OCC30286 ALL: Error : The length of result shape is 9.30402, expected 9.30381"
+
puts "====================================="
puts "OCC27341: Incorrect exact HLR results"
puts "====================================="