Protection from normalization of the null vector.
Test cases for the issue.
{
gp_Vec Norm = aVecD1U.Crossed (aVecD1V);
Standard_Real tt = Norm.Magnitude();
- tt = Abs (Norm.Dot (V)) / (tt * Par);
- if (tt > maxscal)
+ if (tt > gp::Resolution())
{
- maxscal = tt;
- L = gp_Lin (P, V);
- _Par = Par;
- ptfound = Standard_True;
- if (maxscal>0.2)
+ tt = Abs (Norm.Dot (V)) / (tt * Par);
+ if (tt > maxscal)
{
- myParamOnEdge=svmyparam;
- return 0;
+ maxscal = tt;
+ L = gp_Lin (P, V);
+ _Par = Par;
+ ptfound = Standard_True;
+ if (maxscal>0.2)
+ {
+ myParamOnEdge=svmyparam;
+ return 0;
+ }
}
}
}
{
Standard_Real paraminf = TheCurveTool::FirstParameter(C);
Standard_Real paramsup = TheCurveTool::LastParameter(C);
+ if (Precision::IsInfinite(paraminf) && Precision::IsInfinite(paramsup)) {
+ done = Standard_False;
+ return;
+ }
+ //
if(paraminf>-Precision::Infinite()) {
if(paramsup<Precision::Infinite()) {
//-- paraminf-----------paramsup
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <gp.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
gp_XYZ XYZ2=P3.XYZ()-P2.XYZ();
gp_XYZ XYZ3=P1.XYZ()-P3.XYZ();
gp_Vec NormalVector((XYZ1^XYZ2)+(XYZ2^XYZ3)+(XYZ3^XYZ1));
- NormalVector.Normalize();
+ Standard_Real aNormLen = NormalVector.Magnitude();
+ if (aNormLen < gp::Resolution()) {
+ return 0.;
+ }
+ //
+ NormalVector.Divide(aNormLen);
//-- Standard_Real PolarDistance = NormalVector * P1.XYZ();
//-- Calcul du point u,v au centre du triangle
Standard_Real u = (u1+u2+u3)/3.0;
if(v3.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
- NormalVector.Normalize();
- PolarDistance = NormalVector * Point(i1).XYZ();
+ Standard_Real aNormLen = NormalVector.Modulus();
+ if (aNormLen < gp::Resolution()) {
+ PolarDistance = 0.;
+ }
+ else {
+ NormalVector.Divide(aNormLen);
+ PolarDistance = NormalVector * Point(i1).XYZ();
+ }
}
//=======================================================================
//function : Contain
gp_XYZ XYZ2=P3.XYZ()-P2.XYZ();
gp_XYZ XYZ3=P1.XYZ()-P3.XYZ();
gp_Vec NormalVector((XYZ1^XYZ2)+(XYZ2^XYZ3)+(XYZ3^XYZ1));
- NormalVector.Normalize();
+ Standard_Real aNormLen = NormalVector.Magnitude();
+ if (aNormLen < gp::Resolution()) {
+ return 0.;
+ }
+ //
+ NormalVector.Divide(aNormLen);
//-- Calcul du point u,v au centre du triangle
Standard_Real u = (u1+u2+u3)/3.0;
Standard_Real v = (v1+v2+v3)/3.0;
if(v3.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
- NormalVector.Normalize();
- PolarDistance = NormalVector * Point(i1).XYZ();
+ Standard_Real aNormLen = NormalVector.Modulus();
+ if (aNormLen < gp::Resolution()) {
+ PolarDistance = 0.;
+ }
+ else {
+ NormalVector.Divide(aNormLen);
+ PolarDistance = NormalVector * Point(i1).XYZ();
+ }
}
//=======================================================================
//function : Contain
gp_XYZ v2=P3.XYZ()-P2.XYZ();
gp_XYZ v3=P1.XYZ()-P3.XYZ();
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
- NormalVector.Normalize();
- PolarDistance = NormalVector * P1.XYZ();
+ Standard_Real aNormLen = NormalVector.Modulus();
+ if (aNormLen < gp::Resolution()) {
+ PolarDistance = 0.;
+ }
+ else {
+ NormalVector.Divide(aNormLen);
+ PolarDistance = NormalVector * P1.XYZ();
+ }
}
--- /dev/null
+puts "========"
+puts "OCC28844"
+puts "========"
+puts ""
+#######################################################
+# Regression vs 7.1.0: Exception is raised by the solid classification algorithm
+#######################################################
+
+restore [locate_data_file bug28844_Body.brep] b
+
+point p1 0 -10 0
+
+if {![regexp "The point is" [bclassify b p1]]} {
+ puts "Error: The Solid classification algorithm fails to classify the point"
+}
+
+point p2 10 10 10
+if {![regexp "The point is" [bclassify b p2]]} {
+ puts "Error: The Solid classification algorithm fails to classify the point"
+}
+
+point p3 0 10 0
+if {![regexp "The point is" [bclassify b p3]]} {
+ puts "Error: The Solid classification algorithm fails to classify the point"
+}
--- /dev/null
+puts "========"
+puts "OCC28844"
+puts "========"
+puts ""
+#######################################################
+# Regression vs 7.1.0: Exception is raised by the solid classification algorithm
+#######################################################
+
+restore [locate_data_file bug28844_Body.brep] b
+
+if {![regexp "Faulties" [bopargcheck b]]} {
+ puts "Error: bopargcheck fails to find faulty in the shape"
+}
\ No newline at end of file
--- /dev/null
+puts "========"
+puts "OCC28844"
+puts "========"
+puts ""
+#######################################################
+# Regression vs 7.1.0: Exception is raised by the solid classification algorithm
+#######################################################
+
+restore [locate_data_file bug28844_Body.brep] b
+restore [locate_data_file bug28844_Face.brep] f
+
+bcommon result b f
+checknbshapes result -shape 1
+checkprops result -s empty
\ No newline at end of file