mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0025612: Introduce possibility to disable adaptive reconfigutation of triangles in BRepMesh
Remarks from PDN: flag has been renamed to ControlSurfaceDeflection Test-case for issue #25612
This commit is contained in:
parent
fe79003598
commit
f43eff9ffe
@ -86,16 +86,17 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret, Standard_Transient)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
||||
const Standard_Real theDefle,
|
||||
const Standard_Real theAngl,
|
||||
const Bnd_Box& theBox,
|
||||
const Standard_Boolean theWithShare,
|
||||
const Standard_Boolean theInshape,
|
||||
const Standard_Boolean theRelative,
|
||||
const Standard_Boolean theShapetrigu,
|
||||
const Standard_Boolean isInParallel,
|
||||
const Standard_Real theMinSize,
|
||||
const Standard_Boolean isInternalVerticesMode)
|
||||
const Standard_Real theDefle,
|
||||
const Standard_Real theAngl,
|
||||
const Bnd_Box& theBox,
|
||||
const Standard_Boolean theWithShare,
|
||||
const Standard_Boolean theInshape,
|
||||
const Standard_Boolean theRelative,
|
||||
const Standard_Boolean theShapetrigu,
|
||||
const Standard_Boolean isInParallel,
|
||||
const Standard_Real theMinSize,
|
||||
const Standard_Boolean isInternalVerticesMode,
|
||||
const Standard_Boolean isControlSurfaceDeflection)
|
||||
: myAngle (theAngl),
|
||||
myDeflection (theDefle),
|
||||
myWithShare (theWithShare),
|
||||
@ -106,7 +107,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||
myMinSize(theMinSize),
|
||||
myInternalVerticesMode(isInternalVerticesMode)
|
||||
myInternalVerticesMode(isInternalVerticesMode),
|
||||
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||
{
|
||||
if ( myRelative )
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
||||
@ -127,7 +129,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
||||
const Standard_Boolean theShapetrigu,
|
||||
const Standard_Boolean isInParallel,
|
||||
const Standard_Real theMinSize,
|
||||
const Standard_Boolean isInternalVerticesMode)
|
||||
const Standard_Boolean isInternalVerticesMode,
|
||||
const Standard_Boolean isControlSurfaceDeflection)
|
||||
: myAngle (theAngl),
|
||||
myDeflection (theDefle),
|
||||
myWithShare (theWithShare),
|
||||
@ -138,7 +141,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||
myMinSize(theMinSize),
|
||||
myInternalVerticesMode(isInternalVerticesMode)
|
||||
myInternalVerticesMode(isInternalVerticesMode),
|
||||
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||
{
|
||||
if ( myRelative )
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
||||
@ -202,7 +206,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize, myInternalVerticesMode);
|
||||
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize,
|
||||
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
||||
aTool.Perform(anAttribute);
|
||||
}
|
||||
catch (Standard_Failure)
|
||||
|
@ -58,16 +58,18 @@ class BRepMesh_FastDiscret : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BRepMesh_FastDiscret(const Standard_Real defle,
|
||||
const Standard_Real angle,
|
||||
const Bnd_Box& B,
|
||||
const Standard_Boolean withShare = Standard_True,
|
||||
const Standard_Boolean inshape = Standard_False,
|
||||
const Standard_Boolean relative = Standard_False,
|
||||
const Standard_Boolean shapetrigu = Standard_False,
|
||||
const Standard_Boolean isInParallel = Standard_False,
|
||||
const Standard_Real theMinSize = Precision::Confusion(),
|
||||
const Standard_Boolean isInternalVerticesMode = Standard_True);
|
||||
Standard_EXPORT BRepMesh_FastDiscret(
|
||||
const Standard_Real defle,
|
||||
const Standard_Real angle,
|
||||
const Bnd_Box& B,
|
||||
const Standard_Boolean withShare = Standard_True,
|
||||
const Standard_Boolean inshape = Standard_False,
|
||||
const Standard_Boolean relative = Standard_False,
|
||||
const Standard_Boolean shapetrigu = Standard_False,
|
||||
const Standard_Boolean isInParallel = Standard_False,
|
||||
const Standard_Real theMinSize = Precision::Confusion(),
|
||||
const Standard_Boolean isInternalVerticesMode = Standard_True,
|
||||
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
||||
|
||||
//! if the boolean <relative> is True, the <br>
|
||||
//! deflection used for the polygonalisation of <br>
|
||||
@ -81,17 +83,19 @@ public:
|
||||
//! <br>
|
||||
//! if <inshape> is True, the calculated <br>
|
||||
//! triangulation will be stored in the shape. <br>
|
||||
Standard_EXPORT BRepMesh_FastDiscret(const TopoDS_Shape& shape,
|
||||
const Standard_Real defle,
|
||||
const Standard_Real angle,
|
||||
const Bnd_Box& B,
|
||||
const Standard_Boolean withShare = Standard_True,
|
||||
const Standard_Boolean inshape = Standard_False,
|
||||
const Standard_Boolean relative = Standard_False,
|
||||
const Standard_Boolean shapetrigu = Standard_False,
|
||||
const Standard_Boolean isInParallel = Standard_False,
|
||||
const Standard_Real theMinSize = Precision::Confusion(),
|
||||
const Standard_Boolean isInternalVerticesMode = Standard_True);
|
||||
Standard_EXPORT BRepMesh_FastDiscret(
|
||||
const TopoDS_Shape& shape,
|
||||
const Standard_Real defle,
|
||||
const Standard_Real angle,
|
||||
const Bnd_Box& B,
|
||||
const Standard_Boolean withShare = Standard_True,
|
||||
const Standard_Boolean inshape = Standard_False,
|
||||
const Standard_Boolean relative = Standard_False,
|
||||
const Standard_Boolean shapetrigu = Standard_False,
|
||||
const Standard_Boolean isInParallel = Standard_False,
|
||||
const Standard_Real theMinSize = Precision::Confusion(),
|
||||
const Standard_Boolean isInternalVerticesMode = Standard_True,
|
||||
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
||||
|
||||
//! Build triangulation on the whole shape.
|
||||
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
|
||||
@ -369,6 +373,7 @@ private:
|
||||
|
||||
Standard_Real myMinSize;
|
||||
Standard_Boolean myInternalVerticesMode;
|
||||
Standard_Boolean myIsControlSurfaceDeflection;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
|
||||
|
@ -145,10 +145,12 @@ namespace
|
||||
BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
|
||||
const Standard_Real theAngle,
|
||||
const Standard_Real theMinSize,
|
||||
const Standard_Boolean isInternalVerticesMode)
|
||||
const Standard_Boolean isInternalVerticesMode,
|
||||
const Standard_Boolean isControlSurfaceDeflection)
|
||||
: myAngle(theAngle),
|
||||
myInternalVerticesMode(isInternalVerticesMode),
|
||||
myMinSize(theMinSize)
|
||||
myMinSize(theMinSize),
|
||||
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||
{
|
||||
}
|
||||
|
||||
@ -387,7 +389,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
||||
insertInternalVertices(aNewVertices, trigu);
|
||||
|
||||
//control internal points
|
||||
aDef = control(aNewVertices, trigu, Standard_False);
|
||||
if (myIsControlSurfaceDeflection)
|
||||
aDef = control(aNewVertices, trigu, Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,13 @@ public:
|
||||
//! @param theAngle deviation angle to be used for surface tessellation.
|
||||
//! @param isInternalVerticesMode flag enabling/disabling internal
|
||||
//! vertices mode.
|
||||
//! @param isControlSurfaceDeflection enables/disables adaptive
|
||||
//! reconfiguration of mesh.
|
||||
Standard_EXPORT BRepMesh_FastDiscretFace(
|
||||
const Standard_Real theAngle,
|
||||
const Standard_Real theMinSize,
|
||||
const Standard_Boolean isInternalVerticesMode);
|
||||
const Standard_Boolean isInternalVerticesMode,
|
||||
const Standard_Boolean isControlSurfaceDeflection);
|
||||
|
||||
Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
|
||||
|
||||
@ -191,6 +194,7 @@ private:
|
||||
Handle(BRepMesh_DataStructureOfDelaun) myStructure;
|
||||
|
||||
Standard_Real myMinSize;
|
||||
Standard_Boolean myIsControlSurfaceDeflection;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)
|
||||
|
@ -75,7 +75,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
||||
: myRelative (Standard_False),
|
||||
myInParallel(Standard_False),
|
||||
myMinSize (Precision::Confusion()),
|
||||
myInternalVerticesMode(Standard_True)
|
||||
myInternalVerticesMode(Standard_True),
|
||||
myIsControlSurfaceDeflection(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
@ -92,7 +93,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
|
||||
: myRelative (isRelative),
|
||||
myInParallel(isInParallel),
|
||||
myMinSize (Precision::Confusion()),
|
||||
myInternalVerticesMode(Standard_True)
|
||||
myInternalVerticesMode(Standard_True),
|
||||
myIsControlSurfaceDeflection(Standard_True)
|
||||
{
|
||||
myDeflection = theLinDeflection;
|
||||
myAngle = theAngDeflection;
|
||||
@ -149,7 +151,7 @@ void BRepMesh_IncrementalMesh::init()
|
||||
myMesh = new BRepMesh_FastDiscret(myDeflection,
|
||||
myAngle, aBox, Standard_True, Standard_True,
|
||||
myRelative, Standard_True, myInParallel, myMinSize,
|
||||
myInternalVerticesMode);
|
||||
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
||||
|
||||
myMesh->InitSharedFaces(myShape);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public: //! @name accessing to parameters.
|
||||
return myMinSize;
|
||||
}
|
||||
|
||||
//! Enables/disables internal vertices mode.
|
||||
//! Enables/disables internal vertices mode (enabled by default).
|
||||
inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
|
||||
{
|
||||
myInternalVerticesMode = isEnabled;
|
||||
@ -127,6 +127,20 @@ public: //! @name accessing to parameters.
|
||||
return myInternalVerticesMode;
|
||||
}
|
||||
|
||||
//! Enables/disables control of deflection of mesh from real surface
|
||||
//! (enabled by default).
|
||||
inline void SetControlSurfaceDeflection(const Standard_Boolean isEnabled)
|
||||
{
|
||||
myIsControlSurfaceDeflection = isEnabled;
|
||||
}
|
||||
|
||||
//! Returns flag indicating is adaptive reconfiguration
|
||||
//! of mesh enabled/disabled.
|
||||
inline Standard_Boolean IsControlSurfaceDeflection() const
|
||||
{
|
||||
return myIsControlSurfaceDeflection;
|
||||
}
|
||||
|
||||
public: //! @name plugin API
|
||||
|
||||
//! Plugin interface for the Mesh Factories.
|
||||
@ -219,6 +233,7 @@ protected:
|
||||
NCollection_Vector<TopoDS_Face> myFaces;
|
||||
Standard_Real myMinSize;
|
||||
Standard_Boolean myInternalVerticesMode;
|
||||
Standard_Boolean myIsControlSurfaceDeflection;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
|
||||
|
@ -136,6 +136,8 @@ options:\n\
|
||||
(switched off by default)\n\n\
|
||||
-int_vert_off disables insertion of internal vertices into mesh\n\
|
||||
(enabled by default)\n\
|
||||
-surf_def_off disables control of deflection of mesh from real\n\
|
||||
surface (enabled by default)\n\
|
||||
-parallel enables parallel execution (switched off by default)\n";
|
||||
return 0;
|
||||
}
|
||||
@ -147,12 +149,13 @@ options:\n\
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
|
||||
Standard_Real aAngDeflection = 0.5;
|
||||
Standard_Real aMinSize = Precision::Confusion();
|
||||
Standard_Boolean isRelative = Standard_False;
|
||||
Standard_Boolean isInParallel = Standard_False;
|
||||
Standard_Boolean isIntVertices = Standard_True;
|
||||
Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
|
||||
Standard_Real aAngDeflection = 0.5;
|
||||
Standard_Real aMinSize = Precision::Confusion();
|
||||
Standard_Boolean isRelative = Standard_False;
|
||||
Standard_Boolean isInParallel = Standard_False;
|
||||
Standard_Boolean isIntVertices = Standard_True;
|
||||
Standard_Boolean isControlSurDef = Standard_True;
|
||||
|
||||
if (nbarg > 3)
|
||||
{
|
||||
@ -170,6 +173,8 @@ options:\n\
|
||||
isInParallel = Standard_True;
|
||||
else if (aOpt == "-int_vert_off")
|
||||
isIntVertices = Standard_False;
|
||||
else if (aOpt == "-surf_def_off")
|
||||
isControlSurDef = Standard_False;
|
||||
else if (i < nbarg)
|
||||
{
|
||||
Standard_Real aVal = Draw::Atof(argv[i++]);
|
||||
@ -194,6 +199,7 @@ options:\n\
|
||||
aMesher.SetParallel (isInParallel);
|
||||
aMesher.SetMinSize (aMinSize);
|
||||
aMesher.SetInternalVerticesMode(isIntVertices);
|
||||
aMesher.SetControlSurfaceDeflection(isControlSurDef);
|
||||
aMesher.Perform();
|
||||
|
||||
di << "Meshing statuses: ";
|
||||
|
29
tests/bugs/mesh/bug25612
Normal file
29
tests/bugs/mesh/bug25612
Normal file
@ -0,0 +1,29 @@
|
||||
puts "========"
|
||||
puts "OCC25612"
|
||||
puts "========"
|
||||
puts ""
|
||||
######################################################################################
|
||||
# Introduce possibility to disable adaptive reconfigutation of triangles in BRepMesh
|
||||
######################################################################################
|
||||
|
||||
restore [locate_data_file bug25519_testtriangulation.brep] a
|
||||
|
||||
tclean a
|
||||
incmesh a 0.001
|
||||
set bug_info [trinfo a]
|
||||
set TNumber_1 [lindex $bug_info 3]
|
||||
set NNumber_1 [lindex $bug_info 5]
|
||||
|
||||
tclean a
|
||||
incmesh a 0.001 -surf_def_off
|
||||
set bug_info [trinfo a]
|
||||
set TNumber_2 [lindex $bug_info 3]
|
||||
set NNumber_2 [lindex $bug_info 5]
|
||||
|
||||
if {$TNumber_2 >= $TNumber_1} {
|
||||
puts "ERROR: OCC25612 is reproduced. Flag -surf_def_off does not work (triangles)."
|
||||
}
|
||||
|
||||
if {$NNumber_2 >= $NNumber_1} {
|
||||
puts "ERROR: OCC25612 is reproduced. Flag -surf_def_off does not work (nodes)."
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user