1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0028375: Regressions after enabling floating point signals handling in DRAW

In Bisector_BisecCC.cxx avoid division by zero when the variable N1P2P1==0.
In Bisector_BisecPC.cxx avoid creation of gp_Dir2d with zero components.
This commit is contained in:
msv 2017-01-25 18:12:18 +03:00 committed by apn
parent f114566d01
commit cbdcce0d64
2 changed files with 25 additions and 15 deletions

View File

@ -684,12 +684,13 @@ gp_Pnt2d Bisector_BisecCC::ValueAndDist (const Standard_Real U,
gp_Vec2d P2P1(P1.X() - P2.X(),P1.Y() - P2.Y());
Standard_Real SquareP2P1 = P2P1.SquareMagnitude();
Standard_Real N1P2P1 = N1.Dot(P2P1);
const Standard_Real anEps = Epsilon(1);
if (P1.IsEqual(P2,Precision::Confusion())) {
PBis = P1 ;
Dist = 0.0;
}
else if (N1P2P1*sign1 < 0) {
else if (N1P2P1*sign1 < anEps) {
Valid = Standard_False;
}
else {

View File

@ -328,26 +328,35 @@ void Bisector_BisecPC::Extension(const Standard_Real U,
gp_Vec2d& V2,
gp_Vec2d& V3 ) const
{
gp_Dir2d DirExt;
Standard_Real dU;
V1.SetCoord(0., 0.);
V2.SetCoord(0., 0.);
V3.SetCoord(0., 0.);
if ( U < startIntervals.Value(bisInterval)) {
dU = U - startIntervals.Value(bisInterval);
DirExt.SetCoord(pointStartBis.X() - point.X(),
pointStartBis.Y() - point.Y());
P.SetCoord(pointStartBis.X() + dU*DirExt.X(),
pointStartBis.Y() + dU*DirExt.Y());
if (pointStartBis.IsEqual(point, Precision::PConfusion()))
P = pointStartBis;
else {
dU = U - startIntervals.Value(bisInterval);
gp_Dir2d DirExt(pointStartBis.X() - point.X(),
pointStartBis.Y() - point.Y());
P.SetCoord(pointStartBis.X() + dU*DirExt.X(),
pointStartBis.Y() + dU*DirExt.Y());
V1.SetCoord(DirExt.X(), DirExt.Y());
}
}
else if ( U > endIntervals.Value(bisInterval)) {
dU = U - endIntervals.Value(bisInterval);
DirExt.SetCoord(point.X() - pointEndBis.X(),
point.Y() - pointEndBis.Y());
P.SetCoord(pointEndBis.X() + dU*DirExt.X(),
pointEndBis.Y() + dU*DirExt.Y());
if (pointEndBis.IsEqual(point, Precision::PConfusion()))
P = pointEndBis;
else {
dU = U - endIntervals.Value(bisInterval);
gp_Dir2d DirExt(point.X() - pointEndBis.X(),
point.Y() - pointEndBis.Y());
P.SetCoord(pointEndBis.X() + dU*DirExt.X(),
pointEndBis.Y() + dU*DirExt.Y());
V1.SetCoord(DirExt.X(), DirExt.Y());
}
}
V1.SetCoord(DirExt.X(),DirExt.Y());
V2.SetCoord(0. ,0. );
V3.SetCoord(0. ,0. );
}