mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030780: [Regression to 7.3.0] BRepMesh fails triangulating one face of the shape
Added new parameter KeepSmallEdges to IMeshTools_Parameters allowing to compute min size for each edge locally, depending on the length of particular edge. Parameter -smalledges now available for incmesh command.
This commit is contained in:
parent
62810a3c51
commit
3c1b70842d
@ -26,6 +26,7 @@
|
|||||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||||
#include <Adaptor2d_HCurve2d.hxx>
|
#include <Adaptor2d_HCurve2d.hxx>
|
||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
|
#include <GCPnts_AbscissaPoint.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Constructor
|
//function : Constructor
|
||||||
@ -79,21 +80,28 @@ void BRepMesh_CurveTessellator::init()
|
|||||||
aPreciseLinDef *= 0.5;
|
aPreciseLinDef *= 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPreciseLinDef = Max(aPreciseLinDef, Precision::Confusion());
|
aPreciseLinDef = Max (aPreciseLinDef, Precision::Confusion());
|
||||||
aPreciseAngDef = Max(aPreciseAngDef, Precision::Angular());
|
aPreciseAngDef = Max (aPreciseAngDef, Precision::Angular());
|
||||||
|
|
||||||
|
Standard_Real aMinSize = myParameters.MinSize;
|
||||||
|
if (myParameters.AdjustMinSize)
|
||||||
|
{
|
||||||
|
aMinSize = Min (aMinSize, myParameters.RelMinSize() * GCPnts_AbscissaPoint::Length (
|
||||||
|
myCurve, myCurve.FirstParameter(), myCurve.LastParameter(), aPreciseLinDef));
|
||||||
|
}
|
||||||
|
|
||||||
mySquareEdgeDef = aPreciseLinDef * aPreciseLinDef;
|
mySquareEdgeDef = aPreciseLinDef * aPreciseLinDef;
|
||||||
mySquareMinSize = Max(mySquareEdgeDef, myParameters.MinSize * myParameters.MinSize);
|
mySquareMinSize = Max (mySquareEdgeDef, aMinSize * aMinSize);
|
||||||
|
|
||||||
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 = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
|
||||||
|
|
||||||
myDiscretTool.Initialize(myCurve,
|
myDiscretTool.Initialize (myCurve,
|
||||||
myCurve.FirstParameter(), myCurve.LastParameter(),
|
myCurve.FirstParameter(), myCurve.LastParameter(),
|
||||||
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
|
aPreciseAngDef, aPreciseLinDef, aMinPntNb,
|
||||||
Precision::PConfusion(), myParameters.MinSize);
|
Precision::PConfusion(), aMinSize);
|
||||||
|
|
||||||
if (myCurve.IsCurveOnSurface())
|
if (myCurve.IsCurveOnSurface())
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,8 @@ struct IMeshTools_Parameters {
|
|||||||
Relative (Standard_False),
|
Relative (Standard_False),
|
||||||
InternalVerticesMode (Standard_True),
|
InternalVerticesMode (Standard_True),
|
||||||
ControlSurfaceDeflection (Standard_True),
|
ControlSurfaceDeflection (Standard_True),
|
||||||
CleanModel(Standard_True)
|
CleanModel (Standard_True),
|
||||||
|
AdjustMinSize (Standard_False)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +79,10 @@ struct IMeshTools_Parameters {
|
|||||||
|
|
||||||
//! Cleans temporary data model when algorithm is finished.
|
//! Cleans temporary data model when algorithm is finished.
|
||||||
Standard_Boolean CleanModel;
|
Standard_Boolean CleanModel;
|
||||||
|
|
||||||
|
//! Enables/disables local adjustment of min size depending on edge size.
|
||||||
|
//! Disabled by default.
|
||||||
|
Standard_Boolean AdjustMinSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,7 +88,7 @@ options:\n\
|
|||||||
-surf_def_off disables control of deflection of mesh from real\n\
|
-surf_def_off disables control of deflection of mesh from real\n\
|
||||||
surface (enabled by default)\n\
|
surface (enabled by default)\n\
|
||||||
-parallel enables parallel execution (switched off by default)\n\
|
-parallel enables parallel execution (switched off by default)\n\
|
||||||
-adaptive enables adaptive computation of minimal value in parametric space\n";
|
-adjust_min enables local adjustment of min size depending on edge size (switched off by default)\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +121,8 @@ options:\n\
|
|||||||
aMeshParams.InternalVerticesMode = Standard_False;
|
aMeshParams.InternalVerticesMode = Standard_False;
|
||||||
else if (aOpt == "-surf_def_off")
|
else if (aOpt == "-surf_def_off")
|
||||||
aMeshParams.ControlSurfaceDeflection = Standard_False;
|
aMeshParams.ControlSurfaceDeflection = Standard_False;
|
||||||
|
else if (aOpt == "-adjust_min")
|
||||||
|
aMeshParams.AdjustMinSize = Standard_True;
|
||||||
else if (i < nbarg)
|
else if (i < nbarg)
|
||||||
{
|
{
|
||||||
Standard_Real aVal = Draw::Atof(argv[i++]);
|
Standard_Real aVal = Draw::Atof(argv[i++]);
|
||||||
|
18
tests/bugs/mesh/bug30780
Normal file
18
tests/bugs/mesh/bug30780
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
puts "========="
|
||||||
|
puts "0030780: BRepMesh fails triangulating one face of the shape"
|
||||||
|
puts "========="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
binrestore [locate_data_file bug30780_full.bin] result
|
||||||
|
|
||||||
|
tclean result
|
||||||
|
incmesh result 7.066 -a 20 -adjust_min
|
||||||
|
|
||||||
|
checktrinfo result -tri
|
||||||
|
|
||||||
|
set log [tricheck result]
|
||||||
|
if { [llength $log] != 0 } {
|
||||||
|
puts "Error : Invalid mesh"
|
||||||
|
} else {
|
||||||
|
puts "Mesh is OK"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user