//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 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_Boolean isInternalVerticesMode)
: myAngle (theAngl),
myDeflection (theDefle),
myWithShare (theWithShare),
myShapetrigu (theShapetrigu),
myInshape (theInshape),
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
- myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt)
+ myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
+ myInternalVerticesMode(isInternalVerticesMode)
{
if ( myRelative )
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
//function : BRepMesh_FastDiscret
//purpose :
//=======================================================================
-BRepMesh_FastDiscret::BRepMesh_FastDiscret(const TopoDS_Shape& theShape,
- 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)
+BRepMesh_FastDiscret::BRepMesh_FastDiscret(
+ const TopoDS_Shape& theShape,
+ 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_Boolean isInternalVerticesMode)
: myAngle (theAngl),
myDeflection (theDefle),
myWithShare (theWithShare),
myShapetrigu (theShapetrigu),
myInshape (theInshape),
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
- myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt)
+ myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
+ myInternalVerticesMode(isInternalVerticesMode)
{
if ( myRelative )
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
{
OCC_CATCH_SIGNALS
- BRepMesh_FastDiscretFace aTool(GetAngle());
+ BRepMesh_FastDiscretFace aTool(GetAngle(), myInternalVerticesMode);
aTool.Perform(anAttribute);
}
catch (Standard_Failure)
{
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);
+ 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_Boolean isInternalVerticesMode = Standard_True);
//! if the boolean <relative> is True, the <br>
//! deflection used for the polygonalisation of <br>
//! <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);
+ 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_Boolean isInternalVerticesMode = Standard_True);
//! Build triangulation on the whole shape.
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
// Fast access to attributes of current face
Handle(BRepMesh_FaceAttribute) myAttribute;
TopTools_IndexedDataMapOfShapeListOfShape mySharedFaces;
+ Standard_Boolean myInternalVerticesMode;
};
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
//function : BRepMesh_FastDiscretFace
//purpose :
//=======================================================================
-BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace
- (const Standard_Real theAngle)
+BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
+ const Standard_Real theAngle,
+ const Standard_Boolean isInternalVerticesMode)
: myAngle(theAngle),
- myInternalVerticesMode(Standard_True)
+ myInternalVerticesMode(isInternalVerticesMode)
{
myAllocator = new NCollection_IncAllocator(
BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
OCC_CATCH_SIGNALS
gp_Pnt2d aPnt2d = BRep_Tool::Parameters(theVertex, myAttribute->Face());
+ // check UV values for internal vertices
+ if (myAttribute->ChangeClassifier()->Perform(aPnt2d) != TopAbs_IN)
+ return;
NCollection_Handle<FixedVExplorer> aFixedVExplorer = new FixedVExplorer(theVertex);
Standard_Integer aIndex = myAttribute->GetVertexIndex(aFixedVExplorer);
{
public:
+ //! Constructor.
+ //! @param theAngle deviation angle to be used for surface tessellation.
+ //! @param isInternalVerticesMode flag enabling/disabling internal
+ //! vertices mode.
Standard_EXPORT BRepMesh_FastDiscretFace(
- const Standard_Real theAngle);
+ const Standard_Real theAngle,
+ const Standard_Boolean isInternalVerticesMode);
Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
//=======================================================================
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
: myRelative (Standard_False),
- myInParallel (Standard_False)
+ myInParallel (Standard_False),
+ myInternalVerticesMode(Standard_True)
{
}
const Standard_Real theAngDeflection,
const Standard_Boolean isInParallel)
: myRelative (isRelative),
- myInParallel(isInParallel)
+ myInParallel(isInParallel),
+ myInternalVerticesMode(Standard_True)
{
myDeflection = theLinDeflection;
myAngle = theAngDeflection;
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
myMesh = new BRepMesh_FastDiscret(myDeflection, myAngle, aBox,
- Standard_True, Standard_True, myRelative, Standard_True, myInParallel);
+ Standard_True, Standard_True, myRelative, Standard_True,
+ myInParallel, myInternalVerticesMode);
myMesh->InitSharedFaces(myShape);
}
return myInParallel;
}
+ //! Enables/disables internal vertices mode.
+ inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
+ {
+ myInternalVerticesMode = isEnabled;
+ }
+
+ //! Returns flag indicating is internal vertices mode enabled/disabled.
+ inline Standard_Boolean IsInternalVerticesMode() const
+ {
+ return myInternalVerticesMode;
+ }
+
public: //! @name plugin API
//! Plugin interface for the Mesh Factories.
Standard_Real myMaxShapeSize;
Standard_Integer myStatus;
NCollection_Vector<TopoDS_Face> myFaces;
+ Standard_Boolean myInternalVerticesMode;
};
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
-a val angular deflection in deg (default ~28.64 deg = 0.5 rad)\n\
-relative notifies that relative deflection is used\n\
(switched off by default)\n\
+ -int_vert_off disables insertion of internal vertices into mesh\n\
+ (enabled by default)\n\
-parallel enables parallel execution (switched off by default)\n";
return 0;
}
return 0;
}
- Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
- Standard_Real aAngDeflection = 0.5;
- Standard_Boolean isRelative = Standard_False;
- Standard_Boolean isInParallel = Standard_False;
+ Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
+ Standard_Real aAngDeflection = 0.5;
+ Standard_Boolean isRelative = Standard_False;
+ Standard_Boolean isInParallel = Standard_False;
+ Standard_Boolean isIntVertices = Standard_True;
if (nbarg > 3)
{
isRelative = Standard_True;
else if (aOpt == "-parallel")
isInParallel = Standard_True;
+ else if (aOpt == "-int_vert_off")
+ isIntVertices = Standard_False;
else if (i < nbarg)
{
Standard_Real aVal = Draw::Atof(argv[i++]);
di << "Incremental Mesh, multi-threading "
<< (isInParallel ? "ON" : "OFF") << "\n";
- BRepMesh_IncrementalMesh aMesher(aShape, aLinDeflection, isRelative,
- aAngDeflection, isInParallel);
+ BRepMesh_IncrementalMesh aMesher;
+ aMesher.SetShape (aShape);
+ aMesher.SetDeflection (aLinDeflection);
+ aMesher.SetRelative (isRelative);
+ aMesher.SetAngle (aAngDeflection);
+ aMesher.SetParallel (isInParallel);
+ aMesher.SetInternalVerticesMode(isIntVertices);
+ aMesher.Perform();
di << "Meshing statuses: ";
Standard_Integer statusFlags = aMesher.GetStatusFlags();
--- /dev/null
+# test for #21593: compare number of triangles/nodes
+# produced by BRepMesh for face with internal vertices
+# depening on value of InternalVerticesMode flag.
+
+restore [locate_data_file bug21593_internal_vertices.brep] a
+
+# enable internal vertices mode
+tclean a
+incmesh a 0.1
+set trinfo_a [trinfo a]
+regexp {([0-9]+) triangles} $trinfo_a str nbtriangles_a
+regexp {([0-9]+) nodes} $trinfo_a str nbnodes_a
+
+# check triangles
+if { $nbtriangles_a != 10 } {
+ puts "Error: incorrect number of triangles in case of internal vertices mode is ON ($nbtriangles_a)"
+}
+
+# check nodes
+if { $nbnodes_a != 8 } {
+ puts "Error: incorrect number of nodes in case of internal vertices mode is ON ($nbnodes_a)"
+}
+
+
+# disable internal vertices mode
+tclean a
+incmesh a 0.1 -int_vert_off
+set trinfo_a [trinfo a]
+regexp {([0-9]+) triangles} $trinfo_a str nbtriangles_a
+regexp {([0-9]+) nodes} $trinfo_a str nbnodes_a
+
+# check triangles
+if { $nbtriangles_a != 2 } {
+ puts "Error: incorrect number of triangles in case of internal vertices mode is OFF ($nbtriangles_a)"
+}
+
+# check nodes
+if { $nbnodes_a != 4 } {
+ puts "Error: incorrect number of nodes in case of internal vertices mode is OFF ($nbnodes_a)"
+}
+