mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
17fc2918cd | ||
|
343c549aa5 | ||
|
a19922de18 |
@@ -134,6 +134,48 @@ namespace
|
||||
return myBox.IsOut(theBox);
|
||||
}
|
||||
|
||||
bool CheckSelfIntersectArea (Standard_Integer idx1, Standard_Integer idx2, const gp_Pnt2d & intPnt)
|
||||
{
|
||||
gp_XY aPrevVec;
|
||||
Standard_Real aSumS = 0.;
|
||||
const gp_XY& aRefPnt = intPnt.Coord ();
|
||||
Standard_Integer aStart = -1;
|
||||
Standard_Integer aEnd = -1;
|
||||
|
||||
// we should consider the shortest loop
|
||||
if ((idx2 - idx1) < (mySegments->Size () - idx2 + idx1))
|
||||
{
|
||||
aStart = idx1;
|
||||
aEnd = idx2;
|
||||
}
|
||||
else
|
||||
{
|
||||
aStart = idx2;
|
||||
aEnd = idx1;
|
||||
}
|
||||
|
||||
while (aStart < aEnd)
|
||||
{
|
||||
const BRepMesh_FaceChecker::Segment& aSeg = mySegments->Value (aStart);
|
||||
gp_XY aCurVec = aSeg.Point2->XY () - aRefPnt;
|
||||
|
||||
if (aCurVec.SquareModulus () > gp::Resolution () && aPrevVec.SquareModulus () > gp::Resolution ())
|
||||
{
|
||||
aSumS += aPrevVec ^ aCurVec;
|
||||
}
|
||||
|
||||
aPrevVec = aCurVec;
|
||||
|
||||
++aStart;
|
||||
if (aStart > mySegments->Upper ())
|
||||
{
|
||||
aStart = mySegments->Lower ();
|
||||
}
|
||||
}
|
||||
|
||||
return (Abs (aSumS / 2.) < myMaxLoopSize);
|
||||
}
|
||||
|
||||
//! Accepts segment with the given index in case if it fits conditions.
|
||||
virtual Standard_Boolean Accept(const Standard_Integer& theSegmentIndex)
|
||||
{
|
||||
@@ -143,9 +185,9 @@ namespace
|
||||
const BRepMesh_GeomTool::IntFlag aIntStatus = BRepMesh_GeomTool::IntSegSeg(
|
||||
mySegment->Point1->XY(), mySegment->Point2->XY(),
|
||||
aSegment.Point1->XY(), aSegment.Point2->XY(),
|
||||
Standard_False, Standard_False, aIntPnt);
|
||||
Standard_False, Standard_True, aIntPnt);
|
||||
|
||||
if (aIntStatus == BRepMesh_GeomTool::Cross)
|
||||
if (aIntStatus == BRepMesh_GeomTool::Cross || aIntStatus == BRepMesh_GeomTool::PointOnSegment)
|
||||
{
|
||||
const Standard_Real aAngle = gp_Vec2d(mySegment->Point1->XY(), mySegment->Point2->XY()).Angle(
|
||||
gp_Vec2d(aSegment.Point1->XY(), aSegment.Point2->XY()));
|
||||
@@ -155,29 +197,10 @@ namespace
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (mySelfSegmentIndex != -1)
|
||||
if (mySelfSegmentIndex != -1 &&
|
||||
CheckSelfIntersectArea (mySelfSegmentIndex, theSegmentIndex, aIntPnt))
|
||||
{
|
||||
gp_XY aPrevVec;
|
||||
Standard_Real aSumS = 0.;
|
||||
const gp_XY& aRefPnt = aIntPnt.Coord();
|
||||
for (Standard_Integer i = mySelfSegmentIndex; i < theSegmentIndex; ++i)
|
||||
{
|
||||
const BRepMesh_FaceChecker::Segment& aCurrSegment = mySegments->Value(i);
|
||||
gp_XY aCurVec = aCurrSegment.Point2->XY() - aRefPnt;
|
||||
|
||||
if (aCurVec.SquareModulus() < gp::Resolution())
|
||||
continue;
|
||||
|
||||
if (aPrevVec.SquareModulus() > gp::Resolution())
|
||||
aSumS += aPrevVec ^ aCurVec;
|
||||
|
||||
aPrevVec = aCurVec;
|
||||
}
|
||||
|
||||
if (Abs(aSumS / 2.) < myMaxLoopSize)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myIndices.Append(theSegmentIndex);
|
||||
|
@@ -342,18 +342,26 @@ BRepMesh_GeomTool::IntFlag BRepMesh_GeomTool::IntSegSeg(
|
||||
classifyPoint(theStartPnt2, theEndPnt2, theEndPnt1 )
|
||||
};
|
||||
|
||||
Standard_Integer aPosHash =
|
||||
aPointHash[0] + aPointHash[1] + aPointHash[2] + aPointHash[3];
|
||||
|
||||
// Consider case when edges have shared vertex
|
||||
if ( aPointHash[0] < 0 || aPointHash[1] < 0 )
|
||||
{
|
||||
if ( isConsiderEndPointTouch )
|
||||
return BRepMesh_GeomTool::EndPointTouch;
|
||||
if (aPosHash == -1)
|
||||
{
|
||||
// -1 means, that 2 points are equal, and 1 point is on another curve
|
||||
return BRepMesh_GeomTool::Glued;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isConsiderEndPointTouch)
|
||||
return BRepMesh_GeomTool::EndPointTouch;
|
||||
|
||||
return BRepMesh_GeomTool::NoIntersection;
|
||||
return BRepMesh_GeomTool::NoIntersection;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aPosHash =
|
||||
aPointHash[0] + aPointHash[1] + aPointHash[2] + aPointHash[3];
|
||||
|
||||
/*=========================================*/
|
||||
/* 1) hash code == 1:
|
||||
|
||||
|
19
tests/bugs/mesh/bug25589_1
Normal file
19
tests/bugs/mesh/bug25589_1
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "========="
|
||||
puts "0025589: BRepMesh_WireInterferenceChecker doesn't report all cases of self-intersecting wires"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug25589_face1507.brep] result
|
||||
|
||||
tclean result
|
||||
incmesh result 0.005
|
||||
|
||||
checktrinfo result -tri
|
||||
|
||||
vinit
|
||||
vsetdispmode 1
|
||||
vdefaults -autoTriang 0
|
||||
vdisplay result
|
||||
vfit
|
||||
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
20
tests/bugs/mesh/bug25589_2
Normal file
20
tests/bugs/mesh/bug25589_2
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "========="
|
||||
puts "0025589: BRepMesh_WireInterferenceChecker doesn't report all cases of self-intersecting wires"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug25589_face3472.brep] result
|
||||
|
||||
tclean result
|
||||
incmesh result 0.005
|
||||
|
||||
checktrinfo result -tri
|
||||
|
||||
vinit
|
||||
vsetdispmode 1
|
||||
vfront
|
||||
vdefaults -autoTriang 0
|
||||
vdisplay result
|
||||
vfit
|
||||
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
Reference in New Issue
Block a user