mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +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
@ -95,7 +95,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
|||||||
const Standard_Boolean theShapetrigu,
|
const Standard_Boolean theShapetrigu,
|
||||||
const Standard_Boolean isInParallel,
|
const Standard_Boolean isInParallel,
|
||||||
const Standard_Real theMinSize,
|
const Standard_Real theMinSize,
|
||||||
const Standard_Boolean isInternalVerticesMode)
|
const Standard_Boolean isInternalVerticesMode,
|
||||||
|
const Standard_Boolean isControlSurfaceDeflection)
|
||||||
: myAngle (theAngl),
|
: myAngle (theAngl),
|
||||||
myDeflection (theDefle),
|
myDeflection (theDefle),
|
||||||
myWithShare (theWithShare),
|
myWithShare (theWithShare),
|
||||||
@ -106,7 +107,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
|||||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||||
myMinSize(theMinSize),
|
myMinSize(theMinSize),
|
||||||
myInternalVerticesMode(isInternalVerticesMode)
|
myInternalVerticesMode(isInternalVerticesMode),
|
||||||
|
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||||
{
|
{
|
||||||
if ( myRelative )
|
if ( myRelative )
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
||||||
@ -127,7 +129,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
|||||||
const Standard_Boolean theShapetrigu,
|
const Standard_Boolean theShapetrigu,
|
||||||
const Standard_Boolean isInParallel,
|
const Standard_Boolean isInParallel,
|
||||||
const Standard_Real theMinSize,
|
const Standard_Real theMinSize,
|
||||||
const Standard_Boolean isInternalVerticesMode)
|
const Standard_Boolean isInternalVerticesMode,
|
||||||
|
const Standard_Boolean isControlSurfaceDeflection)
|
||||||
: myAngle (theAngl),
|
: myAngle (theAngl),
|
||||||
myDeflection (theDefle),
|
myDeflection (theDefle),
|
||||||
myWithShare (theWithShare),
|
myWithShare (theWithShare),
|
||||||
@ -138,7 +141,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
|||||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||||
myMinSize(theMinSize),
|
myMinSize(theMinSize),
|
||||||
myInternalVerticesMode(isInternalVerticesMode)
|
myInternalVerticesMode(isInternalVerticesMode),
|
||||||
|
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||||
{
|
{
|
||||||
if ( myRelative )
|
if ( myRelative )
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
||||||
@ -202,7 +206,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
|
|||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize, myInternalVerticesMode);
|
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize,
|
||||||
|
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
||||||
aTool.Perform(anAttribute);
|
aTool.Perform(anAttribute);
|
||||||
}
|
}
|
||||||
catch (Standard_Failure)
|
catch (Standard_Failure)
|
||||||
|
@ -58,7 +58,8 @@ class BRepMesh_FastDiscret : public Standard_Transient
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Standard_EXPORT BRepMesh_FastDiscret(const Standard_Real defle,
|
Standard_EXPORT BRepMesh_FastDiscret(
|
||||||
|
const Standard_Real defle,
|
||||||
const Standard_Real angle,
|
const Standard_Real angle,
|
||||||
const Bnd_Box& B,
|
const Bnd_Box& B,
|
||||||
const Standard_Boolean withShare = Standard_True,
|
const Standard_Boolean withShare = Standard_True,
|
||||||
@ -67,7 +68,8 @@ public:
|
|||||||
const Standard_Boolean shapetrigu = Standard_False,
|
const Standard_Boolean shapetrigu = Standard_False,
|
||||||
const Standard_Boolean isInParallel = Standard_False,
|
const Standard_Boolean isInParallel = Standard_False,
|
||||||
const Standard_Real theMinSize = Precision::Confusion(),
|
const Standard_Real theMinSize = Precision::Confusion(),
|
||||||
const Standard_Boolean isInternalVerticesMode = Standard_True);
|
const Standard_Boolean isInternalVerticesMode = Standard_True,
|
||||||
|
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
||||||
|
|
||||||
//! if the boolean <relative> is True, the <br>
|
//! if the boolean <relative> is True, the <br>
|
||||||
//! deflection used for the polygonalisation of <br>
|
//! deflection used for the polygonalisation of <br>
|
||||||
@ -81,7 +83,8 @@ public:
|
|||||||
//! <br>
|
//! <br>
|
||||||
//! if <inshape> is True, the calculated <br>
|
//! if <inshape> is True, the calculated <br>
|
||||||
//! triangulation will be stored in the shape. <br>
|
//! triangulation will be stored in the shape. <br>
|
||||||
Standard_EXPORT BRepMesh_FastDiscret(const TopoDS_Shape& shape,
|
Standard_EXPORT BRepMesh_FastDiscret(
|
||||||
|
const TopoDS_Shape& shape,
|
||||||
const Standard_Real defle,
|
const Standard_Real defle,
|
||||||
const Standard_Real angle,
|
const Standard_Real angle,
|
||||||
const Bnd_Box& B,
|
const Bnd_Box& B,
|
||||||
@ -91,7 +94,8 @@ public:
|
|||||||
const Standard_Boolean shapetrigu = Standard_False,
|
const Standard_Boolean shapetrigu = Standard_False,
|
||||||
const Standard_Boolean isInParallel = Standard_False,
|
const Standard_Boolean isInParallel = Standard_False,
|
||||||
const Standard_Real theMinSize = Precision::Confusion(),
|
const Standard_Real theMinSize = Precision::Confusion(),
|
||||||
const Standard_Boolean isInternalVerticesMode = Standard_True);
|
const Standard_Boolean isInternalVerticesMode = Standard_True,
|
||||||
|
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
||||||
|
|
||||||
//! Build triangulation on the whole shape.
|
//! Build triangulation on the whole shape.
|
||||||
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
|
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
|
||||||
@ -369,6 +373,7 @@ private:
|
|||||||
|
|
||||||
Standard_Real myMinSize;
|
Standard_Real myMinSize;
|
||||||
Standard_Boolean myInternalVerticesMode;
|
Standard_Boolean myInternalVerticesMode;
|
||||||
|
Standard_Boolean myIsControlSurfaceDeflection;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
|
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
|
||||||
|
@ -145,10 +145,12 @@ namespace
|
|||||||
BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
|
BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
|
||||||
const Standard_Real theAngle,
|
const Standard_Real theAngle,
|
||||||
const Standard_Real theMinSize,
|
const Standard_Real theMinSize,
|
||||||
const Standard_Boolean isInternalVerticesMode)
|
const Standard_Boolean isInternalVerticesMode,
|
||||||
|
const Standard_Boolean isControlSurfaceDeflection)
|
||||||
: myAngle(theAngle),
|
: myAngle(theAngle),
|
||||||
myInternalVerticesMode(isInternalVerticesMode),
|
myInternalVerticesMode(isInternalVerticesMode),
|
||||||
myMinSize(theMinSize)
|
myMinSize(theMinSize),
|
||||||
|
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,6 +389,7 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
|||||||
insertInternalVertices(aNewVertices, trigu);
|
insertInternalVertices(aNewVertices, trigu);
|
||||||
|
|
||||||
//control internal points
|
//control internal points
|
||||||
|
if (myIsControlSurfaceDeflection)
|
||||||
aDef = control(aNewVertices, trigu, Standard_False);
|
aDef = control(aNewVertices, trigu, Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,13 @@ public:
|
|||||||
//! @param theAngle deviation angle to be used for surface tessellation.
|
//! @param theAngle deviation angle to be used for surface tessellation.
|
||||||
//! @param isInternalVerticesMode flag enabling/disabling internal
|
//! @param isInternalVerticesMode flag enabling/disabling internal
|
||||||
//! vertices mode.
|
//! vertices mode.
|
||||||
|
//! @param isControlSurfaceDeflection enables/disables adaptive
|
||||||
|
//! reconfiguration of mesh.
|
||||||
Standard_EXPORT BRepMesh_FastDiscretFace(
|
Standard_EXPORT BRepMesh_FastDiscretFace(
|
||||||
const Standard_Real theAngle,
|
const Standard_Real theAngle,
|
||||||
const Standard_Real theMinSize,
|
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);
|
Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
|
||||||
|
|
||||||
@ -191,6 +194,7 @@ private:
|
|||||||
Handle(BRepMesh_DataStructureOfDelaun) myStructure;
|
Handle(BRepMesh_DataStructureOfDelaun) myStructure;
|
||||||
|
|
||||||
Standard_Real myMinSize;
|
Standard_Real myMinSize;
|
||||||
|
Standard_Boolean myIsControlSurfaceDeflection;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)
|
DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)
|
||||||
|
@ -75,7 +75,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
|||||||
: myRelative (Standard_False),
|
: myRelative (Standard_False),
|
||||||
myInParallel(Standard_False),
|
myInParallel(Standard_False),
|
||||||
myMinSize (Precision::Confusion()),
|
myMinSize (Precision::Confusion()),
|
||||||
myInternalVerticesMode(Standard_True)
|
myInternalVerticesMode(Standard_True),
|
||||||
|
myIsControlSurfaceDeflection(Standard_True)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
|
|||||||
: myRelative (isRelative),
|
: myRelative (isRelative),
|
||||||
myInParallel(isInParallel),
|
myInParallel(isInParallel),
|
||||||
myMinSize (Precision::Confusion()),
|
myMinSize (Precision::Confusion()),
|
||||||
myInternalVerticesMode(Standard_True)
|
myInternalVerticesMode(Standard_True),
|
||||||
|
myIsControlSurfaceDeflection(Standard_True)
|
||||||
{
|
{
|
||||||
myDeflection = theLinDeflection;
|
myDeflection = theLinDeflection;
|
||||||
myAngle = theAngDeflection;
|
myAngle = theAngDeflection;
|
||||||
@ -149,7 +151,7 @@ void BRepMesh_IncrementalMesh::init()
|
|||||||
myMesh = new BRepMesh_FastDiscret(myDeflection,
|
myMesh = new BRepMesh_FastDiscret(myDeflection,
|
||||||
myAngle, aBox, Standard_True, Standard_True,
|
myAngle, aBox, Standard_True, Standard_True,
|
||||||
myRelative, Standard_True, myInParallel, myMinSize,
|
myRelative, Standard_True, myInParallel, myMinSize,
|
||||||
myInternalVerticesMode);
|
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
||||||
|
|
||||||
myMesh->InitSharedFaces(myShape);
|
myMesh->InitSharedFaces(myShape);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public: //! @name accessing to parameters.
|
|||||||
return myMinSize;
|
return myMinSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Enables/disables internal vertices mode.
|
//! Enables/disables internal vertices mode (enabled by default).
|
||||||
inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
|
inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
|
||||||
{
|
{
|
||||||
myInternalVerticesMode = isEnabled;
|
myInternalVerticesMode = isEnabled;
|
||||||
@ -127,6 +127,20 @@ public: //! @name accessing to parameters.
|
|||||||
return myInternalVerticesMode;
|
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
|
public: //! @name plugin API
|
||||||
|
|
||||||
//! Plugin interface for the Mesh Factories.
|
//! Plugin interface for the Mesh Factories.
|
||||||
@ -219,6 +233,7 @@ protected:
|
|||||||
NCollection_Vector<TopoDS_Face> myFaces;
|
NCollection_Vector<TopoDS_Face> myFaces;
|
||||||
Standard_Real myMinSize;
|
Standard_Real myMinSize;
|
||||||
Standard_Boolean myInternalVerticesMode;
|
Standard_Boolean myInternalVerticesMode;
|
||||||
|
Standard_Boolean myIsControlSurfaceDeflection;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
|
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
|
||||||
|
@ -136,6 +136,8 @@ options:\n\
|
|||||||
(switched off by default)\n\n\
|
(switched off by default)\n\n\
|
||||||
-int_vert_off disables insertion of internal vertices into mesh\n\
|
-int_vert_off disables insertion of internal vertices into mesh\n\
|
||||||
(enabled by default)\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";
|
-parallel enables parallel execution (switched off by default)\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -153,6 +155,7 @@ options:\n\
|
|||||||
Standard_Boolean isRelative = Standard_False;
|
Standard_Boolean isRelative = Standard_False;
|
||||||
Standard_Boolean isInParallel = Standard_False;
|
Standard_Boolean isInParallel = Standard_False;
|
||||||
Standard_Boolean isIntVertices = Standard_True;
|
Standard_Boolean isIntVertices = Standard_True;
|
||||||
|
Standard_Boolean isControlSurDef = Standard_True;
|
||||||
|
|
||||||
if (nbarg > 3)
|
if (nbarg > 3)
|
||||||
{
|
{
|
||||||
@ -170,6 +173,8 @@ options:\n\
|
|||||||
isInParallel = Standard_True;
|
isInParallel = Standard_True;
|
||||||
else if (aOpt == "-int_vert_off")
|
else if (aOpt == "-int_vert_off")
|
||||||
isIntVertices = Standard_False;
|
isIntVertices = Standard_False;
|
||||||
|
else if (aOpt == "-surf_def_off")
|
||||||
|
isControlSurDef = Standard_False;
|
||||||
else if (i < nbarg)
|
else if (i < nbarg)
|
||||||
{
|
{
|
||||||
Standard_Real aVal = Draw::Atof(argv[i++]);
|
Standard_Real aVal = Draw::Atof(argv[i++]);
|
||||||
@ -194,6 +199,7 @@ options:\n\
|
|||||||
aMesher.SetParallel (isInParallel);
|
aMesher.SetParallel (isInParallel);
|
||||||
aMesher.SetMinSize (aMinSize);
|
aMesher.SetMinSize (aMinSize);
|
||||||
aMesher.SetInternalVerticesMode(isIntVertices);
|
aMesher.SetInternalVerticesMode(isIntVertices);
|
||||||
|
aMesher.SetControlSurfaceDeflection(isControlSurDef);
|
||||||
aMesher.Perform();
|
aMesher.Perform();
|
||||||
|
|
||||||
di << "Meshing statuses: ";
|
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