1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

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 (for cases when face consists of 2 edges only).
This commit is contained in:
oan 2019-10-30 12:08:19 +03:00 committed by smoskvin
parent a24391a133
commit f73592edf0
12 changed files with 59 additions and 42 deletions

View File

@ -35,11 +35,13 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellato
//======================================================================= //=======================================================================
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();
} }
@ -52,11 +54,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();
} }
@ -97,7 +101,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(),

View File

@ -34,14 +34,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 ();
@ -96,6 +98,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

@ -49,9 +49,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);
} }
//======================================================================= //=======================================================================
@ -62,11 +63,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

@ -50,14 +50,32 @@ 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;
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()));
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb(); ++aPCurveIt)
{
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(aPCurveIt);
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
// Check that outer wire contains 2 edges or less and add an additional point.
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(0);
if (aDWire->EdgesNb() <= 2)
{
++aPointsNb;
break;
}
}
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0); const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
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);
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,6 +3,9 @@ puts "0025588: BRepMesh_ShapeTool::FindUV check for 2d points to be the same is
puts "=======" puts "======="
puts "" puts ""
puts "TODO OCC25588 All: Not connected mesh inside face 893"
puts "TODO OCC25588 All: Not connected mesh inside face 1094"
pload XDE pload XDE
stepread [locate_data_file Median_cx-fs01_bicycle.stp] a * stepread [locate_data_file Median_cx-fs01_bicycle.stp] a *

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 contains 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

@ -8,4 +8,4 @@ puts "REQUIRED ALL: Meshing statuses: SelfIntersectingWire Failure"
restore [locate_data_file bug32692.brep] s restore [locate_data_file bug32692.brep] s
incmesh s 0.01 -parallel incmesh s 0.01 -parallel
checktrinfo s -nod 7427 -tri 7457 -empty 9 -face 309 checktrinfo s -nod 7389 -tri 7419 -empty 9 -face 309

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 3059.05 set length 3057.35
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

@ -3,16 +3,8 @@ puts "OCC23625"
puts "============" puts "============"
puts "" puts ""
puts "REQUIRED All: Meshing statuses: SelfIntersectingWire Failure"
set viewname "vfront" set viewname "vfront"
set length 26411.7 set length 26411.2
restore [locate_data_file bug23625_a1.brep] a restore [locate_data_file bug23625_a1.brep] a
# workaround bug 0031426 until fix
vinit View1
vdefaults -autoTriang 0
incmesh a 7.6
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype