1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Patch for the issue #28373.

This commit is contained in:
nbv
2017-01-19 10:48:09 +03:00
parent 5d989d42c5
commit 4a258f6654
5 changed files with 70 additions and 16 deletions

View File

@@ -23,6 +23,10 @@
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
static const Standard_Real Probing_Start = 0.123;
static const Standard_Real Probing_End = 0.7;
static const Standard_Real Probing_Step = 0.2111;
//======================================================================= //=======================================================================
//function : BRepClass_FaceExplorer //function : BRepClass_FaceExplorer
//purpose : //purpose :
@@ -31,7 +35,7 @@
BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) : BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
myFace(F), myFace(F),
myCurEdgeInd(1), myCurEdgeInd(1),
myCurEdgePar(0.123) myCurEdgePar(Probing_Start)
{ {
myFace.Orientation(TopAbs_FORWARD); myFace.Orientation(TopAbs_FORWARD);
} }
@@ -56,7 +60,7 @@ Standard_Boolean BRepClass_FaceExplorer::Segment(const gp_Pnt2d& P,
Standard_Real& Par) Standard_Real& Par)
{ {
myCurEdgeInd = 1; myCurEdgeInd = 1;
myCurEdgePar = 0.123; myCurEdgePar = Probing_Start;
return OtherSegment(P, L, Par); return OtherSegment(P, L, Par);
} }
@@ -75,7 +79,7 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
Standard_Real aFPar; Standard_Real aFPar;
Standard_Real aLPar; Standard_Real aLPar;
Handle(Geom2d_Curve) aC2d; Handle(Geom2d_Curve) aC2d;
Standard_Real aTolParConf = Precision::PConfusion(); Standard_Real aTolParConf2 = Precision::PConfusion() * Precision::PConfusion();
gp_Pnt2d aPOnC; gp_Pnt2d aPOnC;
Standard_Real aParamIn; Standard_Real aParamIn;
@@ -103,32 +107,51 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
} else if (Precision::IsPositiveInfinite(aLPar)) } else if (Precision::IsPositiveInfinite(aLPar))
aLPar = aFPar + 1.; aLPar = aFPar + 1.;
for (; myCurEdgePar < 0.7 ;myCurEdgePar += 0.2111) { for (; myCurEdgePar < Probing_End ;myCurEdgePar += Probing_Step) {
aParamIn = myCurEdgePar*aFPar + (1. - myCurEdgePar)*aLPar; aParamIn = myCurEdgePar*aFPar + (1. - myCurEdgePar)*aLPar;
aC2d->D0(aParamIn, aPOnC); gp_Vec2d aTanVec;
Par = aPOnC.Distance(P); aC2d->D1(aParamIn, aPOnC, aTanVec);
Par = aPOnC.SquareDistance(P);
if (Par > aTolParConf) { if (Par > aTolParConf2) {
gp_Vec2d aLinVec(P, aPOnC); gp_Vec2d aLinVec(P, aPOnC);
gp_Dir2d aLinDir(aLinVec); gp_Dir2d aLinDir(aLinVec);
Standard_Real aTanMod = aTanVec.SquareMagnitude();
if (aTanMod < aTolParConf2)
continue;
aTanVec /= Sqrt(aTanMod);
Standard_Real aSinA = aTanVec.Crossed(aLinDir.XY());
const Standard_Real SmallAngle = 0.001;
if (Abs(aSinA) < SmallAngle)
{
// The line from the input point P to the current point on edge
// is tangent to the edge curve. This condition is bad for classification.
// Therefore try to go to another point in the hope that there will be
// no tangent. If there tangent is preserved then leave the last point in
// order to get this edge chanse to participate in classification.
if (myCurEdgePar + Probing_Step < Probing_End)
continue;
}
L = gp_Lin2d(P, aLinDir); L = gp_Lin2d(P, aLinDir);
// Check if ends of a curve lie on a line. // Check if ends of a curve lie on a line.
aC2d->D0(aFPar, aPOnC); aC2d->D0(aFPar, aPOnC);
if (L.Distance(aPOnC) > aTolParConf) { if (L.SquareDistance(aPOnC) > aTolParConf2) {
aC2d->D0(aLPar, aPOnC); aC2d->D0(aLPar, aPOnC);
if (L.Distance(aPOnC) > aTolParConf) { if (L.SquareDistance(aPOnC) > aTolParConf2) {
myCurEdgePar += 0.2111; myCurEdgePar += Probing_Step;
if (myCurEdgePar >= 0.7) { if (myCurEdgePar >= Probing_End) {
myCurEdgeInd++; myCurEdgeInd++;
myCurEdgePar = 0.123; myCurEdgePar = Probing_Start;
} }
Par = Sqrt(Par);
return Standard_True; return Standard_True;
} }
} }
@@ -139,7 +162,7 @@ Standard_Boolean BRepClass_FaceExplorer::OtherSegment(const gp_Pnt2d& P,
// This curve is not valid for line construction. Go to another edge. // This curve is not valid for line construction. Go to another edge.
myCurEdgeInd++; myCurEdgeInd++;
myCurEdgePar = 0.123; myCurEdgePar = Probing_Start;
} }
// nothing found, return an horizontal line // nothing found, return an horizontal line

View File

@@ -1,4 +1,5 @@
puts "TODO #22911 ALL: Error : The area of the resulting shape is" puts "TODO #22911 ALL: Error : The area of the resulting shape is"
puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to"
restore [locate_data_file a350] a restore [locate_data_file a350] a
restore [locate_data_file b350] b restore [locate_data_file b350] b

View File

@@ -0,0 +1,28 @@
puts "========"
puts "OCC28373"
puts "========"
puts ""
#################################################
# Incomplete section between cylinder and plane
#################################################
restore [locate_data_file bug28373_face.brep] f
restore [locate_data_file bug28373_hole.brep] h
bclearobjects
bcleartools
baddobjects f
baddtools h
bfillds
bbop rs 4
regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection rs] full nbv
if { $nbv != 0 } { puts "Error : Section is incorrect" }
bbop result 2
checkshape result
set square 5.47202
set 2dviewer 1

View File

@@ -9,8 +9,8 @@ set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 56 ( 42 ) Summary = 56 ( 42 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 56 ( 42 ) Summary = 56 ( 42 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 10 ( 10 ) Shell = 12 ( 12 ) Face = 269 ( 269 ) Summary = 1654 ( 1642 ) NBSHAPES : Solid = 11 ( 11 ) Shell = 13 ( 13 ) Face = 270 ( 270 ) Summary = 1660 ( 1646 )
STATSHAPE : Solid = 10 ( 10 ) Shell = 12 ( 12 ) Face = 269 ( 269 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 648 ( 640 ) STATSHAPE : Solid = 11 ( 11 ) Shell = 13 ( 13 ) Face = 270 ( 270 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 648 ( 640 )
TOLERANCE : MaxTol = 0.01008857123 ( 0.01008857108 ) AvgTol = 0.000308869925 ( 0.0003243299963 ) TOLERANCE : MaxTol = 0.01008857123 ( 0.01008857108 ) AvgTol = 0.000308869925 ( 0.0003243299963 )
LABELS : N0Labels = 3 ( 3 ) N1Labels = 2 ( 3 ) N2Labels = 0 ( 1 ) TotalLabels = 5 ( 7 ) NameLabels = 5 ( 5 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) LABELS : N0Labels = 3 ( 3 ) N1Labels = 2 ( 3 ) N2Labels = 0 ( 1 ) TotalLabels = 5 ( 7 ) NameLabels = 5 ( 5 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )

View File

@@ -9,5 +9,7 @@ explode s F
offsetcompshape result s -10 s_1 offsetcompshape result s -10 s_1
#real volume of result shape is unknow yet #real volume of result shape is unknow yet
puts "TODO OFF22926 ALL: The offset is not valid" puts "?TODO OFF22926 ALL: The offset is not valid"
puts "TODO OFF22926 ALL: Tcl Exception: result is not a topological shape!!!"
set volume 0 set volume 0