mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
828a75f228 |
@@ -134,48 +134,6 @@ namespace
|
|||||||
return myBox.IsOut(theBox);
|
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.
|
//! Accepts segment with the given index in case if it fits conditions.
|
||||||
virtual Standard_Boolean Accept(const Standard_Integer& theSegmentIndex)
|
virtual Standard_Boolean Accept(const Standard_Integer& theSegmentIndex)
|
||||||
{
|
{
|
||||||
@@ -185,9 +143,9 @@ namespace
|
|||||||
const BRepMesh_GeomTool::IntFlag aIntStatus = BRepMesh_GeomTool::IntSegSeg(
|
const BRepMesh_GeomTool::IntFlag aIntStatus = BRepMesh_GeomTool::IntSegSeg(
|
||||||
mySegment->Point1->XY(), mySegment->Point2->XY(),
|
mySegment->Point1->XY(), mySegment->Point2->XY(),
|
||||||
aSegment.Point1->XY(), aSegment.Point2->XY(),
|
aSegment.Point1->XY(), aSegment.Point2->XY(),
|
||||||
Standard_False, Standard_True, aIntPnt);
|
Standard_False, Standard_False, aIntPnt);
|
||||||
|
|
||||||
if (aIntStatus == BRepMesh_GeomTool::Cross || aIntStatus == BRepMesh_GeomTool::PointOnSegment)
|
if (aIntStatus == BRepMesh_GeomTool::Cross)
|
||||||
{
|
{
|
||||||
const Standard_Real aAngle = gp_Vec2d(mySegment->Point1->XY(), mySegment->Point2->XY()).Angle(
|
const Standard_Real aAngle = gp_Vec2d(mySegment->Point1->XY(), mySegment->Point2->XY()).Angle(
|
||||||
gp_Vec2d(aSegment.Point1->XY(), aSegment.Point2->XY()));
|
gp_Vec2d(aSegment.Point1->XY(), aSegment.Point2->XY()));
|
||||||
@@ -197,10 +155,29 @@ namespace
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mySelfSegmentIndex != -1 &&
|
if (mySelfSegmentIndex != -1)
|
||||||
CheckSelfIntersectArea (mySelfSegmentIndex, theSegmentIndex, aIntPnt))
|
|
||||||
{
|
{
|
||||||
return Standard_False;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myIndices.Append(theSegmentIndex);
|
myIndices.Append(theSegmentIndex);
|
||||||
|
@@ -342,26 +342,18 @@ BRepMesh_GeomTool::IntFlag BRepMesh_GeomTool::IntSegSeg(
|
|||||||
classifyPoint(theStartPnt2, theEndPnt2, theEndPnt1 )
|
classifyPoint(theStartPnt2, theEndPnt2, theEndPnt1 )
|
||||||
};
|
};
|
||||||
|
|
||||||
Standard_Integer aPosHash =
|
|
||||||
aPointHash[0] + aPointHash[1] + aPointHash[2] + aPointHash[3];
|
|
||||||
|
|
||||||
// Consider case when edges have shared vertex
|
// Consider case when edges have shared vertex
|
||||||
if ( aPointHash[0] < 0 || aPointHash[1] < 0 )
|
if ( aPointHash[0] < 0 || aPointHash[1] < 0 )
|
||||||
{
|
{
|
||||||
if (aPosHash == -1)
|
if ( isConsiderEndPointTouch )
|
||||||
{
|
return BRepMesh_GeomTool::EndPointTouch;
|
||||||
// -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:
|
/* 1) hash code == 1:
|
||||||
|
|
||||||
|
@@ -156,6 +156,13 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape,
|
|||||||
TopoDS_Shape shape = ashape;
|
TopoDS_Shape shape = ashape;
|
||||||
TopoDS_Shape newshape = anewshape;
|
TopoDS_Shape newshape = anewshape;
|
||||||
if ( shape.IsNull() || shape == newshape ) return;
|
if ( shape.IsNull() || shape == newshape ) return;
|
||||||
|
if (Apply (newshape) == shape)
|
||||||
|
{
|
||||||
|
#ifdef OCCT_DEBUG
|
||||||
|
cout << "Warning: BRepTools_ReShape::Replace: recording the shape will lead to a loop" << endl;
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (shape.Orientation() == TopAbs_REVERSED)
|
if (shape.Orientation() == TopAbs_REVERSED)
|
||||||
{
|
{
|
||||||
@@ -181,7 +188,9 @@ void BRepTools_ReShape::replace (const TopoDS_Shape& ashape,
|
|||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
if ( IsRecorded ( shape ) && ((myConsiderLocation && ! Value ( shape ).IsPartner ( newshape )) ||
|
if ( IsRecorded ( shape ) && ((myConsiderLocation && ! Value ( shape ).IsPartner ( newshape )) ||
|
||||||
(!myConsiderLocation && ! Value ( shape ).IsSame ( newshape ))))
|
(!myConsiderLocation && ! Value ( shape ).IsSame ( newshape ))))
|
||||||
|
{
|
||||||
cout << "Warning: BRepTools_ReShape::Replace: shape already recorded" << endl;
|
cout << "Warning: BRepTools_ReShape::Replace: shape already recorded" << endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myShapeToReplacement.Bind(shape, TReplacement(newshape, theKind));
|
myShapeToReplacement.Bind(shape, TReplacement(newshape, theKind));
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
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
|
|
@@ -1,20 +0,0 @@
|
|||||||
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