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

Compare commits

...

2 Commits

Author SHA1 Message Date
oan
9cd0c77e15 0027226: Meshing algorithm fails if edge curves has small defects (bends, loops...)
Take into account tolerance of edge vertices in order to reduce density of discretization points.
2019-11-07 12:25:57 +03:00
oan
0d5b7b80e0 0028500: Artifact in shaded view of the shape increase minimum number of discretization points by one explicitly on each iteration of model healer to cover cases degenerated to line 2019-11-07 12:19:17 +03:00
13 changed files with 48 additions and 40 deletions

View File

@@ -34,11 +34,13 @@
//======================================================================= //=======================================================================
BRepMesh_CurveTessellator::BRepMesh_CurveTessellator( BRepMesh_CurveTessellator::BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge, const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters) const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
: myDEdge(theEdge), : myDEdge(theEdge),
myParameters(theParameters), myParameters(theParameters),
myEdge(theEdge->GetEdge()), myEdge(theEdge->GetEdge()),
myCurve(myEdge) myCurve(myEdge),
myMinPointsNb (theMinPointsNb)
{ {
init(); init();
} }
@@ -51,11 +53,13 @@ BRepMesh_CurveTessellator::BRepMesh_CurveTessellator (
const IMeshData::IEdgeHandle& theEdge, const IMeshData::IEdgeHandle& theEdge,
const TopAbs_Orientation theOrientation, const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace, const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters) const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
: myDEdge(theEdge), : myDEdge(theEdge),
myParameters(theParameters), myParameters(theParameters),
myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))), myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))),
myCurve(myEdge, theFace->GetFace()) myCurve(myEdge, theFace->GetFace()),
myMinPointsNb (theMinPointsNb)
{ {
init(); init();
} }
@@ -96,7 +100,8 @@ void BRepMesh_CurveTessellator::init()
myEdgeSqTol = BRep_Tool::Tolerance (myEdge); myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
myEdgeSqTol *= myEdgeSqTol; myEdgeSqTol *= myEdgeSqTol;
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287 const Standard_Integer aMinPntNb = Max(myMinPointsNb,
(myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287
myDiscretTool.Initialize (myCurve, myDiscretTool.Initialize (myCurve,
myCurve.FirstParameter(), myCurve.LastParameter(), myCurve.FirstParameter(), myCurve.LastParameter(),
@@ -225,9 +230,9 @@ Standard_Boolean BRepMesh_CurveTessellator::Value (
thePoint = myDiscretTool.Value (theIndex); thePoint = myDiscretTool.Value (theIndex);
theParameter = myDiscretTool.Parameter (theIndex); theParameter = myDiscretTool.Parameter (theIndex);
/*if (!isInToleranceOfVertex(thePoint, myFirstVertex) && if (!isInToleranceOfVertex(thePoint, myFirstVertex) &&
!isInToleranceOfVertex(thePoint, myLastVertex)) !isInToleranceOfVertex(thePoint, myLastVertex))
{*/ {
if (!myCurve.IsCurveOnSurface()) if (!myCurve.IsCurveOnSurface())
{ {
return Standard_True; return Standard_True;
@@ -263,9 +268,9 @@ Standard_Boolean BRepMesh_CurveTessellator::Value (
aSurface->D0(aUV.X(), aUV.Y(), aPntOnSurf); aSurface->D0(aUV.X(), aUV.Y(), aPntOnSurf);
return (thePoint.SquareDistance(aPntOnSurf) < myEdgeSqTol); return (thePoint.SquareDistance(aPntOnSurf) < myEdgeSqTol);
/*} }
return Standard_False;*/ return Standard_False;
} }
//======================================================================= //=======================================================================

View File

@@ -35,14 +35,16 @@ public:
//! Constructor. //! Constructor.
Standard_EXPORT BRepMesh_CurveTessellator( Standard_EXPORT BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge, const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters); const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Constructor. //! Constructor.
Standard_EXPORT BRepMesh_CurveTessellator ( Standard_EXPORT BRepMesh_CurveTessellator (
const IMeshData::IEdgeHandle& theEdge, const IMeshData::IEdgeHandle& theEdge,
const TopAbs_Orientation theOrientation, const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace, const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters); const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Destructor. //! Destructor.
Standard_EXPORT virtual ~BRepMesh_CurveTessellator (); Standard_EXPORT virtual ~BRepMesh_CurveTessellator ();
@@ -97,6 +99,7 @@ private:
const IMeshTools_Parameters& myParameters; const IMeshTools_Parameters& myParameters;
TopoDS_Edge myEdge; TopoDS_Edge myEdge;
BRepAdaptor_Curve myCurve; BRepAdaptor_Curve myCurve;
Standard_Integer myMinPointsNb;
GCPnts_TangentialDeflection myDiscretTool; GCPnts_TangentialDeflection myDiscretTool;
TopoDS_Vertex myFirstVertex; TopoDS_Vertex myFirstVertex;
TopoDS_Vertex myLastVertex; TopoDS_Vertex myLastVertex;

View File

@@ -48,9 +48,10 @@ BRepMesh_EdgeDiscret::~BRepMesh_EdgeDiscret ()
//======================================================================= //=======================================================================
Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator( Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge, const IMeshData::IEdgeHandle& theDEdge,
const IMeshTools_Parameters& theParameters) const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
{ {
return new BRepMesh_CurveTessellator(theDEdge, theParameters); return new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb);
} }
//======================================================================= //=======================================================================
@@ -61,11 +62,12 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge, const IMeshData::IEdgeHandle& theDEdge,
const TopAbs_Orientation theOrientation, const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace, const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters) const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
{ {
return theDEdge->GetSameParam() ? return theDEdge->GetSameParam() ?
new BRepMesh_CurveTessellator(theDEdge, theParameters) : new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) :
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters); new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb);
} }
//======================================================================= //=======================================================================

View File

@@ -38,14 +38,16 @@ public:
//! Creates instance of free edge tessellator. //! Creates instance of free edge tessellator.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator( Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge, const IMeshData::IEdgeHandle& theDEdge,
const IMeshTools_Parameters& theParameters); const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Creates instance of edge tessellator. //! Creates instance of edge tessellator.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator( Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge, const IMeshData::IEdgeHandle& theDEdge,
const TopAbs_Orientation theOrientation, const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace, const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters); const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Creates instance of tessellation extractor. //! Creates instance of tessellation extractor.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor( Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(

View File

@@ -49,6 +49,9 @@ namespace
void operator()(const IMeshData::IEdgePtr& theDEdge) const void operator()(const IMeshData::IEdgePtr& theDEdge) const
{ {
const IMeshData::IEdgeHandle aDEdge = theDEdge; const IMeshData::IEdgeHandle aDEdge = theDEdge;
const Standard_Integer aPointsNb = aDEdge->GetCurve()->ParametersNb();
aDEdge->Clear(Standard_True); aDEdge->Clear(Standard_True);
aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion())); aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion()));
@@ -56,7 +59,8 @@ namespace
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace(); const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
Handle(IMeshTools_CurveTessellator) aTessellator = Handle(IMeshTools_CurveTessellator) aTessellator =
BRepMesh_EdgeDiscret::CreateEdgeTessellator( BRepMesh_EdgeDiscret::CreateEdgeTessellator(
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters); aDEdge, aPCurve->GetOrientation(), aDFace,
myParameters, aPointsNb + 1);
BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False); BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False);
BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False); BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);

