mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0026664: Triangulating a very small polygon fails
Parameter for adaptive computation of minimal 2D meshing precision added in BRepMesh_IncrementalMesh API. Corresponding option -adaptive added in DRAW command All meshing parameters are collected in structure, BRepMesh_FastDiscret::Parameters, which is now used to define and manipulate parameters of the algorithm.
This commit is contained in:
parent
6b84c3f7db
commit
e71669c6e5
@ -622,8 +622,7 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
theLSNew = theLS;
|
theLSNew = theLS;
|
||||||
return iErr;
|
return iErr;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BOPCol_ListIteratorOfListOfShape aIt;
|
|
||||||
TopExp_Explorer aExp;
|
TopExp_Explorer aExp;
|
||||||
//
|
//
|
||||||
TopAbs_ShapeEnum aType = theLS.First().ShapeType();
|
TopAbs_ShapeEnum aType = theLS.First().ShapeType();
|
||||||
@ -638,8 +637,7 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
BOPTools_AlgoTools::MakeContainer
|
BOPTools_AlgoTools::MakeContainer
|
||||||
((aType == TopAbs_FACE) ? TopAbs_SHELL : TopAbs_WIRE, aShape);
|
((aType == TopAbs_FACE) ? TopAbs_SHELL : TopAbs_WIRE, aShape);
|
||||||
//
|
//
|
||||||
aIt.Initialize(theLS);
|
for (BOPCol_ListIteratorOfListOfShape aIt(theLS); aIt.More(); aIt.Next()) {
|
||||||
for (; aIt.More(); aIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS = aIt.Value();
|
const TopoDS_Shape& aS = aIt.Value();
|
||||||
aBB.Add(aShape, aS);
|
aBB.Add(aShape, aS);
|
||||||
}
|
}
|
||||||
@ -671,9 +669,9 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
aNb = aMG.Extent();
|
aNb = aMG.Extent();
|
||||||
for (i = 1; i <= aNb; ++i) {
|
for (i = 1; i <= aNb; ++i) {
|
||||||
const TopoDS_Shape& aSS = aMG(i);
|
const TopoDS_Shape& aSS = aMG(i);
|
||||||
const TopoDS_Shape& aSNew = anUnify.Generated(aSS);
|
const TopoDS_Shape& aSGen = anUnify.Generated(aSS);
|
||||||
if (!aSNew.IsNull() && !aSS.IsSame(aSNew)) {
|
if (!aSGen.IsNull() && !aSS.IsSame(aSGen)) {
|
||||||
myMapGenerated.Bind(aSS, aSNew);
|
myMapGenerated.Bind(aSS, aSGen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -681,8 +679,7 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
// build all solids from the faces
|
// build all solids from the faces
|
||||||
BOPCol_ListOfShape aLSF;
|
BOPCol_ListOfShape aLSF;
|
||||||
//
|
//
|
||||||
aIt.Initialize(theLS);
|
for (BOPCol_ListIteratorOfListOfShape aIt(theLS); aIt.More(); aIt.Next()) {
|
||||||
for (; aIt.More(); aIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS = aIt.Value();
|
const TopoDS_Shape& aS = aIt.Value();
|
||||||
//
|
//
|
||||||
aExp.Init(aS, TopAbs_FACE);
|
aExp.Init(aS, TopAbs_FACE);
|
||||||
@ -712,8 +709,7 @@ Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
|
|||||||
Standard_Integer i, aNb;
|
Standard_Integer i, aNb;
|
||||||
//
|
//
|
||||||
// map faces and solids
|
// map faces and solids
|
||||||
BOPCol_ListIteratorOfListOfShape aIt(theLSNew);
|
for (BOPCol_ListIteratorOfListOfShape aIt(theLSNew); aIt.More(); aIt.Next()) {
|
||||||
for (; aIt.More(); aIt.Next()) {
|
|
||||||
const TopoDS_Shape& aS = aIt.Value();
|
const TopoDS_Shape& aS = aIt.Value();
|
||||||
//
|
//
|
||||||
aExp.Init(aS, TopAbs_FACE);
|
aExp.Init(aS, TopAbs_FACE);
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepMesh_DiscretRoot::BRepMesh_DiscretRoot()
|
BRepMesh_DiscretRoot::BRepMesh_DiscretRoot()
|
||||||
: myDeflection (0.001),
|
: myIsDone (Standard_False)
|
||||||
myAngle (0.1),
|
|
||||||
myIsDone (Standard_False)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,30 +28,6 @@ public:
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
Standard_EXPORT virtual ~BRepMesh_DiscretRoot();
|
Standard_EXPORT virtual ~BRepMesh_DiscretRoot();
|
||||||
|
|
||||||
//! Setup linear deflection.
|
|
||||||
inline void SetDeflection(const Standard_Real theDeflection)
|
|
||||||
{
|
|
||||||
myDeflection = theDeflection;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns linear deflection.
|
|
||||||
inline Standard_Real Deflection() const
|
|
||||||
{
|
|
||||||
return myDeflection;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Setup angular deflection.
|
|
||||||
inline void SetAngle(const Standard_Real theAngle)
|
|
||||||
{
|
|
||||||
myAngle = theAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns angular deflection.
|
|
||||||
inline Standard_Real Angle() const
|
|
||||||
{
|
|
||||||
return myAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Set the shape to triangulate.
|
//! Set the shape to triangulate.
|
||||||
inline void SetShape(const TopoDS_Shape& theShape)
|
inline void SetShape(const TopoDS_Shape& theShape)
|
||||||
{
|
{
|
||||||
@ -94,8 +70,6 @@ protected:
|
|||||||
|
|
||||||
Standard_EXPORT virtual void init();
|
Standard_EXPORT virtual void init();
|
||||||
|
|
||||||
Standard_Real myDeflection;
|
|
||||||
Standard_Real myAngle;
|
|
||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
Standard_Boolean myIsDone;
|
Standard_Boolean myIsDone;
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,12 @@
|
|||||||
#include <BRepMesh_ShapeTool.hxx>
|
#include <BRepMesh_ShapeTool.hxx>
|
||||||
#include <BRepMesh_Classifier.hxx>
|
#include <BRepMesh_Classifier.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -32,7 +38,9 @@ BRepMesh_FaceAttribute::BRepMesh_FaceAttribute()
|
|||||||
myVMax (0.),
|
myVMax (0.),
|
||||||
myDeltaX (1.),
|
myDeltaX (1.),
|
||||||
myDeltaY (1.),
|
myDeltaY (1.),
|
||||||
myStatus (BRepMesh_NoError)
|
myMinStep (-1.),
|
||||||
|
myStatus (BRepMesh_NoError),
|
||||||
|
myAdaptiveMin (Standard_False)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -44,7 +52,8 @@ BRepMesh_FaceAttribute::BRepMesh_FaceAttribute()
|
|||||||
BRepMesh_FaceAttribute::BRepMesh_FaceAttribute(
|
BRepMesh_FaceAttribute::BRepMesh_FaceAttribute(
|
||||||
const TopoDS_Face& theFace,
|
const TopoDS_Face& theFace,
|
||||||
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
|
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
|
||||||
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints)
|
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints,
|
||||||
|
const Standard_Boolean theAdaptiveMin)
|
||||||
: myDefFace (0.),
|
: myDefFace (0.),
|
||||||
myUMin (0.),
|
myUMin (0.),
|
||||||
myUMax (0.),
|
myUMax (0.),
|
||||||
@ -52,7 +61,9 @@ BRepMesh_FaceAttribute::BRepMesh_FaceAttribute(
|
|||||||
myVMax (0.),
|
myVMax (0.),
|
||||||
myDeltaX (1.),
|
myDeltaX (1.),
|
||||||
myDeltaY (1.),
|
myDeltaY (1.),
|
||||||
|
myMinStep (-1.),
|
||||||
myStatus (BRepMesh_NoError),
|
myStatus (BRepMesh_NoError),
|
||||||
|
myAdaptiveMin (theAdaptiveMin),
|
||||||
myBoundaryVertices(theBoundaryVertices),
|
myBoundaryVertices(theBoundaryVertices),
|
||||||
myBoundaryPoints (theBoundaryPoints),
|
myBoundaryPoints (theBoundaryPoints),
|
||||||
myFace (theFace)
|
myFace (theFace)
|
||||||
@ -86,6 +97,32 @@ void BRepMesh_FaceAttribute::init()
|
|||||||
myFace.Orientation(TopAbs_FORWARD);
|
myFace.Orientation(TopAbs_FORWARD);
|
||||||
BRepTools::UVBounds(myFace, myUMin, myUMax, myVMin, myVMax);
|
BRepTools::UVBounds(myFace, myUMin, myUMax, myVMin, myVMax);
|
||||||
|
|
||||||
|
if (myAdaptiveMin)
|
||||||
|
{
|
||||||
|
// compute minimal UV distance
|
||||||
|
// between vertices
|
||||||
|
|
||||||
|
myMinStep = RealLast();
|
||||||
|
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
|
||||||
|
|
||||||
|
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
|
||||||
|
if (BRep_Tool::IsClosed(anEdge))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Get end points on 2d curve
|
||||||
|
gp_Pnt2d aFirst2d, aLast2d;
|
||||||
|
BRep_Tool::UVPoints(anEdge, myFace, aFirst2d, aLast2d);
|
||||||
|
Standard_Real aDist =aFirst2d.Distance(aLast2d);
|
||||||
|
if (aDist < myMinStep)
|
||||||
|
myMinStep = aDist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BRepAdaptor_Surface aSurfAdaptor(myFace, Standard_False);
|
BRepAdaptor_Surface aSurfAdaptor(myFace, Standard_False);
|
||||||
mySurface = new BRepAdaptor_HSurface(aSurfAdaptor);
|
mySurface = new BRepAdaptor_HSurface(aSurfAdaptor);
|
||||||
}
|
}
|
||||||
@ -111,7 +148,11 @@ Standard_Real BRepMesh_FaceAttribute::computeParametricTolerance(
|
|||||||
const Standard_Real theLastParam) const
|
const Standard_Real theLastParam) const
|
||||||
{
|
{
|
||||||
const Standard_Real aDeflectionUV = 1.e-05;
|
const Standard_Real aDeflectionUV = 1.e-05;
|
||||||
return Max(Precision::PConfusion(), (theLastParam - theFirstParam) * aDeflectionUV);
|
Standard_Real aPreci = (theLastParam - theFirstParam) * aDeflectionUV;
|
||||||
|
if(myAdaptiveMin && myMinStep < aPreci)
|
||||||
|
aPreci = myMinStep;
|
||||||
|
|
||||||
|
return Max(Precision::PConfusion(), aPreci);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -29,19 +29,19 @@ class BRepMesh_FaceAttribute : public Standard_Transient
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Default constructor.
|
|
||||||
Standard_EXPORT BRepMesh_FaceAttribute();
|
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
//! @param theFace face the attribute is created for.
|
//! @param theFace face the attribute is created for.
|
||||||
//! Used for default initialization. Attribute keeps reference
|
//! Used for default initialization. Attribute keeps reference
|
||||||
//! to the source face with forward orientation.
|
//! to the source face with forward orientation.
|
||||||
//! @param theBoundaryVertices shared map of shape vertices.
|
//! @param theBoundaryVertices shared map of shape vertices.
|
||||||
//! @param theBoundaryPoints shared discretization points of shape boundaries.
|
//! @param theBoundaryPoints shared discretization points of shape boundaries.
|
||||||
|
//! @param theAdaptiveMin switches on adaptive computation of minimal parametric
|
||||||
|
//! tolerance (if true).
|
||||||
Standard_EXPORT BRepMesh_FaceAttribute(
|
Standard_EXPORT BRepMesh_FaceAttribute(
|
||||||
const TopoDS_Face& theFace,
|
const TopoDS_Face& theFace,
|
||||||
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
|
const BRepMesh::HDMapOfVertexInteger& theBoundaryVertices,
|
||||||
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints);
|
const BRepMesh::HDMapOfIntegerPnt& theBoundaryPoints,
|
||||||
|
const Standard_Boolean theAdaptiveMin);
|
||||||
|
|
||||||
//! Destructor.
|
//! Destructor.
|
||||||
Standard_EXPORT virtual ~BRepMesh_FaceAttribute();
|
Standard_EXPORT virtual ~BRepMesh_FaceAttribute();
|
||||||
@ -54,11 +54,6 @@ public: //! @name main geometrical properties.
|
|||||||
return mySurface;
|
return mySurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets reference face.
|
|
||||||
inline void SetFace(const TopoDS_Face& theFace)
|
|
||||||
{
|
|
||||||
myFace = theFace;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns forward oriented face to be used for calculations.
|
//! Returns forward oriented face to be used for calculations.
|
||||||
inline const TopoDS_Face& Face() const
|
inline const TopoDS_Face& Face() const
|
||||||
@ -326,6 +321,9 @@ public: //! @name Auxiliary methods
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
BRepMesh_FaceAttribute();
|
||||||
|
|
||||||
//! Assignment operator.
|
//! Assignment operator.
|
||||||
void operator =(const BRepMesh_FaceAttribute& /*theOther*/)
|
void operator =(const BRepMesh_FaceAttribute& /*theOther*/)
|
||||||
{
|
{
|
||||||
@ -360,7 +358,9 @@ private:
|
|||||||
Standard_Real myVMax; //!< Describes maximal value in V domain
|
Standard_Real myVMax; //!< Describes maximal value in V domain
|
||||||
Standard_Real myDeltaX;
|
Standard_Real myDeltaX;
|
||||||
Standard_Real myDeltaY;
|
Standard_Real myDeltaY;
|
||||||
|
Standard_Real myMinStep;
|
||||||
Standard_Integer myStatus;
|
Standard_Integer myStatus;
|
||||||
|
Standard_Boolean myAdaptiveMin;
|
||||||
|
|
||||||
BRepMesh::HDMapOfVertexInteger myBoundaryVertices;
|
BRepMesh::HDMapOfVertexInteger myBoundaryVertices;
|
||||||
BRepMesh::HDMapOfIntegerPnt myBoundaryPoints;
|
BRepMesh::HDMapOfIntegerPnt myBoundaryPoints;
|
||||||
|
@ -73,76 +73,22 @@
|
|||||||
|
|
||||||
#define UVDEFLECTION 1.e-05
|
#define UVDEFLECTION 1.e-05
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepMesh_FastDiscret
|
//function : BRepMesh_FastDiscret
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepMesh_FastDiscret::BRepMesh_FastDiscret(
|
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
|
||||||
const Standard_Real theDefle,
|
const BRepMesh_FastDiscret::Parameters& theParams)
|
||||||
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),
|
|
||||||
myInParallel (isInParallel),
|
|
||||||
myRelative (theRelative),
|
|
||||||
myShapetrigu (theShapetrigu),
|
|
||||||
myInshape (theInshape),
|
|
||||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||||
myMinSize(theMinSize),
|
myParameters(theParams),
|
||||||
myInternalVerticesMode(isInternalVerticesMode),
|
myDtotale(0.)
|
||||||
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
{
|
||||||
{
|
if ( myParameters.Relative )
|
||||||
if ( myRelative )
|
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
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,
|
|
||||||
const Standard_Real theMinSize,
|
|
||||||
const Standard_Boolean isInternalVerticesMode,
|
|
||||||
const Standard_Boolean isControlSurfaceDeflection)
|
|
||||||
: myAngle (theAngl),
|
|
||||||
myDeflection (theDefle),
|
|
||||||
myWithShare (theWithShare),
|
|
||||||
myInParallel (isInParallel),
|
|
||||||
myRelative (theRelative),
|
|
||||||
myShapetrigu (theShapetrigu),
|
|
||||||
myInshape (theInshape),
|
|
||||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
|
||||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
|
||||||
myMinSize(theMinSize),
|
|
||||||
myInternalVerticesMode(isInternalVerticesMode),
|
|
||||||
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
|
|
||||||
{
|
|
||||||
if ( myRelative )
|
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
|
|
||||||
|
|
||||||
Perform(theShape);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : InitSharedFaces
|
//function : InitSharedFaces
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -169,7 +115,7 @@ void BRepMesh_FastDiscret::Perform(const TopoDS_Shape& theShape)
|
|||||||
aFaces.push_back(aFace);
|
aFaces.push_back(aFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSD_Parallel::ForEach(aFaces.begin(), aFaces.end(), *this, !myInParallel);
|
OSD_Parallel::ForEach(aFaces.begin(), aFaces.end(), *this, !myParameters.InParallel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,8 +132,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
|
|||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize,
|
BRepMesh_FastDiscretFace aTool(myParameters.Angle, myParameters.MinSize,
|
||||||
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
myParameters.InternalVerticesMode, myParameters.ControlSurfaceDeflection);
|
||||||
aTool.Perform(anAttribute);
|
aTool.Perform(anAttribute);
|
||||||
}
|
}
|
||||||
catch (Standard_Failure)
|
catch (Standard_Failure)
|
||||||
@ -241,32 +187,25 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
if (myAttribute.IsNull())
|
if (myAttribute.IsNull())
|
||||||
{
|
{
|
||||||
myAttribute = new BRepMesh_FaceAttribute(theFace,
|
myAttribute = new BRepMesh_FaceAttribute(theFace,
|
||||||
myBoundaryVertices, myBoundaryPoints);
|
myBoundaryVertices, myBoundaryPoints,myParameters.AdaptiveMin);
|
||||||
|
|
||||||
myAttributes.Bind(theFace, myAttribute);
|
myAttributes.Bind(theFace, myAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
BRepMesh::HIMapOfInteger& aVertexEdgeMap = myAttribute->ChangeVertexEdgeMap();
|
BRepMesh::HIMapOfInteger& aVertexEdgeMap = myAttribute->ChangeVertexEdgeMap();
|
||||||
BRepMesh::HDMapOfShapePairOfPolygon& aInternalEdges = myAttribute->ChangeInternalEdges();
|
BRepMesh::HDMapOfShapePairOfPolygon& aInternalEdges = myAttribute->ChangeInternalEdges();
|
||||||
|
|
||||||
resetDataStructure();
|
resetDataStructure();
|
||||||
|
|
||||||
if (!myWithShare)
|
|
||||||
{
|
|
||||||
myEdges.Clear();
|
|
||||||
myBoundaryVertices->Clear();
|
|
||||||
myBoundaryPoints->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real defedge;
|
Standard_Real defedge;
|
||||||
Standard_Integer nbEdge = 0;
|
Standard_Integer nbEdge = 0;
|
||||||
Standard_Real savangle = myAngle;
|
Standard_Real savangle = myParameters.Angle;
|
||||||
Standard_Real cdef;
|
Standard_Real cdef;
|
||||||
Standard_Real maxdef = 2.* BRepMesh_ShapeTool::MaxFaceTolerance(theFace);
|
Standard_Real maxdef = 2.* BRepMesh_ShapeTool::MaxFaceTolerance(theFace);
|
||||||
|
|
||||||
Standard_Real defface = 0.;
|
Standard_Real defface = 0.;
|
||||||
if (!myRelative)
|
if (!myParameters.Relative)
|
||||||
defface = Max(myDeflection, maxdef);
|
defface = Max(myParameters.Deflection, maxdef);
|
||||||
|
|
||||||
NCollection_Sequence<EdgePCurve> aPCurves;
|
NCollection_Sequence<EdgePCurve> aPCurves;
|
||||||
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
|
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
|
||||||
@ -282,7 +221,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||||
if (!myMapdefle.IsBound(aEdge))
|
if (!myMapdefle.IsBound(aEdge))
|
||||||
{
|
{
|
||||||
if (myRelative)
|
if (myParameters.Relative)
|
||||||
{
|
{
|
||||||
if (myEdges.IsBound(aEdge))
|
if (myEdges.IsBound(aEdge))
|
||||||
{
|
{
|
||||||
@ -293,9 +232,9 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
defedge = BRepMesh_ShapeTool::RelativeEdgeDeflection(
|
defedge = BRepMesh_ShapeTool::RelativeEdgeDeflection(
|
||||||
aEdge, myDeflection, myDtotale, cdef);
|
aEdge, myParameters.Deflection, myDtotale, cdef);
|
||||||
|
|
||||||
myAngle = savangle * cdef;
|
myParameters.Angle = savangle * cdef;
|
||||||
}
|
}
|
||||||
|
|
||||||
defface += defedge;
|
defface += defedge;
|
||||||
@ -303,7 +242,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
defedge = myDeflection;
|
defedge = myParameters.Deflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
defedge = Max(maxdef, defedge);
|
defedge = Max(maxdef, defedge);
|
||||||
@ -313,7 +252,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
defedge = myMapdefle(aEdge);
|
defedge = myMapdefle(aEdge);
|
||||||
if ( myRelative )
|
if ( myParameters.Relative )
|
||||||
{
|
{
|
||||||
defface += defedge;
|
defface += defedge;
|
||||||
defface = Max(maxdef, defface);
|
defface = Max(maxdef, defface);
|
||||||
@ -332,7 +271,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
aFaceEdges.Append(aEdge);
|
aFaceEdges.Append(aEdge);
|
||||||
|
|
||||||
add(aEdge, aPCurve, defedge);
|
add(aEdge, aPCurve, defedge);
|
||||||
myAngle = savangle;
|
myParameters.Angle = savangle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,22 +282,21 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
return myAttribute->GetStatus();
|
return myAttribute->GetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( myRelative )
|
if ( myParameters.Relative )
|
||||||
{
|
{
|
||||||
defface = defface / nbEdge;
|
defface = defface / nbEdge;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
defface = myDeflection;
|
defface = myParameters.Deflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( myWithShare )
|
defface = Max(maxdef, defface);
|
||||||
defface = Max(maxdef, defface);
|
|
||||||
|
|
||||||
TopLoc_Location aLoc;
|
TopLoc_Location aLoc;
|
||||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
||||||
|
|
||||||
if (!myShapetrigu || aTriangulation.IsNull())
|
if ( aTriangulation.IsNull() )
|
||||||
{
|
{
|
||||||
Standard_Real xCur, yCur;
|
Standard_Real xCur, yCur;
|
||||||
Standard_Real maxX, minX, maxY, minY;
|
Standard_Real maxX, minX, maxY, minY;
|
||||||
@ -451,7 +389,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||||
BRepMesh_WireChecker aDFaceChecker(aFace, aTol, aInternalEdges,
|
BRepMesh_WireChecker aDFaceChecker(aFace, aTol, aInternalEdges,
|
||||||
aVertexEdgeMap, myAttribute->ChangeStructure(),
|
aVertexEdgeMap, myAttribute->ChangeStructure(),
|
||||||
myumin, myumax, myvmin, myvmax, myInParallel );
|
myumin, myumax, myvmin, myvmax, myParameters.InParallel );
|
||||||
|
|
||||||
aDFaceChecker.ReCompute(aClassifier);
|
aDFaceChecker.ReCompute(aClassifier);
|
||||||
BRepMesh_Status aCheckStatus = aDFaceChecker.Status();
|
BRepMesh_Status aCheckStatus = aDFaceChecker.Status();
|
||||||
@ -556,7 +494,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
|
|
||||||
Dv = Max(1.0e0 - (defface/r),0.0e0) ;
|
Dv = Max(1.0e0 - (defface/r),0.0e0) ;
|
||||||
Standard_Real oldDv = 2.0 * ACos (Dv);
|
Standard_Real oldDv = 2.0 * ACos (Dv);
|
||||||
oldDv = Min(oldDv, myAngle);
|
oldDv = Min(oldDv, myParameters.Angle);
|
||||||
Dv = 0.9*oldDv; //TWOTHIRD * oldDv;
|
Dv = 0.9*oldDv; //TWOTHIRD * oldDv;
|
||||||
Dv = oldDv;
|
Dv = oldDv;
|
||||||
|
|
||||||
@ -568,7 +506,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
{
|
{
|
||||||
Du = Max(1.0e0 - (defface/ru),0.0e0);
|
Du = Max(1.0e0 - (defface/ru),0.0e0);
|
||||||
Du = (2.0 * ACos (Du));
|
Du = (2.0 * ACos (Du));
|
||||||
Du = Min(Du, myAngle);
|
Du = Min(Du, myParameters.Angle);
|
||||||
Standard_Real aa = sqrt(Du*Du + oldDv*oldDv);
|
Standard_Real aa = sqrt(Du*Du + oldDv*oldDv);
|
||||||
|
|
||||||
if (aa < gp::Resolution())
|
if (aa < gp::Resolution())
|
||||||
@ -604,8 +542,8 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
|||||||
Du = 0.0;
|
Du = 0.0;
|
||||||
|
|
||||||
Du = 2.0 * ACos (Du);
|
Du = 2.0 * ACos (Du);
|
||||||
if (Du > GetAngle())
|
if (Du > myParameters.Angle)
|
||||||
Du = GetAngle();
|
Du = myParameters.Angle;
|
||||||
|
|
||||||
deltaX = Du / longv;
|
deltaX = Du / longv;
|
||||||
deltaY = 1.;
|
deltaY = 1.;
|
||||||
@ -861,7 +799,7 @@ void BRepMesh_FastDiscret::update(
|
|||||||
if (aEdgeTool.IsNull())
|
if (aEdgeTool.IsNull())
|
||||||
{
|
{
|
||||||
aEdgeTool = new BRepMesh_EdgeTessellator(theEdge, myAttribute,
|
aEdgeTool = new BRepMesh_EdgeTessellator(theEdge, myAttribute,
|
||||||
mySharedFaces, theDefEdge, myAngle, myMinSize);
|
mySharedFaces, theDefEdge, myParameters.Angle, myParameters.MinSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer ipf, ivf, isvf, ipl, ivl, isvl;
|
Standard_Integer ipf, ivf, isvf, ipl, ivl, isvl;
|
||||||
|
@ -53,45 +53,68 @@ class BRepMesh_FaceAttribute;
|
|||||||
class BRepMesh_FastDiscret : public Standard_Transient
|
class BRepMesh_FastDiscret : public Standard_Transient
|
||||||
{
|
{
|
||||||
public:
|
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,
|
|
||||||
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
|
||||||
|
|
||||||
//! if the boolean <relative> is True, the <br>
|
|
||||||
//! deflection used for the polygonalisation of <br>
|
//! Structure storing meshing parameters
|
||||||
//! each edge will be <defle> * Size of Edge. <br>
|
struct Parameters {
|
||||||
//! the deflection used for the faces will be the maximum <br>
|
|
||||||
//! deflection of their edges. <br>
|
//! Default constructor
|
||||||
//! <br>
|
Parameters()
|
||||||
//! if <shapetrigu> is True, the triangulation, if exists <br>
|
:
|
||||||
//! with a correct deflection, can be used to re-triangulate <br>
|
Angle(0.1),
|
||||||
//! the shape. <br>
|
Deflection(0.001),
|
||||||
//! <br>
|
MinSize(Precision::Confusion()),
|
||||||
//! if <inshape> is True, the calculated <br>
|
InParallel(Standard_False),
|
||||||
//! triangulation will be stored in the shape. <br>
|
Relative(Standard_False),
|
||||||
Standard_EXPORT BRepMesh_FastDiscret(
|
AdaptiveMin(Standard_False),
|
||||||
const TopoDS_Shape& shape,
|
InternalVerticesMode(Standard_True),
|
||||||
const Standard_Real defle,
|
ControlSurfaceDeflection(Standard_True)
|
||||||
const Standard_Real angle,
|
{
|
||||||
const Bnd_Box& B,
|
}
|
||||||
const Standard_Boolean withShare = Standard_True,
|
|
||||||
const Standard_Boolean inshape = Standard_False,
|
//! Angular deflection
|
||||||
const Standard_Boolean relative = Standard_False,
|
Standard_Real Angle;
|
||||||
const Standard_Boolean shapetrigu = Standard_False,
|
|
||||||
const Standard_Boolean isInParallel = Standard_False,
|
//! Deflection
|
||||||
const Standard_Real theMinSize = Precision::Confusion(),
|
Standard_Real Deflection;
|
||||||
const Standard_Boolean isInternalVerticesMode = Standard_True,
|
|
||||||
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
|
//! Minimal allowed size of mesh element
|
||||||
|
Standard_Real MinSize;
|
||||||
|
|
||||||
|
//! Switches on/off multy thread computation
|
||||||
|
Standard_Boolean InParallel;
|
||||||
|
|
||||||
|
//! Switches on/off relative computation of edge tolerance<br>
|
||||||
|
//! If trur, deflection used for the polygonalisation of each edge will be
|
||||||
|
//! <defle> * Size of Edge. The deflection used for the faces will be the
|
||||||
|
//! maximum deflection of their edges.
|
||||||
|
Standard_Boolean Relative;
|
||||||
|
|
||||||
|
//! Adaptive parametric tolerance flag. <br>
|
||||||
|
//! If this flag is set to true the minimal parametric tolerance
|
||||||
|
//! is computed taking minimal parametric distance between vertices
|
||||||
|
//! into account
|
||||||
|
Standard_Boolean AdaptiveMin;
|
||||||
|
|
||||||
|
//! Mode to take or ont to take internal face vertices into account
|
||||||
|
//! in triangulation process
|
||||||
|
Standard_Boolean InternalVerticesMode;
|
||||||
|
|
||||||
|
//! Prameter to check the deviation of triangulation and interior of
|
||||||
|
//! the face
|
||||||
|
Standard_Boolean ControlSurfaceDeflection;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
//! Constructor.
|
||||||
|
//! Sets the meshing parameters and updates
|
||||||
|
//! relative defletion according to bounding box
|
||||||
|
//! @param B - bounding box encompasing shape
|
||||||
|
//! @param theParams - meshing algo parameters
|
||||||
|
Standard_EXPORT BRepMesh_FastDiscret (const Bnd_Box& B,
|
||||||
|
const Parameters& theParams);
|
||||||
|
|
||||||
//! 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);
|
||||||
@ -106,51 +129,24 @@ public:
|
|||||||
//! parallel threads.
|
//! parallel threads.
|
||||||
Standard_EXPORT void Process(const TopoDS_Face& face) const;
|
Standard_EXPORT void Process(const TopoDS_Face& face) const;
|
||||||
|
|
||||||
void operator ()(const TopoDS_Face& face) const
|
void operator () (const TopoDS_Face& face) const
|
||||||
{
|
{
|
||||||
Process(face);
|
Process(face);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Request algorithm to launch in multiple threads <br>
|
//! Returns parameters of meshing
|
||||||
//! to improve performance (should be supported by plugin). <br>
|
inline const Parameters& MeshParameters() const
|
||||||
inline void SetParallel(const Standard_Boolean theInParallel)
|
|
||||||
{
|
{
|
||||||
myInParallel = theInParallel;
|
return myParameters;
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns the multi-threading usage flag. <br>
|
|
||||||
inline Standard_Boolean IsParallel() const
|
|
||||||
{
|
|
||||||
return myInParallel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! returns the deflection value. <br>
|
|
||||||
inline Standard_Real GetDeflection() const
|
|
||||||
{
|
|
||||||
return myDeflection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns the deflection value. <br>
|
//! Returns modificable mesh parameters
|
||||||
inline Standard_Real GetAngle() const
|
inline Parameters& ChangeMeshParameters()
|
||||||
{
|
{
|
||||||
return myAngle;
|
return myParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Standard_Boolean WithShare() const
|
|
||||||
{
|
|
||||||
return myWithShare;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Standard_Boolean InShape() const
|
|
||||||
{
|
|
||||||
return myInshape;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Standard_Boolean ShapeTrigu() const
|
|
||||||
{
|
|
||||||
return myShapetrigu;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_EXPORT void InitSharedFaces(const TopoDS_Shape& theShape);
|
Standard_EXPORT void InitSharedFaces(const TopoDS_Shape& theShape);
|
||||||
|
|
||||||
inline const TopTools_IndexedDataMapOfShapeListOfShape& SharedFaces() const
|
inline const TopTools_IndexedDataMapOfShapeListOfShape& SharedFaces() const
|
||||||
@ -348,16 +344,9 @@ private:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
TopoDS_Face myFace;
|
TopoDS_Face myFace;
|
||||||
Standard_Real myAngle;
|
|
||||||
Standard_Real myDeflection;
|
|
||||||
Standard_Real myDtotale;
|
|
||||||
Standard_Boolean myWithShare;
|
|
||||||
Standard_Boolean myInParallel;
|
|
||||||
BRepMesh::DMapOfShapePairOfPolygon myEdges;
|
BRepMesh::DMapOfShapePairOfPolygon myEdges;
|
||||||
BRepMesh::DMapOfFaceAttribute myAttributes;
|
BRepMesh::DMapOfFaceAttribute myAttributes;
|
||||||
Standard_Boolean myRelative;
|
|
||||||
Standard_Boolean myShapetrigu;
|
|
||||||
Standard_Boolean myInshape;
|
|
||||||
TopTools_DataMapOfShapeReal myMapdefle;
|
TopTools_DataMapOfShapeReal myMapdefle;
|
||||||
|
|
||||||
// Data shared for whole shape
|
// Data shared for whole shape
|
||||||
@ -368,9 +357,9 @@ private:
|
|||||||
Handle(BRepMesh_FaceAttribute) myAttribute;
|
Handle(BRepMesh_FaceAttribute) myAttribute;
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape mySharedFaces;
|
TopTools_IndexedDataMapOfShapeListOfShape mySharedFaces;
|
||||||
|
|
||||||
Standard_Real myMinSize;
|
Parameters myParameters;
|
||||||
Standard_Boolean myInternalVerticesMode;
|
|
||||||
Standard_Boolean myIsControlSurfaceDeflection;
|
Standard_Real myDtotale;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
|
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)
|
||||||
|
@ -66,11 +66,9 @@ namespace
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
||||||
: myRelative (Standard_False),
|
: myMaxShapeSize(0.),
|
||||||
myInParallel(Standard_False),
|
myModified(Standard_False),
|
||||||
myMinSize (Precision::Confusion()),
|
myStatus(0)
|
||||||
myInternalVerticesMode(Standard_True),
|
|
||||||
myIsControlSurfaceDeflection(Standard_True)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,20 +76,34 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
|
|||||||
//function : Constructor
|
//function : Constructor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh( const TopoDS_Shape& theShape,
|
||||||
const TopoDS_Shape& theShape,
|
const Standard_Real theLinDeflection,
|
||||||
const Standard_Real theLinDeflection,
|
const Standard_Boolean isRelative,
|
||||||
const Standard_Boolean isRelative,
|
const Standard_Real theAngDeflection,
|
||||||
const Standard_Real theAngDeflection,
|
const Standard_Boolean isInParallel,
|
||||||
const Standard_Boolean isInParallel)
|
const Standard_Boolean adaptiveMin)
|
||||||
: myRelative (isRelative),
|
: myMaxShapeSize(0.),
|
||||||
myInParallel(isInParallel),
|
myModified(Standard_False),
|
||||||
myMinSize (Precision::Confusion()),
|
myStatus(0)
|
||||||
myInternalVerticesMode(Standard_True),
|
{
|
||||||
myIsControlSurfaceDeflection(Standard_True)
|
myParameters.Deflection = theLinDeflection;
|
||||||
|
myParameters.Relative = isRelative;
|
||||||
|
myParameters.Angle = theAngDeflection;
|
||||||
|
myParameters.InParallel = isInParallel;
|
||||||
|
myParameters.AdaptiveMin = adaptiveMin;
|
||||||
|
|
||||||
|
myShape = theShape;
|
||||||
|
Perform();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Constructor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
|
||||||
|
const BRepMesh_FastDiscret::Parameters& theParameters)
|
||||||
|
: myParameters(theParameters)
|
||||||
{
|
{
|
||||||
myDeflection = theLinDeflection;
|
|
||||||
myAngle = theAngDeflection;
|
|
||||||
myShape = theShape;
|
myShape = theShape;
|
||||||
|
|
||||||
Perform();
|
Perform();
|
||||||
@ -142,11 +154,8 @@ void BRepMesh_IncrementalMesh::init()
|
|||||||
|
|
||||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||||
|
|
||||||
myMesh = new BRepMesh_FastDiscret(myDeflection,
|
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
||||||
myAngle, aBox, Standard_True, Standard_True,
|
|
||||||
myRelative, Standard_True, myInParallel, myMinSize,
|
|
||||||
myInternalVerticesMode, myIsControlSurfaceDeflection);
|
|
||||||
|
|
||||||
myMesh->InitSharedFaces(myShape);
|
myMesh->InitSharedFaces(myShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +226,7 @@ void BRepMesh_IncrementalMesh::update()
|
|||||||
update(aFaceIt.Value());
|
update(aFaceIt.Value());
|
||||||
|
|
||||||
// Mesh faces
|
// Mesh faces
|
||||||
OSD_Parallel::ForEach(myFaces.begin(), myFaces.end(), *myMesh, !myInParallel);
|
OSD_Parallel::ForEach(myFaces.begin(), myFaces.end(), *myMesh, !myParameters.InParallel);
|
||||||
|
|
||||||
commit();
|
commit();
|
||||||
clear();
|
clear();
|
||||||
@ -244,8 +253,8 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
|||||||
|
|
||||||
BRepAdaptor_Curve aCurve(aEdge);
|
BRepAdaptor_Curve aCurve(aEdge);
|
||||||
GCPnts_TangentialDeflection aDiscret(aCurve, aCurve.FirstParameter(),
|
GCPnts_TangentialDeflection aDiscret(aCurve, aCurve.FirstParameter(),
|
||||||
aCurve.LastParameter(), myAngle, aEdgeDeflection, 2,
|
aCurve.LastParameter(), myParameters.Angle, aEdgeDeflection, 2,
|
||||||
Precision::PConfusion(), myMinSize);
|
Precision::PConfusion(), myParameters.MinSize);
|
||||||
|
|
||||||
Standard_Integer aNodesNb = aDiscret.NbPoints();
|
Standard_Integer aNodesNb = aDiscret.NbPoints();
|
||||||
TColgp_Array1OfPnt aNodes (1, aNodesNb);
|
TColgp_Array1OfPnt aNodes (1, aNodesNb);
|
||||||
@ -257,7 +266,7 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
|||||||
}
|
}
|
||||||
|
|
||||||
aPoly3D = new Poly_Polygon3D(aNodes, aUVNodes);
|
aPoly3D = new Poly_Polygon3D(aNodes, aUVNodes);
|
||||||
aPoly3D->Deflection(myDeflection);
|
aPoly3D->Deflection(myParameters.Deflection);
|
||||||
|
|
||||||
BRep_Builder aBuilder;
|
BRep_Builder aBuilder;
|
||||||
aBuilder.UpdateEdge(aEdge, aPoly3D);
|
aBuilder.UpdateEdge(aEdge, aPoly3D);
|
||||||
@ -275,14 +284,14 @@ Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
|||||||
return myEdgeDeflection(theEdge);
|
return myEdgeDeflection(theEdge);
|
||||||
|
|
||||||
Standard_Real aEdgeDeflection;
|
Standard_Real aEdgeDeflection;
|
||||||
if (myRelative)
|
if ( myParameters.Relative )
|
||||||
{
|
{
|
||||||
Standard_Real aScale;
|
Standard_Real aScale;
|
||||||
aEdgeDeflection = BRepMesh_ShapeTool::RelativeEdgeDeflection(theEdge,
|
aEdgeDeflection = BRepMesh_ShapeTool::RelativeEdgeDeflection(theEdge,
|
||||||
myDeflection, myMaxShapeSize, aScale);
|
myParameters.Deflection, myMaxShapeSize, aScale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aEdgeDeflection = myDeflection;
|
aEdgeDeflection = myParameters.Deflection;
|
||||||
|
|
||||||
myEdgeDeflection.Bind(theEdge, aEdgeDeflection);
|
myEdgeDeflection.Bind(theEdge, aEdgeDeflection);
|
||||||
return aEdgeDeflection;
|
return aEdgeDeflection;
|
||||||
@ -295,8 +304,8 @@ Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
|||||||
Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
||||||
const TopoDS_Face& theFace)
|
const TopoDS_Face& theFace)
|
||||||
{
|
{
|
||||||
if (!myRelative)
|
if ( !myParameters.Relative )
|
||||||
return myDeflection;
|
return myParameters.Deflection;
|
||||||
|
|
||||||
Standard_Integer aEdgesNb = 0;
|
Standard_Integer aEdgesNb = 0;
|
||||||
Standard_Real aFaceDeflection = 0.;
|
Standard_Real aFaceDeflection = 0.;
|
||||||
@ -308,7 +317,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
|||||||
aFaceDeflection += edgeDeflection(aEdge);
|
aFaceDeflection += edgeDeflection(aEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (aEdgesNb == 0) ? myDeflection : (aFaceDeflection / aEdgesNb);
|
return (aEdgesNb == 0) ? myParameters.Deflection : (aFaceDeflection / aEdgesNb);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -546,10 +555,10 @@ Standard_Integer BRepMesh_IncrementalMesh::Discret(
|
|||||||
BRepMesh_DiscretRoot* &theAlgo)
|
BRepMesh_DiscretRoot* &theAlgo)
|
||||||
{
|
{
|
||||||
BRepMesh_IncrementalMesh* anAlgo = new BRepMesh_IncrementalMesh();
|
BRepMesh_IncrementalMesh* anAlgo = new BRepMesh_IncrementalMesh();
|
||||||
anAlgo->SetDeflection(theDeflection);
|
anAlgo->ChangeParameters().Deflection = theDeflection;
|
||||||
anAlgo->SetAngle (theAngle);
|
anAlgo->ChangeParameters().Angle = theAngle;
|
||||||
|
anAlgo->ChangeParameters().InParallel = IS_IN_PARALLEL;
|
||||||
anAlgo->SetShape (theShape);
|
anAlgo->SetShape (theShape);
|
||||||
anAlgo->SetParallel (IS_IN_PARALLEL);
|
|
||||||
theAlgo = anAlgo;
|
theAlgo = anAlgo;
|
||||||
return 0; // no error
|
return 0; // no error
|
||||||
}
|
}
|
||||||
|
@ -54,28 +54,33 @@ public: //! @name mesher API
|
|||||||
Standard_EXPORT BRepMesh_IncrementalMesh(
|
Standard_EXPORT BRepMesh_IncrementalMesh(
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theLinDeflection,
|
const Standard_Real theLinDeflection,
|
||||||
const Standard_Boolean isRelative = Standard_False,
|
const Standard_Boolean isRelative = Standard_False,
|
||||||
const Standard_Real theAngDeflection = 0.5,
|
const Standard_Real theAngDeflection = 0.5,
|
||||||
const Standard_Boolean isInParallel = Standard_False);
|
const Standard_Boolean isInParallel = Standard_False,
|
||||||
|
const Standard_Boolean adaptiveMin = Standard_False);
|
||||||
|
|
||||||
|
//! Constructor.
|
||||||
|
//! Automatically calls method Perform.
|
||||||
|
//! @param theShape shape to be meshed.
|
||||||
|
//! @param theParameters - parameters of meshing
|
||||||
|
Standard_EXPORT BRepMesh_IncrementalMesh (const TopoDS_Shape& theShape,
|
||||||
|
const BRepMesh_FastDiscret::Parameters& theParameters);
|
||||||
|
|
||||||
//! Performs meshing ot the shape.
|
//! Performs meshing ot the shape.
|
||||||
Standard_EXPORT virtual void Perform();
|
Standard_EXPORT virtual void Perform();
|
||||||
|
|
||||||
public: //! @name accessing to parameters.
|
public: //! @name accessing to parameters.
|
||||||
|
|
||||||
//! Enables using relative deflection.
|
//! Returns meshing parameters
|
||||||
//! @param isRelative if TRUE deflection used for discretization of
|
inline const BRepMesh_FastDiscret::Parameters& Parameters() const
|
||||||
//! each edge will be <theLinDeflection> * <size of edge>. Deflection
|
|
||||||
//! used for the faces will be the maximum deflection of their edges.
|
|
||||||
inline void SetRelative(const Standard_Boolean isRelative)
|
|
||||||
{
|
{
|
||||||
myRelative = isRelative;
|
return myParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns relative deflection flag.
|
//! Returns modifiable meshing parameters
|
||||||
inline Standard_Boolean IsRelative() const
|
inline BRepMesh_FastDiscret::Parameters& ChangeParameters()
|
||||||
{
|
{
|
||||||
return myRelative;
|
return myParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns modified flag.
|
//! Returns modified flag.
|
||||||
@ -90,55 +95,6 @@ public: //! @name accessing to parameters.
|
|||||||
return myStatus;
|
return myStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Request algorithm to launch in multiple threads to improve performance.
|
|
||||||
inline void SetParallel(const Standard_Boolean isInParallel)
|
|
||||||
{
|
|
||||||
myInParallel = isInParallel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns the multi-threading usage flag.
|
|
||||||
inline Standard_Boolean IsParallel() const
|
|
||||||
{
|
|
||||||
return myInParallel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets min size parameter.
|
|
||||||
inline void SetMinSize(const Standard_Real theMinSize)
|
|
||||||
{
|
|
||||||
myMinSize = Max(theMinSize, Precision::Confusion());
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns min size parameter.
|
|
||||||
inline Standard_Real GetMinSize() const
|
|
||||||
{
|
|
||||||
return myMinSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Enables/disables internal vertices mode (enabled by default).
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! 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
|
||||||
|
|
||||||
@ -221,18 +177,16 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Standard_Boolean myRelative;
|
|
||||||
Standard_Boolean myInParallel;
|
|
||||||
BRepMesh::DMapOfEdgeListOfTriangulationBool myEdges;
|
BRepMesh::DMapOfEdgeListOfTriangulationBool myEdges;
|
||||||
Handle(BRepMesh_FastDiscret) myMesh;
|
Handle(BRepMesh_FastDiscret) myMesh;
|
||||||
Standard_Boolean myModified;
|
|
||||||
TopTools_DataMapOfShapeReal myEdgeDeflection;
|
TopTools_DataMapOfShapeReal myEdgeDeflection;
|
||||||
Standard_Real myMaxShapeSize;
|
|
||||||
Standard_Integer myStatus;
|
|
||||||
NCollection_Vector<TopoDS_Face> myFaces;
|
NCollection_Vector<TopoDS_Face> myFaces;
|
||||||
Standard_Real myMinSize;
|
|
||||||
Standard_Boolean myInternalVerticesMode;
|
BRepMesh_FastDiscret::Parameters myParameters;
|
||||||
Standard_Boolean myIsControlSurfaceDeflection;
|
|
||||||
|
Standard_Real myMaxShapeSize;
|
||||||
|
Standard_Boolean myModified;
|
||||||
|
Standard_Integer myStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
|
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
|
||||||
|
@ -837,7 +837,11 @@ void DBRep_DrawableShape::DisplayHiddenLines(Draw_Display& dis)
|
|||||||
if (!strcmp(dout.GetType(id),"PERS")) focal = dout.Focal(id);
|
if (!strcmp(dout.GetType(id),"PERS")) focal = dout.Focal(id);
|
||||||
Standard_Real Ang,Def;
|
Standard_Real Ang,Def;
|
||||||
HLRBRep::PolyHLRAngleAndDeflection(myAng,Ang,Def);
|
HLRBRep::PolyHLRAngleAndDeflection(myAng,Ang,Def);
|
||||||
BRepMesh_IncrementalMesh MESH(myShape, Def, Standard_True, Ang);
|
BRepMesh_FastDiscret::Parameters aMeshParams;
|
||||||
|
aMeshParams.Relative = Standard_True;
|
||||||
|
aMeshParams.Deflection = Def;
|
||||||
|
aMeshParams.Angle = Ang;
|
||||||
|
BRepMesh_IncrementalMesh MESH(myShape, aMeshParams);
|
||||||
Standard_Boolean recompute = Standard_True;
|
Standard_Boolean recompute = Standard_True;
|
||||||
// find if the view must be recomputed
|
// find if the view must be recomputed
|
||||||
DBRep_ListIteratorOfListOfHideData it(myHidData);
|
DBRep_ListIteratorOfListOfHideData it(myHidData);
|
||||||
|
@ -128,7 +128,8 @@ options:\n\
|
|||||||
(enabled by default)\n\
|
(enabled by default)\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";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +147,7 @@ options:\n\
|
|||||||
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;
|
Standard_Boolean isControlSurDef = Standard_True;
|
||||||
|
Standard_Boolean isAdaptiveMin = Standard_False;
|
||||||
|
|
||||||
if (nbarg > 3)
|
if (nbarg > 3)
|
||||||
{
|
{
|
||||||
@ -165,6 +167,8 @@ options:\n\
|
|||||||
isIntVertices = Standard_False;
|
isIntVertices = Standard_False;
|
||||||
else if (aOpt == "-surf_def_off")
|
else if (aOpt == "-surf_def_off")
|
||||||
isControlSurDef = Standard_False;
|
isControlSurDef = Standard_False;
|
||||||
|
else if (aOpt == "-adaptive")
|
||||||
|
isAdaptiveMin = Standard_True;
|
||||||
else if (i < nbarg)
|
else if (i < nbarg)
|
||||||
{
|
{
|
||||||
Standard_Real aVal = Draw::Atof(argv[i++]);
|
Standard_Real aVal = Draw::Atof(argv[i++]);
|
||||||
@ -181,16 +185,17 @@ options:\n\
|
|||||||
di << "Incremental Mesh, multi-threading "
|
di << "Incremental Mesh, multi-threading "
|
||||||
<< (isInParallel ? "ON" : "OFF") << "\n";
|
<< (isInParallel ? "ON" : "OFF") << "\n";
|
||||||
|
|
||||||
BRepMesh_IncrementalMesh aMesher;
|
BRepMesh_FastDiscret::Parameters aMeshParams;
|
||||||
aMesher.SetShape (aShape);
|
aMeshParams.Deflection = aLinDeflection;
|
||||||
aMesher.SetDeflection(aLinDeflection);
|
aMeshParams.Angle = aAngDeflection;
|
||||||
aMesher.SetRelative (isRelative);
|
aMeshParams.Relative = isRelative;
|
||||||
aMesher.SetAngle (aAngDeflection);
|
aMeshParams.InParallel = isInParallel;
|
||||||
aMesher.SetParallel (isInParallel);
|
aMeshParams.MinSize = aMinSize;
|
||||||
aMesher.SetMinSize (aMinSize);
|
aMeshParams.InternalVerticesMode = isIntVertices;
|
||||||
aMesher.SetInternalVerticesMode(isIntVertices);
|
aMeshParams.ControlSurfaceDeflection = isControlSurDef;
|
||||||
aMesher.SetControlSurfaceDeflection(isControlSurDef);
|
aMeshParams.AdaptiveMin = isAdaptiveMin;
|
||||||
aMesher.Perform();
|
|
||||||
|
BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
|
||||||
|
|
||||||
di << "Meshing statuses: ";
|
di << "Meshing statuses: ";
|
||||||
Standard_Integer statusFlags = aMesher.GetStatusFlags();
|
Standard_Integer statusFlags = aMesher.GetStatusFlags();
|
||||||
@ -261,12 +266,12 @@ static Standard_Integer fastdiscret(Draw_Interpretor& di, Standard_Integer nbarg
|
|||||||
|
|
||||||
const Standard_Real d = Draw::Atof(argv[2]);
|
const Standard_Real d = Draw::Atof(argv[2]);
|
||||||
|
|
||||||
Standard_Boolean WithShare = Standard_True;
|
|
||||||
if (nbarg > 3) WithShare = Draw::Atoi(argv[3]);
|
|
||||||
|
|
||||||
Bnd_Box B;
|
Bnd_Box B;
|
||||||
BRepBndLib::Add(S,B);
|
BRepBndLib::Add(S,B);
|
||||||
BRepMesh_FastDiscret MESH(d,0.5,B,WithShare,Standard_True,Standard_False,Standard_True);
|
BRepMesh_FastDiscret::Parameters aParams;
|
||||||
|
aParams.Deflection = d;
|
||||||
|
aParams.Angle = 0.5;
|
||||||
|
BRepMesh_FastDiscret MESH(B,aParams);
|
||||||
|
|
||||||
//Standard_Integer NbIterations = MESH.NbIterations();
|
//Standard_Integer NbIterations = MESH.NbIterations();
|
||||||
//if (nbarg > 4) NbIterations = Draw::Atoi(argv[4]);
|
//if (nbarg > 4) NbIterations = Draw::Atoi(argv[4]);
|
||||||
@ -275,8 +280,6 @@ static Standard_Integer fastdiscret(Draw_Interpretor& di, Standard_Integer nbarg
|
|||||||
di<<"Starting FastDiscret with :"<<"\n";
|
di<<"Starting FastDiscret with :"<<"\n";
|
||||||
di<<" Deflection="<<d<<"\n";
|
di<<" Deflection="<<d<<"\n";
|
||||||
di<<" Angle="<<0.5<<"\n";
|
di<<" Angle="<<0.5<<"\n";
|
||||||
di<<" SharedMode="<< (Standard_Integer) WithShare<<"\n";
|
|
||||||
//di<<" NbIterations="<<NbIterations<<"\n";
|
|
||||||
|
|
||||||
Handle(Poly_Triangulation) T;
|
Handle(Poly_Triangulation) T;
|
||||||
BRep_Builder aBuilder;
|
BRep_Builder aBuilder;
|
||||||
@ -1618,7 +1621,7 @@ void MeshTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
|
|
||||||
theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g);
|
theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g);
|
||||||
theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
|
theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
|
||||||
theCommands.Add("fastdiscret","fastdiscret shape deflection [shared [nbiter]]",__FILE__, fastdiscret, g);
|
theCommands.Add("fastdiscret","fastdiscret shape deflection",__FILE__, fastdiscret, g);
|
||||||
theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
|
theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
|
||||||
theCommands.Add("addshape","addshape meshname Shape [deflection]",__FILE__, addshape, g);
|
theCommands.Add("addshape","addshape meshname Shape [deflection]",__FILE__, addshape, g);
|
||||||
//theCommands.Add("smooth","smooth meshname",__FILE__, smooth, g);
|
//theCommands.Add("smooth","smooth meshname",__FILE__, smooth, g);
|
||||||
|
@ -71,7 +71,7 @@ MeshTest_DrawableMesh::MeshTest_DrawableMesh(
|
|||||||
{
|
{
|
||||||
myMesher = theMesher;
|
myMesher = theMesher;
|
||||||
if (!myMesher.IsNull())
|
if (!myMesher.IsNull())
|
||||||
myDeflection = myMesher->Deflection();
|
myDeflection = myMesher->Parameters().Deflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -83,8 +83,8 @@ void MeshTest_DrawableMesh::Add(const TopoDS_Shape& theShape)
|
|||||||
if (myMesher.IsNull())
|
if (myMesher.IsNull())
|
||||||
{
|
{
|
||||||
myMesher = new BRepMesh_IncrementalMesh;
|
myMesher = new BRepMesh_IncrementalMesh;
|
||||||
myMesher->SetDeflection(myDeflection);
|
myMesher->ChangeParameters().Deflection = myDeflection;
|
||||||
myMesher->SetAngle(0.5);
|
myMesher->ChangeParameters().Angle = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
myMesher->SetShape(theShape);
|
myMesher->SetShape(theShape);
|
||||||
|
@ -1351,7 +1351,11 @@ static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, cons
|
|||||||
if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
|
if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
|
||||||
|
|
||||||
// 3. Build mesh
|
// 3. Build mesh
|
||||||
BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI / 6);
|
BRepMesh_FastDiscret::Parameters aMeshParams;
|
||||||
|
aMeshParams.Relative = Standard_True;
|
||||||
|
aMeshParams.Deflection = 0.2;
|
||||||
|
aMeshParams.Angle = M_PI / 6;
|
||||||
|
BRepMesh_IncrementalMesh aMesh(aShape, aMeshParams);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
|
catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
|
||||||
|
@ -71,7 +71,11 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
|
|||||||
{
|
{
|
||||||
const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
|
const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
|
||||||
Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
|
Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
|
||||||
BRepMesh_IncrementalMesh mesh(aShape, aDef, aRel, aDrawer->HLRAngle());
|
BRepMesh_FastDiscret::Parameters aMeshParams;
|
||||||
|
aMeshParams.Relative = aRel;
|
||||||
|
aMeshParams.Angle = aDrawer->HLRAngle();
|
||||||
|
aMeshParams.Deflection = aDef;
|
||||||
|
BRepMesh_IncrementalMesh mesh(aShape, aMeshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
|
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
|
||||||
|
@ -30,10 +30,11 @@ Standard_Integer XBRepMesh::Discret(
|
|||||||
Standard_Integer iErr;
|
Standard_Integer iErr;
|
||||||
//
|
//
|
||||||
iErr=0;
|
iErr=0;
|
||||||
theAlgo=new BRepMesh_IncrementalMesh;
|
BRepMesh_IncrementalMesh* anAlgo = new BRepMesh_IncrementalMesh;
|
||||||
theAlgo->SetDeflection(theDeflection);
|
anAlgo->ChangeParameters().Deflection = theDeflection;
|
||||||
theAlgo->SetAngle(theAngle);
|
anAlgo->ChangeParameters().Angle = theAngle;
|
||||||
theAlgo->SetShape(theShape);
|
anAlgo->SetShape(theShape);
|
||||||
|
theAlgo = anAlgo;
|
||||||
|
|
||||||
return iErr;
|
return iErr;
|
||||||
}
|
}
|
||||||
|
32
tests/bugs/mesh/bug26664
Normal file
32
tests/bugs/mesh/bug26664
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26664"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#################################
|
||||||
|
# Triangulating a very small polygon fails
|
||||||
|
#################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug26664_f.brep] a
|
||||||
|
|
||||||
|
#1
|
||||||
|
vinit
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay a
|
||||||
|
vfit
|
||||||
|
vdump ${imagedir}/${casename}_1.png
|
||||||
|
|
||||||
|
#2
|
||||||
|
incmesh a 1e-4
|
||||||
|
vdisplay a
|
||||||
|
vdump ${imagedir}/${casename}_2.png
|
||||||
|
|
||||||
|
#3
|
||||||
|
set log2 [incmesh a 1e-4 -adaptive]
|
||||||
|
vdisplay a
|
||||||
|
vdump ${imagedir}/${casename}_3.png
|
||||||
|
|
||||||
|
if { [regexp "NoError" ${log2}] == 1 } {
|
||||||
|
puts "OK : Triangulating a very small polygon is good"
|
||||||
|
} else {
|
||||||
|
puts "Error : Triangulating a very small polygon fails"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user