C2 continuity intervals changed to Knots intervals in case of Bspline curve.
Fixed incorrect extremaPC usage.
Test case for issue CR26351
Update of test-cases according to the new behavior
Dist2Min = RealLast();
for (i = 1; i <= myExtPC.NbExt(); i++)
{
- Dist2 = myExtPC.SquareDistance(i);
- if (Dist2 < Dist2Min)
- {
- Dist2Min = Dist2;
- pmin = myExtPC.Point(i).Parameter();
- }
+ if (myExtPC.IsMin(i))
+ {
+ Dist2 = myExtPC.SquareDistance(i);
+ if (Dist2 < Dist2Min)
+ {
+ Dist2Min = Dist2;
+ pmin = myExtPC.Point(i).Parameter();
+ }
+ }
}
-
newC->D1(pmin,pfv,newd1);
Standard_Boolean YaRev = d1fv.Dot(newd1) < 0.;
GeomAdaptor_Curve TheCurve(C);
Extrema_ExtPC myExtPC(P,TheCurve);
if (!myExtPC.IsDone()) {
- Standard_Failure::Raise();
+ Standard_Failure::Raise("Draft_Modification_1::Parameter: ExtremaPC not done.");
}
if (myExtPC.NbExt() >= 1) {
Standard_Real Dist2, Dist2Min = myExtPC.SquareDistance(1);
{
if (!myPinit || !myCinit) Standard_TypeMismatch::Raise();
mySqDist.Append(myPc.SquareDistance(myP));
- Standard_Integer IntVal;
- if (!myD1Init) {
- myD1Init = Standard_True;
- Standard_Real FF, DD;
- Values(myU, FF, DD);
- }
- if (!myD1Init) IntVal = 0;
- else {
- if (myD1f > 0.) { IntVal = 1; }
- else { IntVal = 0; }
+
+ // It is necessary to always compute myD1f.
+ myD1Init = Standard_True;
+ Standard_Real FF, DD;
+ Values(myU, FF, DD);
+
+ Standard_Integer IntVal = 0;
+ if (myD1f > 0.0)
+ {
+ IntVal = 1;
}
+
myIsMin.Append(IntVal);
myPoint.Append(POnC(myU,myPc));
return 0;
#include <Precision.hxx>
#include <ElCLib.hxx>
#include <TColStd_Array1OfReal.hxx>
+#include <NCollection_Array1.hxx>
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
-
void Extrema_GExtPC::Perform(const ThePoint& P)
{
mySqDist.Clear();
mydist2 = P.SquareDistance(Pl);
}
+ TheCurve & aCurve = *((TheCurve*)myC);
+
switch(type) {
case GeomAbs_Circle:
{
- myExtPElC.Perform(P, TheCurveTool::Circle(*((TheCurve*)myC)), t3d, myuinf, myusup);
+ myExtPElC.Perform(P, TheCurveTool::Circle(aCurve), t3d, myuinf, myusup);
}
break;
case GeomAbs_Ellipse:
{
- myExtPElC.Perform(P, TheCurveTool::Ellipse(*((TheCurve*)myC)), t3d, myuinf, myusup);
+ myExtPElC.Perform(P, TheCurveTool::Ellipse(aCurve), t3d, myuinf, myusup);
}
break;
case GeomAbs_Parabola:
{
- myExtPElC.Perform(P, TheCurveTool::Parabola(*((TheCurve*)myC)), t3d,myuinf,myusup);
+ myExtPElC.Perform(P, TheCurveTool::Parabola(aCurve), t3d,myuinf,myusup);
}
break;
case GeomAbs_Hyperbola:
{
- myExtPElC.Perform(P,TheCurveTool::Hyperbola(*((TheCurve*)myC)),t3d, myuinf, myusup);
+ myExtPElC.Perform(P,TheCurveTool::Hyperbola(aCurve),t3d, myuinf, myusup);
}
break;
case GeomAbs_Line:
{
- myExtPElC.Perform(P, TheCurveTool::Line(*((TheCurve*)myC)), t3d, myuinf, myusup);
+ myExtPElC.Perform(P, TheCurveTool::Line(aCurve), t3d, myuinf, myusup);
}
break;
case GeomAbs_BezierCurve:
{
myintuinf = myuinf;
myintusup = myusup;
- mysample = (TheCurveTool::Bezier(*((TheCurve*)myC)))->NbPoles()*2;
+ mysample = (TheCurveTool::Bezier(aCurve))->NbPoles() * 2;
+ myExtPC.Initialize(aCurve);
IntervalPerform(P);
return;
}
case GeomAbs_BSplineCurve:
{
- mysample = (TheCurveTool::BSpline(*((TheCurve*)myC)))->NbPoles()*2;
+ const Standard_Integer
+ aFirstIdx = TheCurveTool::BSpline(aCurve)->FirstUKnotIndex(),
+ aLastIdx = TheCurveTool::BSpline(aCurve)->LastUKnotIndex();
+ // const reference can not be used due to implementation of BRep_Adaptor.
+ TColStd_Array1OfReal aKnots(aFirstIdx, aLastIdx);
+ TheCurveTool::BSpline(aCurve)->Knots(aKnots);
+
+ // Workaround to work with:
+ // blend, where knots may be moved from param space.
+ Standard_Real aPeriodJump = 0.0;
+ if (TheCurveTool::IsPeriodic(aCurve))
+ {
+ Standard_Integer aPeriodShift =
+ Standard_Integer ((myuinf - aKnots(aFirstIdx)) / TheCurveTool::Period(aCurve));
+
+ if (myuinf < aKnots(aFirstIdx))
+ aPeriodShift--;
+
+ aPeriodJump = TheCurveTool::Period(aCurve) * aPeriodShift;
+ }
+
+ Standard_Integer anIdx;
+
+ // Find first and last used knot
+ Standard_Integer aFirstUsedKnot = aFirstIdx,
+ aLastUsedKnot = aLastIdx;
+ for(anIdx = aFirstIdx; anIdx <= aLastIdx; anIdx++)
+ {
+ Standard_Real aKnot = aKnots(anIdx) + aPeriodJump;
+ if (myuinf >= aKnot)
+ aFirstUsedKnot = anIdx;
+ else
+ break;
+
+ }
+ for(anIdx = aLastIdx; anIdx >= aFirstIdx; anIdx--)
+ {
+ Standard_Real aKnot = aKnots(anIdx) + aPeriodJump;
+ if (myusup <= aKnot)
+ aLastUsedKnot = anIdx;
+ else
+ break;
+ }
+
+ mysample = (TheCurveTool::BSpline(aCurve))->Degree() + 1;
+
+ // Fill sample points.
+ Standard_Integer aValIdx = 1;
+ NCollection_Array1<Standard_Real> aVal(1, (mysample) * (aLastUsedKnot - aFirstUsedKnot) + 1);
+ NCollection_Array1<Standard_Real> aParam(1, (mysample) * (aLastUsedKnot - aFirstUsedKnot) + 1);
+ for(anIdx = aFirstUsedKnot; anIdx < aLastUsedKnot; anIdx++)
+ {
+ Standard_Real aF = aKnots(anIdx) + aPeriodJump,
+ aL = aKnots(anIdx + 1) + aPeriodJump;
+
+ if (anIdx == aFirstUsedKnot)
+ aF = myuinf;
+ if (anIdx == aLastUsedKnot - 1)
+ aL = myusup;
+
+ Standard_Real aStep = (aL - aF) / mysample;
+ for(Standard_Integer aPntIdx = 0; aPntIdx < mysample; aPntIdx++)
+ {
+ Standard_Real aCurrentParam = aF + aStep * aPntIdx;
+ aVal(aValIdx) = TheCurveTool::Value(aCurve, aCurrentParam).SquareDistance(P);
+ aParam(aValIdx) = aCurrentParam;
+ aValIdx++;
+ }
+ }
+ // Fill last point.
+ aVal(aValIdx) = TheCurveTool::Value(aCurve, myusup).SquareDistance(P);
+ aParam(aValIdx) = myusup;
+
+ myExtPC.Initialize(aCurve);
+
+ // Find extremas.
+ for(anIdx = aVal.Lower() + 1; anIdx < aVal.Upper(); anIdx++)
+ {
+ if (aVal(anIdx) <= Precision::SquareConfusion())
+ {
+ mySqDist.Append(aVal(anIdx));
+ myismin.Append(Standard_True);
+ mypoint.Append(ThePOnC(aParam(anIdx), TheCurveTool::Value(aCurve, aParam(anIdx))));
+ }
+ if ((aVal(anIdx) >= aVal(anIdx + 1) &&
+ aVal(anIdx) >= aVal(anIdx - 1)) ||
+ (aVal(anIdx) <= aVal(anIdx + 1) &&
+ aVal(anIdx) <= aVal(anIdx - 1)) )
+ {
+ myintuinf = aParam(anIdx - 1);
+ myintusup = aParam(anIdx + 1);
+
+ IntervalPerform(P);
+ }
+ }
+
+ // Solve on first and last interval.
+ if (mydist1 > Precision::SquareConfusion())
+ {
+ ThePoint aP1, aP2;
+ TheVector aV1, aV2;
+ TheCurveTool::D1(aCurve, aParam.Value(aParam.Lower()), aP1, aV1);
+ TheCurveTool::D1(aCurve, aParam.Value(aParam.Lower() + 1), aP2, aV2);
+ TheVector aBase1(P, aP1), aBase2(P, aP2);
+ Standard_Real aVal1 = aV1.Dot(aBase1); // Derivative of (C(u) - P)^2
+ Standard_Real aVal2 = aV2.Dot(aBase2); // Derivative of (C(u) - P)^2
+
+ // Derivatives have opposite signs - min or max inside of interval (sufficient condition).
+ // Necessary condition - when point lies on curve.
+ if(aVal1 * aVal2 <= 0.0 ||
+ aBase1.Dot(aBase2) <= 0.0)
+ {
+ myintuinf = aParam(aVal.Lower());
+ myintusup = aParam(aVal.Lower() + 1);
+ IntervalPerform(P);
+ }
+ }
+
+ if (mydist2 > Precision::SquareConfusion())
+ {
+ ThePoint aP1, aP2;
+ TheVector aV1, aV2;
+ TheCurveTool::D1(aCurve, aParam.Value(aParam.Upper() - 1), aP1, aV1);
+ TheCurveTool::D1(aCurve, aParam.Value(aParam.Upper()), aP2, aV2);
+ TheVector aBase1(P, aP1), aBase2(P, aP2);
+ Standard_Real aVal1 = aV1.Dot(aBase1); // Derivative of (C(u) - P)^2
+ Standard_Real aVal2 = aV2.Dot(aBase2); // Derivative of (C(u) - P)^2
+
+ // Derivatives have opposite signs - min or max inside of interval (sufficient condition).
+ // Necessary condition - when point lies on curve.
+ if(aVal1 * aVal2 <= 0.0 ||
+ aBase1.Dot(aBase2) <= 0.0)
+ {
+ myintuinf = aParam(aVal.Upper() - 1);
+ myintusup = aParam(aVal.Upper());
+ IntervalPerform(P);
+ }
+ }
+
+ mydone = Standard_True;
+ break;
}
- case GeomAbs_OtherCurve:
+ case GeomAbs_OtherCurve:
{
Standard_Boolean IntExtIsDone = Standard_False;
Standard_Boolean IntIsNotValid;
- n = TheCurveTool::NbIntervals(*((TheCurve*)myC), GeomAbs_C2);
+ n = TheCurveTool::NbIntervals(aCurve, GeomAbs_C2);
TColStd_Array1OfReal theInter(1, n+1);
- Standard_Boolean isPeriodic = TheCurveTool::IsPeriodic(*((TheCurve*)myC));
- TheCurveTool::Intervals(*((TheCurve*)myC), theInter, GeomAbs_C2);
+ Standard_Boolean isPeriodic = TheCurveTool::IsPeriodic(aCurve);
+ TheCurveTool::Intervals(aCurve, theInter, GeomAbs_C2);
mysample = Max(mysample/n, 17);
TheVector V1;
ThePoint PP;
Standard_Real s1 = 0.0 ;
- Standard_Real s2 = 0.0;
- for (i = 1; i <= n; i++) {
+ Standard_Real s2 = 0.0;
+ myExtPC.Initialize(aCurve);
+ for (i = 1; i <= n; i++)
+ {
myintuinf = theInter(i);
myintusup = theInter(i+1);
Standard_Real aSupToCheck = myintusup;
if (isPeriodic) {
- Standard_Real aPeriod = TheCurveTool::Period(*((TheCurve*)myC));
+ Standard_Real aPeriod = TheCurveTool::Period(aCurve);
anInfToCheck = ElCLib::InPeriod(myintuinf, myuinf, myuinf+aPeriod);
aSupToCheck = myintusup+(anInfToCheck-myintuinf);
}
if (i != 1)
{
- TheCurveTool::D1(*((TheCurve*)myC), myintuinf, PP, V1);
+ TheCurveTool::D1(aCurve, myintuinf, PP, V1);
s1 = (TheVector(P, PP))*V1;
if (s1*s2 < 0.0) {
mySqDist.Append(PP.SquareDistance(P));
}
}
if (i != n) {
- TheCurveTool::D1(*((TheCurve*)myC), myintusup, PP, V1);
+ TheCurveTool::D1(aCurve, myintusup, PP, V1);
s2 = (TheVector(P, PP))*V1;
}
IntervalPerform(P);
IntExtIsDone = IntExtIsDone || mydone;
}
+
mydone = IntExtIsDone;
+ break;
+ }
+ }
- // Additional checking if the point is on the first or last point of the curve and does not added yet
- if (mydist1 < Precision::SquareConfusion() || mydist2 < Precision::SquareConfusion())
+ // Postprocessing.
+ if (type == GeomAbs_BSplineCurve ||
+ type == GeomAbs_OtherCurve)
+ {
+ // Additional checking if the point is on the first or last point of the curve
+ // and does not added yet.
+ if (mydist1 < Precision::SquareConfusion() ||
+ mydist2 < Precision::SquareConfusion())
+ {
+ Standard_Boolean isFirstAdded = Standard_False;
+ Standard_Boolean isLastAdded = Standard_False;
+ Standard_Integer aNbPoints = mypoint.Length();
+ for (i = 1; i <= aNbPoints; i++)
{
- Standard_Boolean isFirstAdded = Standard_False;
- Standard_Boolean isLastAdded = Standard_False;
- Standard_Integer aNbPoints = mypoint.Length();
- for (i = 1; i <= aNbPoints; i++)
- {
- U = mypoint.Value(i).Parameter();
- if (Abs(U - myuinf) < mytolu)
- isFirstAdded = Standard_True;
- else if (Abs(myusup - U) < mytolu)
- isLastAdded = Standard_True;
- }
- if (!isFirstAdded && mydist1 < Precision::SquareConfusion())
+ U = mypoint.Value(i).Parameter();
+ if (Abs(U - myuinf) < mytolu)
+ isFirstAdded = Standard_True;
+ else if (Abs(myusup - U) < mytolu)
+ isLastAdded = Standard_True;
+ }
+ if (!isFirstAdded && mydist1 < Precision::SquareConfusion())
+ {
+ mySqDist.Prepend(mydist1);
+ myismin.Prepend(Standard_True);
+ mypoint.Prepend(ThePOnC(myuinf, Pf));
+ }
+ if (!isLastAdded && mydist2 < Precision::SquareConfusion())
+ {
+ mySqDist.Append(mydist2);
+ myismin.Append(Standard_True);
+ mypoint.Append(ThePOnC(myusup, Pl));
+ }
+ mydone = Standard_True;
+ }
+ }
+ else
+ {
+ // In analytical case
+ mydone = myExtPElC.IsDone();
+ if (mydone)
+ {
+ NbExt = myExtPElC.NbExt();
+ for (i = 1; i <= NbExt; i++)
+ {
+ // Verification de la validite des parametres:
+ ThePOnC PC = myExtPElC.Point(i);
+ U = PC.Parameter();
+ if (TheCurveTool::IsPeriodic(aCurve))
{
- mySqDist.Prepend(mydist1);
- myismin.Prepend(Standard_True);
- mypoint.Prepend(ThePOnC(myuinf, Pf));
+ U = ElCLib::InPeriod(U, myuinf, myuinf+TheCurveTool::Period(aCurve));
}
- if (!isLastAdded && mydist2 < Precision::SquareConfusion())
+ if ((U >= myuinf-mytolu) && (U <= myusup+mytolu))
{
- mySqDist.Append(mydist2);
- myismin.Append(Standard_True);
- mypoint.Append(ThePOnC(myusup, Pl));
+ PC.SetValues(U, myExtPElC.Point(i).Value());
+ mySqDist.Append(myExtPElC.SquareDistance(i));
+ myismin.Append(myExtPElC.IsMin(i));
+ mypoint.Append(PC);
}
}
- return;
}
}
-
-
- mydone = myExtPElC.IsDone();
- if (mydone) {
- NbExt = myExtPElC.NbExt();
- for (i = 1; i <= NbExt; i++) {
- // Verification de la validite des parametres:
- ThePOnC PC = myExtPElC.Point(i);
- U = PC.Parameter();
- if (TheCurveTool::IsPeriodic(*((TheCurve*)myC))) {
- U = ElCLib::InPeriod(U, myuinf, myuinf+TheCurveTool::Period(*((TheCurve*)myC)));
- }
- if ((U >= myuinf-mytolu) && (U <= myusup+mytolu)){
- PC.SetValues(U, myExtPElC.Point(i).Value());
- mySqDist.Append(myExtPElC.SquareDistance(i));
- myismin.Append(myExtPElC.IsMin(i));
- mypoint.Append(PC);
- }
- }
- }
}
{
Standard_Integer i;
Standard_Real U;
- myExtPC.Initialize((*((TheCurve*)myC)), mysample,
- myintuinf, myintusup, mytolu, mytolf);
+ myExtPC.Initialize(mysample, myintuinf, myintusup, mytolu, mytolf);
myExtPC.Perform(P);
mydone = myExtPC.IsDone();
- if (mydone) {
+ if (mydone)
+ {
Standard_Integer NbExt = myExtPC.NbExt();
- for (i = 1; i <= NbExt; i++) {
+ for (i = 1; i <= NbExt; i++)
+ {
// Verification de la validite des parametres pour le cas trimme:
ThePOnC PC = myExtPC.Point(i);
U = PC.Parameter();
- if (TheCurveTool::IsPeriodic(*((TheCurve*)myC))) {
+ if (TheCurveTool::IsPeriodic(*((TheCurve*)myC)))
+ {
U = ElCLib::InPeriod(U, myuinf, myuinf+TheCurveTool::Period(*((TheCurve*)myC)));
}
- if ((U >= myuinf - mytolu) && (U <= myusup + mytolu)) {
+ if ((U >= myuinf - mytolu) && (U <= myusup + mytolu))
+ {
PC.SetValues(U, PC.Value());
mySqDist.Append(myExtPC.SquareDistance(i));
myismin.Append(myExtPC.IsMin(i));
P1 = Pf;
P2 = Pl;
}
-
Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
if (anExtr.IsDone())
{
- Standard_Integer anIndex = 1;
- while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
- Vsingular[0] = anExtr.Point(anIndex).Parameter();
+ Standard_Real aMinDist = RealLast();
+ for(Standard_Integer anIdx = 1; anIdx <= anExtr.NbExt(); anIdx++)
+ {
+ if (anExtr.IsMin(anIdx) &&
+ anExtr.SquareDistance(anIdx) < aMinDist)
+ {
+ aMinDist = anExtr.SquareDistance(anIdx);
+ Vsingular[0] = anExtr.Point(anIdx).Parameter();
+ }
+ }
}
else
Vsingular[0] = ElCLib::Parameter(L, P);
Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
if (anExtr.IsDone())
{
- Standard_Integer anIndex = 1;
- while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
- Vsingular[1] = anExtr.Point(anIndex).Parameter();
+ Standard_Real aMinDist = RealLast();
+ for(Standard_Integer anIdx = 1; anIdx <= anExtr.NbExt(); anIdx++)
+ {
+ if (anExtr.IsMin(anIdx) &&
+ anExtr.SquareDistance(anIdx) < aMinDist)
+ {
+ aMinDist = anExtr.SquareDistance(anIdx);
+ Vsingular[1] = anExtr.Point(anIdx).Parameter();
+ }
+ }
}
else
Vsingular[1] = ElCLib::Parameter(L, P);
try {
OCC_CATCH_SIGNALS
Extrema_ExtPC myExtPC(P3D,C3D);
- if ( myExtPC.IsDone() && ( myExtPC.NbExt() > 0) ) {
- Standard_Real dist2, dist2Min = myExtPC.SquareDistance(1);
- Standard_Integer index = 1;
- for ( Standard_Integer i = 2; i <= myExtPC.NbExt(); i++) {
+ Standard_Real dist2Min = RealLast() , dist2;
+ Standard_Integer index = 0;
+ if ( myExtPC.IsDone() && ( myExtPC.NbExt() > 0) )
+ {
+ for ( Standard_Integer i = 1; i <= myExtPC.NbExt(); i++)
+ {
+ if (!myExtPC.IsMin(i))
+ continue;
+
dist2 = myExtPC.SquareDistance(i);
- if ( dist2 < dist2Min) { dist2Min = dist2; index = i; }
+ if ( dist2 < dist2Min)
+ {
+ dist2Min = dist2; index = i;
+ }
+ }
+
+ if (index != 0)
+ {
+ param = (myExtPC.Point(index)).Parameter();
+ proj = (myExtPC.Point(index)).Value();
+ OK = Standard_True;
}
- param = (myExtPC.Point(index)).Parameter();
- proj = (myExtPC.Point(index)).Value();
- OK = Standard_True;
}
}
catch(Standard_Failure) {
set x 3.999999652077201
set y 5.0000000062915735
set z 5.00002142991819367
-set pp_ch 0.9991079538920743
+set pp_ch 0.99910795389207607
restore [locate_data_file bug23706_c.draw] c
set info [proj c $x $y $z]
set x 3.99999991301930024
set y 5.00000000157289337
set z 5.00000535747954842
-set pp_ch 0.99955486819730277
+set pp_ch 0.99955486819730044
restore [locate_data_file bug23706_c.draw] c
set info [proj c $x $y $z]
set x 3.99999999837571056
set y 5.0000000000293724
set z 5.0000001000463034
-set pp_ch 0.99993927567416474
+set pp_ch 0.99993927567419039
restore [locate_data_file bug23706_c.draw] c
set info [proj c $x $y $z]
set x 3.9999965207720098
set y 5.0000000629157348
set z 5.0002142991819367
-set pp_ch 0.99715423329884789
+set pp_ch 0.99715423329884956
restore [locate_data_file bug23706_c2.draw] c
set info [proj c $x $y $z]
set x 3.999999652077201
set y 5.0000000062915735
set z 5.00002142991819367
-set pp_ch 0.99910795390933105
+set pp_ch 0.99910795390933249
restore [locate_data_file bug23706_c2.draw] c
set info [proj c $x $y $z]
set x 3.99999991301930024
set y 5.00000000157289337
set z 5.00000535747954842
-set pp_ch 0.99955486819834238
+set pp_ch 0.99955486819834583
restore [locate_data_file bug23706_c2.draw] c
set info [proj c $x $y $z]
set x 3.99999999837571056
set y 5.0000000000293724
set z 5.0000001000463034
-set pp_ch 0.9999392756740122
+set pp_ch 0.99993927567408425
restore [locate_data_file bug23706_c2.draw] c
set info [proj c $x $y $z]
set x 11.0
set y -6.0
set z 5.0
-set pp_ch1 0.22894170490369878
-set pp_ch2 1.7710582950963012
+set pp_ch1 0.22894170490369881
+set pp_ch2 1.0000000014907082
restore [locate_data_file bug23706_c03.draw] c
set info [proj c $x $y $z]
set y 8.0
set z -2.0
set pp_ch1 1
-set pp_ch2 1
-set pp_ch3 1.1865241781930462
+set pp_ch2 1.1865241781930462
restore [locate_data_file bug23706_c03.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set y 4.0
set z 1.0
set pp_ch1 0
-set pp_ch2 1
-set pp_ch3 1
restore [locate_data_file bug23706_c03.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
-regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set y -6.0
set z 5.0
set pp_ch1 0.22894170490369881
-set pp_ch2 1.7710582950963012
+set pp_ch2 1.0000000014907084
restore [locate_data_file bug23706_c04.draw] c
set info [proj c $x $y $z]
set x 5.0
set y 8.0
set z -2.0
-set pp_ch1 0.81347582180695399
+set pp_ch1 0.81347582180695377
set pp_ch2 1
-set pp_ch3 1
restore [locate_data_file bug23706_c04.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set x -4.0
set y 4.0
set z 1.0
-set pp_ch1 1
-set pp_ch2 1
-set pp_ch3 2
+set pp_ch1 2
restore [locate_data_file bug23706_c04.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
-regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set y -6.0
set z 5.0
set pp_ch1 0.22894170490369881
-set pp_ch2 1.7205732840814361
+set pp_ch2 1.0000000014908634
restore [locate_data_file bug23706_c05.draw] c
set info [proj c $x $y $z]
set y 8.0
set z -2.0
set pp_ch1 1
-set pp_ch2 1
-set pp_ch3 1.0371228345434986
+set pp_ch2 1.0371228345434986
restore [locate_data_file bug23706_c05.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set y 4.0
set z 1.0
set pp_ch1 0
-set pp_ch2 1
-set pp_ch3 1
restore [locate_data_file bug23706_c05.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
-regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set x -3.0
set y 15.0
set z -9.0
-set pp_ch 0.31967360381308058
+set pp_ch 0.31967360381308063
restore [locate_data_file bug23706_c07.draw] c
set info [proj c $x $y $z]
set x 5.0
set y 8.0
set z -2.0
-set pp_ch1 1
-set pp_ch2 1
-set pp_ch3 1.0371228345434986
+set pp_ch1 1.0371228345434986
+set pp_ch2 0.99999999682789309
+set pp_ch3 0.99999999486742297
restore [locate_data_file bug23706_c07.draw] c
set info [proj c $x $y $z]
set y 4.0
set z 1.0
set pp_ch1 0.034819847916144751
-set pp_ch2 1
-set pp_ch3 1
restore [locate_data_file bug23706_c07.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
-regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set x 5.0
set y 8.0
set z -2.0
-set pp_ch1 1
-set pp_ch2 1
-set pp_ch3 1.0371228345434986
+set pp_ch1 1.0371228345434986
+set pp_ch2 0.99999999851019361
+set pp_ch3 1.0000000000000002
restore [locate_data_file bug23706_c08.draw] c
set info [proj c $x $y $z]
set x -4.0
set y 4.0
set z 1.0
-set pp_ch1 0.087689905182099182
-set pp_ch2 1
-set pp_ch3 1
+set pp_ch1 0.087689905182099168
restore [locate_data_file bug23706_c08.draw] c
set info [proj c $x $y $z]
regexp {parameter 1 += +([-0-9.+eE]+)} $info full pp1
-regexp {parameter 2 += +([-0-9.+eE]+)} $info full pp2
-regexp {parameter 3 += +([-0-9.+eE]+)} $info full pp3
-if { $pp1 != $pp_ch1 || $pp2 != $pp_ch2 || $pp3 != $pp_ch3 } {
+if { $pp1 != $pp_ch1 } {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set pp_ch2 2.7514388736312116
set pp_ch3 3.5195936992321921
set pp_ch4 3.9600115496393977
-set pp_ch5 5.4999999987220543
-set pp_ch6 6.8388132447593541
+set pp_ch5 5.5000000059308434
+set pp_ch6 6.838813244759355
set pp_ch7 7.8261046366621292
restore [locate_data_file bug23706_c11.draw] c
set x 5.0
set y 7.0
set z 8.0
-set pp_ch1 2.8126840147763663
-set pp_ch2 3.5195936992321926
-set pp_ch3 3.9600115496393977
-set pp_ch4 5.4999999987220543
-set pp_ch5 7.2883607799598096
-set pp_ch6 1
+set pp_ch1 1
+set pp_ch2 2.8126840147763663
+set pp_ch3 3.5195936992321926
+set pp_ch4 3.9600115496393977
+set pp_ch5 5.5000000059308434
+set pp_ch6 7.2883607799598096
restore [locate_data_file bug23706_c11.draw] c
set info [proj c $x $y $z]
set x 11.0
set y -2.0
set z -2.0
-set pp_ch1 2.9473269594602054
+set pp_ch1 2.947326959460205
set pp_ch2 4.4416670680933228
-set pp_ch3 5.4999999987220543
+set pp_ch3 5.5000000000000036
set pp_ch4 6.6582576262308306
set pp_ch5 7.7414573419084736
set z 2.0
set pp_ch1 1.1738953633378706
set pp_ch2 2.1611867552406454
-set pp_ch3 3.5000000012779413
+set pp_ch3 3.5000000059308389
set pp_ch4 5.0399884503606023
set pp_ch5 5.4804063007678074
-set pp_ch6 6.2485611263687888
-set pp_ch7 6.7381612209715556
+set pp_ch6 1.1738953633378706
restore [locate_data_file bug23706_c12.draw] c
set info [proj c $x $y $z]
regexp {parameter 4 += +([-0-9.+eE]+)} $info full pp4
regexp {parameter 5 += +([-0-9.+eE]+)} $info full pp5
regexp {parameter 6 += +([-0-9.+eE]+)} $info full pp6
-regexp {parameter 7 += +([-0-9.+eE]+)} $info full pp7
if { $pp1 != $pp_ch1 ||
$pp2 != $pp_ch2 ||
$pp3 != $pp_ch3 ||
$pp4 != $pp_ch4 ||
$pp5 != $pp_ch5 ||
- $pp6 != $pp_ch6 ||
- $pp7 != $pp_ch7} {
+ $pp6 != $pp_ch6} {
puts "Error : Projection is not correct"
} else {
puts "OK: Projection is correct"
set y 7.0
set z 8.0
set pp_ch1 1.7116392200401909
-set pp_ch2 3.5000000012779413
+set pp_ch2 3.5000000059308389
set pp_ch3 5.0399884503606023
set pp_ch4 5.4804063007678074
set pp_ch5 6.1873159852236332
set z -2.0
set pp_ch1 1.2585426580915264
set pp_ch2 2.3417423737691694
-set pp_ch3 3.499999996505935
+set pp_ch3 3.4999999999999991
set pp_ch4 4.5583329319066772
set pp_ch5 6.052673040539795
set pp_ch1 1.8318851868378956
set pp_ch2 3.0397214383562297
set pp_ch3 5.5
-set pp_ch4 6.8388132447593541
+set pp_ch4 6.838813244759355
set pp_ch5 7.8261046366621292
restore [locate_data_file bug23706_c13.draw] c
set x 5.0
set y 7.0
set z 8.0
-set pp_ch1 3.0397214383562297
-set pp_ch2 5.5
-set pp_ch3 7.2883607799598096
-set pp_ch4 1
+set pp_ch1 1
+set pp_ch2 3.0397214383562297
+set pp_ch3 5.5
+set pp_ch4 7.2883607799598096
restore [locate_data_file bug23706_c13.draw] c
set info [proj c $x $y $z]
set z -2.0
set pp_ch1 2.2389225099869194
set pp_ch2 3.219764556283669
-set pp_ch3 5.5
+set pp_ch3 5.4999999999999991
set pp_ch4 6.6582576262308306
set pp_ch5 7.7414573419084736
set y 7.0
set z 8.0
set pp_ch1 1.7116392200401909
-set pp_ch2 3.5000000000000004
+set pp_ch2 3.5
set pp_ch3 5.9602785616437703
set pp_ch4 8
set z -2.0
set pp_ch1 1.2585426580915264
set pp_ch2 2.3417423737691694
-set pp_ch3 3.5000000000000004
+set pp_ch3 3.4999999999999991
set pp_ch4 5.7802354437163306
set pp_ch5 6.761077490013081
--- /dev/null
+puts "========"
+puts "CR26351"
+puts "========"
+puts ""
+#######################################################################
+# Wrong result found by the projection algorithm
+#######################################################################
+
+restore [locate_data_file bug26351_loire_e.brep] e
+
+# 1
+
+mkcurve c e
+
+set x 167.52026394441
+set y -1206.50315237977
+set z 0
+
+proj c $x $y $z
+
+regexp {The length ext_12 is +([0-9.+eE]+)} [length ext_12] full l_12
+
+# 2
+
+vertex v $x $y $z
+vertex vc 48135.477492688588 e
+
+distmini d v vc
+
+set distmin [dval d_val]
+
+# Check results
+
+set tol_abs 1.0e-07
+set tol_rel 0.01
+
+set expected_l_12 29.450809988644483
+set expected_distmin 3.1958945321254297e-12
+
+checkreal "Length l_12" ${l_12} ${expected_l_12} ${tol_abs} ${tol_rel}
+checkreal "Minimal distance" ${distmin} ${expected_distmin} ${tol_abs} ${tol_rel}
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: NBSHAPES : Faulty"
puts "TODO CR23096 ALL: TOLERANCE : Faulty"
-
+puts "TODO CR23096 ALL: LABELS : Faulty"
set filename sim6049.igs
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 6 ( 2819 ) Summary = 6 ( 2819 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 7 ( 2820 ) Summary = 7 ( 2820 )
CHECKSHAPE : Wires = 4 ( 6 ) Faces = 4 ( 6 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3785 ( 3785 ) Summary = 69461 ( 69485 )
-STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3785 ( 3785 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 30982 ( 30997 )
-TOLERANCE : MaxTol = 0.08172710091 ( 0.05040240237 ) AvgTol = 0.000605864669 ( 0.0006023709171 )
-LABELS : N0Labels = 3785 ( 3785 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 3785 ( 3785 ) NameLabels = 3785 ( 3785 ) ColorLabels = 3785 ( 3785 ) LayerLabels = 3785 ( 3785 )
+NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3786 ( 3786 ) Summary = 69468 ( 69491 )
+STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 3786 ( 3786 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 30984 ( 30999 )
+TOLERANCE : MaxTol = 0.08172710091 ( 0.05040240237 ) AvgTol = 0.0006058177695 ( 0.0006024184165 )
+LABELS : N0Labels = 3785 ( 3785 ) N1Labels = 2 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 3787 ( 3785 ) NameLabels = 3785 ( 3785 ) ColorLabels = 3786 ( 3785 ) LayerLabels = 3786 ( 3785 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 6 ( 6 )
COLORS : Colors = BLUE1 CYAN1 GREEN MAGENTA1 RED YELLOW ( BLUE1 CYAN1 GREEN MAGENTA1 RED YELLOW )
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: TPSTAT : Faulty"
-
set filename bm4_ct_punch.stp
set ref_data {
-DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 63 ( 7 ) Summary = 63 ( 7 )
+DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 4 ) Summary = 0 ( 4 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 32 ( 7 ) Summary = 32 ( 7 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) Summary = 1444 ( 1443 )
-STATSHAPE : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 574 ( 573 )
-TOLERANCE : MaxTol = 0.004833959886 ( 0.01857875727 ) AvgTol = 0.0001319661036 ( 0.0004088626406 )
+NBSHAPES : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) Summary = 1443 ( 1443 )
+STATSHAPE : Solid = 3 ( 3 ) Shell = 21 ( 21 ) Face = 197 ( 197 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 573 ( 573 )
+TOLERANCE : MaxTol = 0.255769437 ( 0.255769437 ) AvgTol = 0.0008786095241 ( 0.001031806589 )
LABELS : N0Labels = 6 ( 6 ) N1Labels = 45 ( 45 ) N2Labels = 0 ( 0 ) TotalLabels = 51 ( 51 ) NameLabels = 11 ( 11 ) ColorLabels = 41 ( 41 ) LayerLabels = 21 ( 21 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 4 ( 4 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 2 ( 24 ) Summary = 2 ( 24 )
+TPSTAT : Faulties = 0 ( 0 ) Warnings = 1 ( 26 ) Summary = 1 ( 26 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 415 ( 415 ) Summary = 2769 ( 2754 )
STATSHAPE : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 415 ( 415 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 1190 ( 1175 )
-TOLERANCE : MaxTol = 0.09895712553 ( 0.9492387908 ) AvgTol = 0.01303492802 ( 0.03965300183 )
+TOLERANCE : MaxTol = 0.09895712553 ( 0.9492387908 ) AvgTol = 0.01313889085 ( 0.04014418394 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 28 ( 28 ) N2Labels = 0 ( 0 ) TotalLabels = 29 ( 29 ) NameLabels = 1 ( 1 ) ColorLabels = 29 ( 29 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 1 ( 1 ) Volume = 1 ( 1 ) Area = 1 ( 1 )
NCOLORS : NColors = 2 ( 2 )
#D4----------------------------------------------
-puts "TODO OCC22803 All:Faulty shapes in variables faulty_1 to faulty_4"
+puts "TODO OCC22803 All:Faulty shapes in variables faulty_1 to"
plane pt 0 0 0 1 0 0
ptorus pt pt 15 12
nexplode f f
depouille result f 0 0 1 f_4 5 0 0 40 0 0 1
-set square 10850.6
+set square 10112.2
#D5----------------------------------------------
-puts "TODO OCC22803 All:Faulty shapes in variables faulty_1 to faulty_4"
+puts "TODO OCC22803 All:Faulty shapes in variables faulty_1 to"
plane pt 0 0 0 1 0 0
ptorus pt pt 15 15
nexplode f f
depouille result f 0 0 1 f_6 5 0 0 44 0 0 1
-set square 13239.6
+set square 9979.48