View File

@@ -1,6 +1,3 @@
puts "TODO 25044 ALL: SelfIntersectingWire"
puts "TODO 25044 ALL: Number of triangles is equal to 0"
puts "=======" puts "======="
puts "0025044: BRepMesh tweaks" puts "0025044: BRepMesh tweaks"
puts "=======" puts "======="

View File

@@ -1,6 +1,3 @@
puts "TODO 25044 ALL: SelfIntersectingWire"
puts "TODO 25044 ALL: Number of triangles is equal to 0"
puts "=======" puts "======="
puts "0025044: BRepMesh tweaks" puts "0025044: BRepMesh tweaks"
puts "=======" puts "======="

View File

@@ -3,22 +3,20 @@ puts "CR28500: Artifact in shaded view of the shape"
puts "=======" puts "======="
puts "" puts ""
puts "TODO CR28500 ALL: Artifact in shaded view of the shape" restore [locate_data_file bug28500_shape_mesh_artifact.brep] result
puts "TODO CR30056 ALL: Meshing statuses: SelfIntersectingWire Failure Reused"
restore [locate_data_file bug28500_shape_mesh_artifact.brep] a tclean result
incmesh result 0.01
incmesh a 0.01
vinit vinit
vsetdispmode 1 vsetdispmode 1
vdisplay a vdefaults -autoTriang 0
vdisplay result
vfit vfit
set x 150 set log [tricheck result]
set y 150 if { [llength $log] != 0 } {
if { [checkcolor $x $y 0 1 0] == 1 } { puts "Error : Mesh containg faulties"
puts "Error: Artifact in shaded view of the shape"
} }
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -19,5 +19,5 @@ isos result 0
triangles result triangles result
fit fit
checktrinfo result -tri 10886 -nod 7830 checktrinfo result -tri 10799 -nod 7799
checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png

View File

@@ -1,4 +1,4 @@
puts "TODO CR30056 ALL: Meshing statuses: SelfIntersectingWire Failure" puts "TODO CR30056 ALL: Meshing statuses: Failure"
puts "============" puts "============"
puts "OCC22849" puts "OCC22849"

View File

@@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 3060.33 set length 3058.63
testreadstep [locate_data_file bug27341_570-DWLNL-40-08-L_131LANG_16VERSATZ_DIN.stp] a testreadstep [locate_data_file bug27341_570-DWLNL-40-08-L_131LANG_16VERSATZ_DIN.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@@ -4,7 +4,7 @@ puts "============"
puts "" puts ""
set viewname "vfront" set viewname "vfront"
set length 28096.2 set length 28097.3
restore [locate_data_file bug23625_a1.brep] a restore [locate_data_file bug23625_a1.brep] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@@ -4,7 +4,7 @@ puts "============"
puts "" puts ""
set viewname "vfront" set viewname "vfront"
set length 28990.3 set length 28997.3
restore [locate_data_file bug23625_a2.brep] a restore [locate_data_file bug23625_a2.brep] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype