From 59e8fba77651420a9a37e1123689ddbfc75fb661 Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 25 Jul 2022 12:46:41 +0300 Subject: [PATCH] 0054769: isCylinder with parameters generates UNKNOWN_UserException --- src/GEOM_I/GEOM_ICanonicalRecognition_i.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GEOM_I/GEOM_ICanonicalRecognition_i.cc b/src/GEOM_I/GEOM_ICanonicalRecognition_i.cc index b7119d02f..d8ab9b288 100644 --- a/src/GEOM_I/GEOM_ICanonicalRecognition_i.cc +++ b/src/GEOM_I/GEOM_ICanonicalRecognition_i.cc @@ -290,9 +290,12 @@ CORBA::Boolean GEOM_ICanonicalRecognition_i::isEllipse(GEOM::GEOM_Object_ptr the gp_Elips aElips; if (aIsValidNormal && aIsValidOrigin && aIsValidDirX && aIsValidRad1 && aIsValidRad2) { - gp_Ax2 aAx2(gp_Pnt(theOrigin[0], theOrigin[1], theOrigin[2]), - gp_Dir(theNormal[0], theNormal[1], theNormal[2]), - gp_Dir(theDirX[0], theDirX[1], theDirX[2])); + gp_Pnt anOrigin(theOrigin[0], theOrigin[1], theOrigin[2]); + gp_XYZ aNormal(theNormal[0], theNormal[1], theNormal[2]); + gp_XYZ aDirX(theDirX[0], theDirX[1], theDirX[2]); + Standard_Boolean isCollinear = + aNormal.CrossSquareMagnitude(aDirX) < Precision::SquareConfusion(); + gp_Ax2 aAx2 = isCollinear ? gp_Ax2(anOrigin, aNormal) : gp_Ax2(anOrigin, aNormal, aDirX); aElips = gp_Elips(aAx2, theMajorRadius, theMinorRadius); } else -- 2.39.2