From 5fdf69c9dbce7fdd4be9fd493290b05d6ebb5d99 Mon Sep 17 00:00:00 2001 From: ifv Date: Tue, 6 Jun 2017 09:56:24 +0300 Subject: [PATCH] 0028812: Regression. bugs modalg_6 bug28468_2 test case is crashed if CSF_FPE set to 1. Test the possibility of line creation is added --- src/GCPnts/GCPnts_DistFunction.cxx | 11 ++++++++++- src/GCPnts/GCPnts_DistFunction2d.cxx | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/GCPnts/GCPnts_DistFunction.cxx b/src/GCPnts/GCPnts_DistFunction.cxx index bcbb706b65..e927f9ce60 100644 --- a/src/GCPnts/GCPnts_DistFunction.cxx +++ b/src/GCPnts/GCPnts_DistFunction.cxx @@ -24,7 +24,16 @@ GCPnts_DistFunction::GCPnts_DistFunction(const Adaptor3d_Curve& theCurve, myU1(U1), myU2(U2) { gp_Pnt P1 = theCurve.Value(U1), P2 = theCurve.Value(U2); - myLin = gp_Lin(P1, P2.XYZ() - P1.XYZ()); + if (P1.SquareDistance(P2) > gp::Resolution()) + { + myLin = gp_Lin(P1, P2.XYZ() - P1.XYZ()); + } + else + { + //For #28812 + theCurve.D0(U1 + .01*(U2-U1), P2); + myLin = gp_Lin(P1, P2.XYZ() - P1.XYZ()); + } } // //======================================================================= diff --git a/src/GCPnts/GCPnts_DistFunction2d.cxx b/src/GCPnts/GCPnts_DistFunction2d.cxx index 3940edddc4..2222da9803 100644 --- a/src/GCPnts/GCPnts_DistFunction2d.cxx +++ b/src/GCPnts/GCPnts_DistFunction2d.cxx @@ -25,7 +25,17 @@ GCPnts_DistFunction2d::GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve, myU1(U1), myU2(U2) { gp_Pnt2d P2d1 = theCurve.Value(U1), P2d2 = theCurve.Value(U2); - myLin = gp_Lin2d(P2d1, P2d2.XY() - P2d1.XY()); + if (P2d1.SquareDistance(P2d2) > gp::Resolution()) + { + myLin = gp_Lin2d(P2d1, P2d2.XY() - P2d1.XY()); + } + else + { + //For #28812 + theCurve.D0(U1 + .01*(U2 - U1), P2d2); + myLin = gp_Lin2d(P2d1, P2d2.XY() - P2d1.XY()); + } + } //=======================================================================