mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0028844: Regression vs 7.1.0: Exception is raised by the solid classification algorithm
Protection from normalization of the null vector. Test cases for the issue.
This commit is contained in:
parent
f24f542856
commit
df119b4ed9
@ -603,17 +603,20 @@ Standard_Integer BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P,
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,11 @@ void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C,
|
||||
{
|
||||
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
|
||||
|
@ -14,6 +14,7 @@
|
||||
// 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>
|
||||
@ -305,7 +306,12 @@ Standard_Real IntCurveSurface_Polyhedron::DeflectionOnTriangle (const ThePSurfac
|
||||
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;
|
||||
@ -625,8 +631,14 @@ void IntCurveSurface_Polyhedron::PlaneEquation (const Standard_Integer Triang,
|
||||
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
|
||||
|
@ -207,7 +207,12 @@ Standard_Real IntPatch_Polyhedron::DeflectionOnTriangle
|
||||
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;
|
||||
@ -548,8 +553,14 @@ void IntPatch_Polyhedron::PlaneEquation (const Standard_Integer Triang,
|
||||
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
|
||||
|
@ -33,8 +33,14 @@ void Intf::PlaneEquation (const gp_Pnt& P1,
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
25
tests/bugs/modalg_7/bug28844_1
Normal file
25
tests/bugs/modalg_7/bug28844_1
Normal file
@ -0,0 +1,25 @@
|
||||
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"
|
||||
}
|
13
tests/bugs/modalg_7/bug28844_2
Normal file
13
tests/bugs/modalg_7/bug28844_2
Normal file
@ -0,0 +1,13 @@
|
||||
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"
|
||||
}
|
14
tests/bugs/modalg_7/bug28844_3
Normal file
14
tests/bugs/modalg_7/bug28844_3
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user