mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
Porting of BRepMesh 7.5.0
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include <BRepMesh_ShapeTool.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -25,7 +25,7 @@
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality for algorithms building face triangulation.
|
||||
//! Class provides base functionality for algorithms building face triangulation.
|
||||
//! Performs initialization of BRepMesh_DataStructureOfDelaun and nodes map structures.
|
||||
class BRepMesh_BaseMeshAlgo : public IMeshTools_MeshAlgo
|
||||
{
|
||||
@@ -44,36 +44,36 @@ public:
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Gets discrete face.
|
||||
inline const IMeshData::IFaceHandle& getDFace() const
|
||||
const IMeshData::IFaceHandle& getDFace() const
|
||||
{
|
||||
return myDFace;
|
||||
}
|
||||
|
||||
//! Gets meshing parameters.
|
||||
inline const IMeshTools_Parameters& getParameters() const
|
||||
const IMeshTools_Parameters& getParameters() const
|
||||
{
|
||||
return myParameters;
|
||||
}
|
||||
|
||||
//! Gets common allocator.
|
||||
inline const Handle(NCollection_IncAllocator)& getAllocator() const
|
||||
const Handle(NCollection_IncAllocator)& getAllocator() const
|
||||
{
|
||||
return myAllocator;
|
||||
}
|
||||
|
||||
//! Gets mesh structure.
|
||||
inline const Handle(BRepMesh_DataStructureOfDelaun)& getStructure() const
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& getStructure() const
|
||||
{
|
||||
return myStructure;
|
||||
}
|
||||
|
||||
//! Gets 3d nodes map.
|
||||
inline const Handle(VectorOfPnt)& getNodesMap() const
|
||||
const Handle(VectorOfPnt)& getNodesMap() const
|
||||
{
|
||||
return myNodesMap;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
//! If the given edge has another pcurve for current face coinsiding with specified one,
|
||||
//! If the given edge has another pcurve for current face coinciding with specified one,
|
||||
//! returns TopAbs_INTERNAL flag. Elsewhere returns orientation of specified pcurve.
|
||||
TopAbs_Orientation fixSeamEdgeOrientation(
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
|
@@ -44,26 +44,26 @@ public:
|
||||
|
||||
//! Sets location of a circle.
|
||||
//! @param theLocation location of a circle.
|
||||
inline void SetLocation(const gp_XY& theLocation)
|
||||
void SetLocation(const gp_XY& theLocation)
|
||||
{
|
||||
myLocation = theLocation;
|
||||
}
|
||||
|
||||
//! Sets radius of a circle.
|
||||
//! @param theRadius radius of a circle.
|
||||
inline void SetRadius(const Standard_Real theRadius)
|
||||
void SetRadius(const Standard_Real theRadius)
|
||||
{
|
||||
myRadius = theRadius;
|
||||
}
|
||||
|
||||
//! Returns location of a circle.
|
||||
inline const gp_XY& Location() const
|
||||
const gp_XY& Location() const
|
||||
{
|
||||
return myLocation;
|
||||
}
|
||||
|
||||
//! Returns radius of a circle.
|
||||
inline const Standard_Real& Radius() const
|
||||
const Standard_Real& Radius() const
|
||||
{
|
||||
return myRadius;
|
||||
}
|
||||
|
@@ -46,14 +46,14 @@ public:
|
||||
//! Adds the circle to vector of circles at the given position.
|
||||
//! @param theIndex position of circle in the vector.
|
||||
//! @param theCircle circle to be added.
|
||||
inline void Bind(const Standard_Integer theIndex,
|
||||
const BRepMesh_Circle& theCircle)
|
||||
void Bind(const Standard_Integer theIndex,
|
||||
const BRepMesh_Circle& theCircle)
|
||||
{
|
||||
myCircles.SetValue(theIndex, theCircle);
|
||||
}
|
||||
|
||||
//! Resutns vector of registered circles.
|
||||
inline const IMeshData::VectorOfCircle& Circles() const
|
||||
const IMeshData::VectorOfCircle& Circles() const
|
||||
{
|
||||
return myCircles;
|
||||
}
|
||||
@@ -61,21 +61,21 @@ public:
|
||||
//! Returns circle with the given index.
|
||||
//! @param theIndex index of circle.
|
||||
//! @return circle with the given index.
|
||||
inline BRepMesh_Circle& Circle(const Standard_Integer theIndex)
|
||||
BRepMesh_Circle& Circle(const Standard_Integer theIndex)
|
||||
{
|
||||
return myCircles(theIndex);
|
||||
}
|
||||
|
||||
//! Set reference point to be checked.
|
||||
//! @param thePoint bullet point.
|
||||
inline void SetPoint(const gp_XY& thePoint)
|
||||
void SetPoint(const gp_XY& thePoint)
|
||||
{
|
||||
myResIndices.Clear();
|
||||
myPoint = thePoint;
|
||||
}
|
||||
|
||||
//! Returns list of circles shot by the reference point.
|
||||
inline IMeshData::ListOfInteger& GetShotCircles()
|
||||
IMeshData::ListOfInteger& GetShotCircles()
|
||||
{
|
||||
return myResIndices;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
//! Performs inspection of a circle with the given index.
|
||||
//! @param theTargetIndex index of a circle to be checked.
|
||||
//! @return status of the check.
|
||||
inline NCollection_CellFilter_Action Inspect(
|
||||
NCollection_CellFilter_Action Inspect(
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
BRepMesh_Circle& aCircle = myCircles(theTargetIndex);
|
||||
|
@@ -50,14 +50,14 @@ public:
|
||||
|
||||
//! Initializes the tool.
|
||||
//! @param theReservedSize size to be reserved for vector of circles.
|
||||
inline void Init(const Standard_Integer /*theReservedSize*/)
|
||||
void Init(const Standard_Integer /*theReservedSize*/)
|
||||
{
|
||||
myTolerance = Precision::PConfusion();
|
||||
}
|
||||
|
||||
//! Sets new size for cell filter.
|
||||
//! @param theSize cell size to be set for X and Y dimensions.
|
||||
inline void SetCellSize(const Standard_Real theSize)
|
||||
void SetCellSize(const Standard_Real theSize)
|
||||
{
|
||||
myCellFilter.Reset(theSize, myAllocator);
|
||||
}
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
//! Sets new size for cell filter.
|
||||
//! @param theSizeX cell size to be set for X dimension.
|
||||
//! @param theSizeY cell size to be set for Y dimension.
|
||||
inline void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
{
|
||||
Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
|
||||
NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
|
||||
@@ -76,15 +76,15 @@ public:
|
||||
//! Sets limits of inspection area.
|
||||
//! @param theMin bottom left corner of inspection area.
|
||||
//! @param theMax top right corner of inspection area.
|
||||
inline void SetMinMaxSize(const gp_XY& theMin,
|
||||
const gp_XY& theMax)
|
||||
void SetMinMaxSize(const gp_XY& theMin,
|
||||
const gp_XY& theMax)
|
||||
{
|
||||
myFaceMin = theMin;
|
||||
myFaceMax = theMax;
|
||||
}
|
||||
|
||||
//! Retruns true if cell filter contains no circle.
|
||||
inline Standard_Boolean IsEmpty () const
|
||||
Standard_Boolean IsEmpty () const
|
||||
{
|
||||
return mySelector.Circles ().IsEmpty ();
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include <CSLib_Class2d.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Classifier, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
|
@@ -58,7 +58,7 @@ public:
|
||||
const std::pair<Standard_Real, Standard_Real>& theRangeU,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRangeV);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE (BRepMesh_Classifier, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_Classifier, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
|
18
src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.cxx
Normal file
18
src/BRepMesh/BRepMesh_ConstrainedBaseMeshAlgo.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_ConstrainedBaseMeshAlgo.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
|
@@ -23,7 +23,7 @@
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
|
||||
//! Class provides base functionality to build face triangulation using Dealunay approach.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ConstrainedBaseMeshAlgo, BRepMesh_BaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -49,7 +49,7 @@ protected:
|
||||
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
|
||||
}
|
||||
|
||||
//! Perfroms processing of generated mesh.
|
||||
//! Performs processing of generated mesh.
|
||||
//! By default does nothing.
|
||||
//! Expected to be called from method generateMesh() in successor classes.
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
|
||||
|
@@ -20,19 +20,61 @@
|
||||
#include <BRepMesh_FaceDiscret.hxx>
|
||||
#include <BRepMesh_ModelPreProcessor.hxx>
|
||||
#include <BRepMesh_ModelPostProcessor.hxx>
|
||||
|
||||
#include <BRepMesh_MeshAlgoFactory.hxx>
|
||||
#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Context, IMeshTools_Context)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_Context::BRepMesh_Context ()
|
||||
BRepMesh_Context::BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType)
|
||||
{
|
||||
if (theMeshType == IMeshTools_MeshAlgoType_DEFAULT)
|
||||
{
|
||||
TCollection_AsciiString aValue = OSD_Environment ("CSF_MeshAlgo").Value();
|
||||
aValue.LowerCase();
|
||||
if (aValue == "watson"
|
||||
|| aValue == "0")
|
||||
{
|
||||
theMeshType = IMeshTools_MeshAlgoType_Watson;
|
||||
}
|
||||
else if (aValue == "delabella"
|
||||
|| aValue == "1")
|
||||
{
|
||||
theMeshType = IMeshTools_MeshAlgoType_Delabella;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aValue.IsEmpty())
|
||||
{
|
||||
Message::SendWarning (TCollection_AsciiString("BRepMesh_Context, ignore unknown algorithm '") + aValue + "' specified in CSF_MeshAlgo variable");
|
||||
}
|
||||
theMeshType = IMeshTools_MeshAlgoType_Watson;
|
||||
}
|
||||
}
|
||||
|
||||
Handle (IMeshTools_MeshAlgoFactory) aAlgoFactory;
|
||||
switch (theMeshType)
|
||||
{
|
||||
case IMeshTools_MeshAlgoType_DEFAULT:
|
||||
case IMeshTools_MeshAlgoType_Watson:
|
||||
aAlgoFactory = new BRepMesh_MeshAlgoFactory();
|
||||
break;
|
||||
case IMeshTools_MeshAlgoType_Delabella:
|
||||
aAlgoFactory = new BRepMesh_DelabellaMeshAlgoFactory();
|
||||
break;
|
||||
}
|
||||
|
||||
SetModelBuilder (new BRepMesh_ModelBuilder);
|
||||
SetEdgeDiscret (new BRepMesh_EdgeDiscret);
|
||||
SetModelHealer (new BRepMesh_ModelHealer);
|
||||
SetPreProcessor (new BRepMesh_ModelPreProcessor);
|
||||
SetFaceDiscret (new BRepMesh_FaceDiscret(new BRepMesh_MeshAlgoFactory));
|
||||
SetFaceDiscret (new BRepMesh_FaceDiscret (aAlgoFactory));
|
||||
SetPostProcessor(new BRepMesh_ModelPostProcessor);
|
||||
}
|
||||
|
||||
|
@@ -25,12 +25,12 @@ class BRepMesh_Context : public IMeshTools_Context
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_Context ();
|
||||
Standard_EXPORT BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType = IMeshTools_MeshAlgoType_DEFAULT);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_Context ();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Context, IMeshTools_Context)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_Context, IMeshTools_Context)
|
||||
};
|
||||
|
||||
#endif
|
@@ -28,6 +28,8 @@
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
gp_Pnt& thePoint,
|
||||
Standard_Real& theParameter) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator)
|
||||
|
||||
private:
|
||||
|
||||
|
18
src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.cxx
Normal file
18
src/BRepMesh/BRepMesh_CustomBaseMeshAlgo.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_CustomBaseMeshAlgo.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
@@ -25,23 +25,23 @@
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
|
||||
//! Class provides base functionality to build face triangulation using custom triangulation algorithm.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_CustomBaseMeshAlgo ()
|
||||
BRepMesh_CustomBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_CustomBaseMeshAlgo ()
|
||||
virtual ~BRepMesh_CustomBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_CustomBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -49,12 +49,35 @@ protected:
|
||||
Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
|
||||
{
|
||||
const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
|
||||
const Standard_Integer aNodesNb = aStructure->NbNodes ();
|
||||
|
||||
buildBaseTriangulation ();
|
||||
|
||||
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
|
||||
BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
|
||||
|
||||
const Standard_Integer aNewNodesNb = aStructure->NbNodes ();
|
||||
const Standard_Boolean isRemoveAux = aNewNodesNb > aNodesNb;
|
||||
if (isRemoveAux)
|
||||
{
|
||||
IMeshData::VectorOfInteger aAuxVertices (aNewNodesNb - aNodesNb);
|
||||
for (Standard_Integer aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
|
||||
{
|
||||
aAuxVertices.Append (aExtNodesIt);
|
||||
}
|
||||
|
||||
// Set aux vertices if there are some to clean up mesh correctly.
|
||||
aMesher.SetAuxVertices (aAuxVertices);
|
||||
}
|
||||
|
||||
aMesher.ProcessConstraints ();
|
||||
|
||||
// Destruction of triangles containing aux vertices added (possibly) during base mesh computation.
|
||||
if (isRemoveAux)
|
||||
{
|
||||
aMesher.RemoveAuxElements ();
|
||||
}
|
||||
|
||||
BRepMesh_MeshTool aCleaner (aStructure);
|
||||
aCleaner.EraseFreeLinks ();
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using custom
|
||||
//! Class provides base functionality to build face triangulation using custom
|
||||
//! triangulation algorithm with possibility to modify final mesh.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
template<class BaseAlgo>
|
||||
@@ -42,11 +42,11 @@ protected:
|
||||
//! Perfroms processing of generated mesh.
|
||||
virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
|
||||
{
|
||||
BaseAlgo::postProcessMesh (theMesher);
|
||||
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
|
||||
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
|
||||
theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
|
||||
|
||||
BaseAlgo::postProcessMesh (theMesher);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMesh_DataStructureOfDelaun
|
||||
//purpose :
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
public: //! @name API for accessing mesh nodes.
|
||||
|
||||
//! Returns number of nodes.
|
||||
inline Standard_Integer NbNodes() const
|
||||
Standard_Integer NbNodes() const
|
||||
{
|
||||
return myNodes->Extent();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! Get node by the index.
|
||||
//! @param theIndex index of a node.
|
||||
//! @return node with the given index.
|
||||
inline const BRepMesh_Vertex& GetNode(const Standard_Integer theIndex)
|
||||
const BRepMesh_Vertex& GetNode(const Standard_Integer theIndex)
|
||||
{
|
||||
return myNodes->FindKey(theIndex);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! Get list of links attached to the node with the given index.
|
||||
//! @param theIndex index of node whose links should be retrieved.
|
||||
//! @return list of links attached to the node.
|
||||
inline const IMeshData::ListOfInteger& LinksConnectedTo(
|
||||
const IMeshData::ListOfInteger& LinksConnectedTo(
|
||||
const Standard_Integer theIndex) const
|
||||
{
|
||||
return linksConnectedTo(theIndex);
|
||||
@@ -115,7 +115,7 @@ public: //! @name API for accessing mesh nodes.
|
||||
public: //! @name API for accessing mesh links.
|
||||
|
||||
//! Returns number of links.
|
||||
inline Standard_Integer NbLinks() const
|
||||
Standard_Integer NbLinks() const
|
||||
{
|
||||
return myLinks.Extent();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public: //! @name API for accessing mesh links.
|
||||
}
|
||||
|
||||
//! Returns map of indices of links registered in mesh.
|
||||
inline const IMeshData::MapOfInteger& LinksOfDomain() const
|
||||
const IMeshData::MapOfInteger& LinksOfDomain() const
|
||||
{
|
||||
return myLinksOfDomain;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public: //! @name API for accessing mesh links.
|
||||
public: //! @name API for accessing mesh elements.
|
||||
|
||||
//! Returns number of links.
|
||||
inline Standard_Integer NbElements() const
|
||||
Standard_Integer NbElements() const
|
||||
{
|
||||
return myElements.Size();
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public: //! @name API for accessing mesh elements.
|
||||
}
|
||||
|
||||
//! Returns map of indices of elements registered in mesh.
|
||||
inline const IMeshData::MapOfInteger& ElementsOfDomain() const
|
||||
const IMeshData::MapOfInteger& ElementsOfDomain() const
|
||||
{
|
||||
return myElementsOfDomain;
|
||||
}
|
||||
@@ -229,13 +229,13 @@ public: //! @name Auxilary API
|
||||
Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
|
||||
|
||||
//! Returns memory allocator used by the structure.
|
||||
inline const Handle(NCollection_IncAllocator)& Allocator() const
|
||||
const Handle(NCollection_IncAllocator)& Allocator() const
|
||||
{
|
||||
return myAllocator;
|
||||
}
|
||||
|
||||
//! Gives the data structure for initialization of cell size and tolerance.
|
||||
inline const Handle(BRepMesh_VertexTool)& Data()
|
||||
const Handle(BRepMesh_VertexTool)& Data()
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
@@ -251,14 +251,14 @@ public: //! @name Auxilary API
|
||||
clearDeletedNodes();
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DataStructureOfDelaun, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
//! Get list of links attached to the node with the given index.
|
||||
//! @param theIndex index of node whose links should be retrieved.
|
||||
//! @return list of links attached to the node.
|
||||
inline IMeshData::ListOfInteger& linksConnectedTo(
|
||||
IMeshData::ListOfInteger& linksConnectedTo(
|
||||
const Standard_Integer theIndex) const
|
||||
{
|
||||
return (IMeshData::ListOfInteger&)myNodeLinks.Find(theIndex);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAbs_IsoType.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Function: Reset
|
||||
@@ -125,9 +126,14 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||
|
||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
myTolerance.first = Max(Min(aDeflectionUV, 0.1 * aDiffU), 1e-7 * aDiffU);
|
||||
myTolerance.second = Max(Min(aDeflectionUV, 0.1 * aDiffV), 1e-7 * aDiffV);
|
||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||
myTolerance.second = Max(Min(aDeflectionUV, aResV), 1e-7 * aDiffV);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
//! Returns point in 3d space corresponded to the given
|
||||
//! point defined in parameteric space of surface.
|
||||
inline gp_Pnt Point(const gp_Pnt2d& thePoint2d) const
|
||||
gp_Pnt Point(const gp_Pnt2d& thePoint2d) const
|
||||
{
|
||||
return GetSurface()->Value(thePoint2d.X(), thePoint2d.Y());
|
||||
}
|
||||
@@ -78,47 +78,43 @@ public:
|
||||
protected:
|
||||
|
||||
//! Computes parametric tolerance taking length along U and V into account.
|
||||
virtual void computeTolerance(
|
||||
const Standard_Real theLenU,
|
||||
const Standard_Real theLenV);
|
||||
Standard_EXPORT virtual void computeTolerance (const Standard_Real theLenU, const Standard_Real theLenV);
|
||||
|
||||
//! Computes parametric delta taking length along U and V and value of tolerance into account.
|
||||
virtual void computeDelta(
|
||||
const Standard_Real theLengthU,
|
||||
const Standard_Real theLengthV);
|
||||
Standard_EXPORT virtual void computeDelta (const Standard_Real theLengthU, const Standard_Real theLengthV);
|
||||
|
||||
public:
|
||||
//! Returns face model.
|
||||
inline const IMeshData::IFaceHandle& GetDFace() const
|
||||
const IMeshData::IFaceHandle& GetDFace() const
|
||||
{
|
||||
return myDFace;
|
||||
}
|
||||
|
||||
//! Returns surface.
|
||||
inline const Handle(BRepAdaptor_HSurface)& GetSurface() const
|
||||
const Handle(BRepAdaptor_HSurface)& GetSurface() const
|
||||
{
|
||||
return myDFace->GetSurface();
|
||||
}
|
||||
|
||||
//! Returns U range.
|
||||
inline const std::pair<Standard_Real, Standard_Real>& GetRangeU() const
|
||||
const std::pair<Standard_Real, Standard_Real>& GetRangeU() const
|
||||
{
|
||||
return myRangeU;
|
||||
}
|
||||
|
||||
//! Returns V range.
|
||||
inline const std::pair<Standard_Real, Standard_Real>& GetRangeV() const
|
||||
const std::pair<Standard_Real, Standard_Real>& GetRangeV() const
|
||||
{
|
||||
return myRangeV;
|
||||
}
|
||||
|
||||
//! Returns delta.
|
||||
inline const std::pair<Standard_Real, Standard_Real>& GetDelta () const
|
||||
const std::pair<Standard_Real, Standard_Real>& GetDelta () const
|
||||
{
|
||||
return myDelta;
|
||||
}
|
||||
|
||||
inline const std::pair<Standard_Real, Standard_Real>& GetToleranceUV() const
|
||||
const std::pair<Standard_Real, Standard_Real>& GetToleranceUV() const
|
||||
{
|
||||
return myTolerance;
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_Deflection, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : RelativeEdgeDeflection
|
||||
//purpose :
|
||||
@@ -145,18 +147,39 @@ void BRepMesh_Deflection::ComputeDeflection (
|
||||
}
|
||||
|
||||
Standard_Real aFaceDeflection = 0.0;
|
||||
if (theDFace->WiresNb () > 0)
|
||||
if (!theParameters.ForceFaceDeflection)
|
||||
{
|
||||
for (Standard_Integer aWireIt = 0; aWireIt < theDFace->WiresNb(); ++aWireIt)
|
||||
if (theDFace->WiresNb () > 0)
|
||||
{
|
||||
aFaceDeflection += theDFace->GetWire(aWireIt)->GetDeflection();
|
||||
for (Standard_Integer aWireIt = 0; aWireIt < theDFace->WiresNb (); ++aWireIt)
|
||||
{
|
||||
aFaceDeflection += theDFace->GetWire (aWireIt)->GetDeflection ();
|
||||
}
|
||||
|
||||
aFaceDeflection /= theDFace->WiresNb ();
|
||||
}
|
||||
|
||||
aFaceDeflection /= theDFace->WiresNb ();
|
||||
aFaceDeflection = Max (2. * BRepMesh_ShapeTool::MaxFaceTolerance (
|
||||
theDFace->GetFace ()), aFaceDeflection);
|
||||
}
|
||||
aFaceDeflection = Max (aDeflection, aFaceDeflection);
|
||||
|
||||
aFaceDeflection = Max(aDeflection, aFaceDeflection);
|
||||
|
||||
theDFace->SetDeflection (Max(2.* BRepMesh_ShapeTool::MaxFaceTolerance(
|
||||
theDFace->GetFace()), aFaceDeflection));
|
||||
theDFace->SetDeflection (aFaceDeflection);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: IsConsistent
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_Deflection::IsConsistent (
|
||||
const Standard_Real theCurrent,
|
||||
const Standard_Real theRequired,
|
||||
const Standard_Boolean theAllowDecrease,
|
||||
const Standard_Real theRatio)
|
||||
{
|
||||
// Check if the deflection of existing polygonal representation
|
||||
// fits the required deflection.
|
||||
Standard_Boolean isConsistent = theCurrent < (1. + theRatio) * theRequired
|
||||
&& (!theAllowDecrease || theCurrent > (1. - theRatio) * theRequired);
|
||||
return isConsistent;
|
||||
}
|
||||
|
@@ -58,7 +58,21 @@ public:
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Deflection, Standard_Transient)
|
||||
//! Checks if the deflection of current polygonal representation
|
||||
//! is consistent with the required deflection.
|
||||
//! @param theCurrent [in] Current deflection.
|
||||
//! @param theRequired [in] Required deflection.
|
||||
//! @param theAllowDecrease [in] Flag controlling the check. If decrease is allowed,
|
||||
//! to be consistent the current and required deflections should be approximately the same.
|
||||
//! If not allowed, the current deflection should be less than required.
|
||||
//! @param theRatio [in] The ratio for comparison of the deflections (value from 0 to 1).
|
||||
Standard_EXPORT static Standard_Boolean IsConsistent (
|
||||
const Standard_Real theCurrent,
|
||||
const Standard_Real theRequired,
|
||||
const Standard_Boolean theAllowDecrease,
|
||||
const Standard_Real theRatio = 0.1);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_Deflection, Standard_Transient)
|
||||
};
|
||||
|
||||
#endif
|
194
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx
Normal file
194
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.cxx
Normal file
@@ -0,0 +1,194 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
|
||||
|
||||
#include <BRepMesh_MeshTool.hxx>
|
||||
#include <BRepMesh_Delaun.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Gravity.hxx>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "delabella.pxx"
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Redirect algorithm messages to OCCT messenger.
|
||||
static int logDelabella2Occ (void* theStream, const char* theFormat, ...)
|
||||
{
|
||||
(void )theStream;
|
||||
char aBuffer[1024]; // should be more than enough for Delabella messages
|
||||
|
||||
va_list anArgList;
|
||||
va_start(anArgList, theFormat);
|
||||
Vsprintf(aBuffer, theFormat, anArgList);
|
||||
va_end(anArgList);
|
||||
|
||||
Message_Gravity aGravity = Message_Warning;
|
||||
switch ((int )theFormat[1])
|
||||
{
|
||||
case int('E'): aGravity = Message_Fail; break; // [ERR]
|
||||
case int('W'): aGravity = Message_Trace; break; // [WRN]
|
||||
case int('N'): aGravity = Message_Trace; break; // [NFO]
|
||||
}
|
||||
Message::Send (aBuffer, aGravity);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaBaseMeshAlgo::BRepMesh_DelabellaBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Destructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaBaseMeshAlgo::~BRepMesh_DelabellaBaseMeshAlgo ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : buildBaseTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation()
|
||||
{
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
|
||||
|
||||
Bnd_B2d aBox;
|
||||
const Standard_Integer aNodesNb = aStructure->NbNodes ();
|
||||
std::vector<Standard_Real> aPoints (2 * (aNodesNb + 4));
|
||||
for (Standard_Integer aNodeIt = 0; aNodeIt < aNodesNb; ++aNodeIt)
|
||||
{
|
||||
const BRepMesh_Vertex& aVertex = aStructure->GetNode (aNodeIt + 1);
|
||||
|
||||
const size_t aBaseIdx = 2 * static_cast<size_t> (aNodeIt);
|
||||
aPoints[aBaseIdx + 0] = aVertex.Coord ().X ();
|
||||
aPoints[aBaseIdx + 1] = aVertex.Coord ().Y ();
|
||||
|
||||
aBox.Add (gp_Pnt2d(aVertex.Coord ()));
|
||||
}
|
||||
|
||||
aBox.Enlarge (0.1 * (aBox.CornerMax () - aBox.CornerMin ()).Modulus ());
|
||||
const gp_XY aMin = aBox.CornerMin ();
|
||||
const gp_XY aMax = aBox.CornerMax ();
|
||||
|
||||
aPoints[2 * aNodesNb + 0] = aMin.X ();
|
||||
aPoints[2 * aNodesNb + 1] = aMin.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 0],
|
||||
aPoints[2 * aNodesNb + 1], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 2] = aMax.X ();
|
||||
aPoints[2 * aNodesNb + 3] = aMin.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 2],
|
||||
aPoints[2 * aNodesNb + 3], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 4] = aMax.X ();
|
||||
aPoints[2 * aNodesNb + 5] = aMax.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 4],
|
||||
aPoints[2 * aNodesNb + 5], BRepMesh_Free));
|
||||
|
||||
aPoints[2 * aNodesNb + 6] = aMin.X ();
|
||||
aPoints[2 * aNodesNb + 7] = aMax.Y ();
|
||||
aStructure->AddNode (BRepMesh_Vertex (
|
||||
aPoints[2 * aNodesNb + 6],
|
||||
aPoints[2 * aNodesNb + 7], BRepMesh_Free));
|
||||
|
||||
const Standard_Real aDiffX = (aMax.X () - aMin.X ());
|
||||
const Standard_Real aDiffY = (aMax.Y () - aMin.Y ());
|
||||
for (size_t i = 0; i < aPoints.size(); i += 2)
|
||||
{
|
||||
aPoints[i + 0] = (aPoints[i + 0] - aMin.X ()) / aDiffX - 0.5;
|
||||
aPoints[i + 1] = (aPoints[i + 1] - aMin.Y ()) / aDiffY - 0.5;
|
||||
}
|
||||
|
||||
IDelaBella* aTriangulator = IDelaBella::Create();
|
||||
if (aTriangulator == NULL) // should never happen
|
||||
{
|
||||
throw Standard_ProgramError ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: unable creating a triangulation algorithm");
|
||||
}
|
||||
|
||||
aTriangulator->SetErrLog (logDelabella2Occ, NULL);
|
||||
try
|
||||
{
|
||||
const int aVerticesNb = aTriangulator->Triangulate (
|
||||
static_cast<int>(aPoints.size () / 2),
|
||||
&aPoints[0], &aPoints[1], 2 * sizeof (Standard_Real));
|
||||
|
||||
if (aVerticesNb > 0)
|
||||
{
|
||||
const DelaBella_Triangle* aTrianglePtr = aTriangulator->GetFirstDelaunayTriangle();
|
||||
while (aTrianglePtr != NULL)
|
||||
{
|
||||
Standard_Integer aNodes[3] = {
|
||||
aTrianglePtr->v[0]->i + 1,
|
||||
aTrianglePtr->v[2]->i + 1,
|
||||
aTrianglePtr->v[1]->i + 1
|
||||
};
|
||||
|
||||
Standard_Integer aEdges [3];
|
||||
Standard_Boolean aOrientations[3];
|
||||
for (Standard_Integer k = 0; k < 3; ++k)
|
||||
{
|
||||
const BRepMesh_Edge aLink (aNodes[k], aNodes[(k + 1) % 3], BRepMesh_Free);
|
||||
|
||||
const Standard_Integer aLinkInfo = aStructure->AddLink (aLink);
|
||||
aEdges [k] = Abs (aLinkInfo);
|
||||
aOrientations[k] = aLinkInfo > 0;
|
||||
}
|
||||
|
||||
const BRepMesh_Triangle aTriangle (aEdges, aOrientations, BRepMesh_Free);
|
||||
aStructure->AddElement (aTriangle);
|
||||
|
||||
aTrianglePtr = aTrianglePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
aTriangulator->Destroy ();
|
||||
aTriangulator = NULL;
|
||||
}
|
||||
catch (Standard_Failure const& theException)
|
||||
{
|
||||
if (aTriangulator != NULL)
|
||||
{
|
||||
aTriangulator->Destroy ();
|
||||
aTriangulator = NULL;
|
||||
}
|
||||
|
||||
throw Standard_Failure (theException);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (aTriangulator != NULL)
|
||||
{
|
||||
aTriangulator->Destroy ();
|
||||
aTriangulator = NULL;
|
||||
}
|
||||
|
||||
throw Standard_Failure ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: exception in triangulation algorithm");
|
||||
}
|
||||
}
|
46
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx
Normal file
46
src/BRepMesh/BRepMesh_DelabellaBaseMeshAlgo.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
|
||||
#define _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
|
||||
|
||||
#include <BRepMesh_CustomBaseMeshAlgo.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base functionality to build face triangulation using Delabella project.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_DelabellaBaseMeshAlgo : public BRepMesh_CustomBaseMeshAlgo
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_DelabellaBaseMeshAlgo ();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelabellaBaseMeshAlgo ();
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
//! Builds base triangulation using Delabella project.
|
||||
Standard_EXPORT virtual void buildBaseTriangulation() Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
145
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx
Normal file
145
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.cxx
Normal file
@@ -0,0 +1,145 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
|
||||
#include <BRepMesh_DefaultRangeSplitter.hxx>
|
||||
#include <BRepMesh_NURBSRangeSplitter.hxx>
|
||||
#include <BRepMesh_SphereRangeSplitter.hxx>
|
||||
#include <BRepMesh_CylinderRangeSplitter.hxx>
|
||||
#include <BRepMesh_ConeRangeSplitter.hxx>
|
||||
#include <BRepMesh_TorusRangeSplitter.hxx>
|
||||
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_CustomDelaunayBaseMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx>
|
||||
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
|
||||
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DefaultBaseMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayBaseMeshAlgo Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct DefaultNodeInsertionMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
|
||||
};
|
||||
|
||||
struct BaseMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelabellaBaseMeshAlgo Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct NodeInsertionMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
|
||||
};
|
||||
|
||||
template<class RangeSplitter>
|
||||
struct DeflectionControlMeshAlgo
|
||||
{
|
||||
typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
|
||||
};
|
||||
}
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaMeshAlgoFactory::BRepMesh_DelabellaMeshAlgoFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Destructor
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_DelabellaMeshAlgoFactory::~BRepMesh_DelabellaMeshAlgoFactory ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: GetAlgo
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Handle(IMeshTools_MeshAlgo) BRepMesh_DelabellaMeshAlgoFactory::GetAlgo(
|
||||
const GeomAbs_SurfaceType theSurfaceType,
|
||||
const IMeshTools_Parameters& theParameters) const
|
||||
{
|
||||
switch (theSurfaceType)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
|
||||
new BaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
return theParameters.InternalVerticesMode ?
|
||||
new DefaultNodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
|
||||
new DefaultBaseMeshAlgo::Type;
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type* aMeshAlgo =
|
||||
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_SurfaceOfRevolution:
|
||||
{
|
||||
DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type* aMeshAlgo =
|
||||
new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type* aMeshAlgo =
|
||||
new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
|
||||
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
|
||||
return aMeshAlgo;
|
||||
}
|
||||
}
|
||||
}
|
44
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx
Normal file
44
src/BRepMesh/BRepMesh_DelabellaMeshAlgoFactory.hxx
Normal file
@@ -0,0 +1,44 @@
|
||||
// Created on: 2019-07-05
|
||||
// Copyright (c) 2019 OPEN CASCADE SAS
|
||||
// Created by: Oleg AGASHIN
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
|
||||
#define _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <IMeshTools_MeshAlgoFactory.hxx>
|
||||
|
||||
//! Implementation of IMeshTools_MeshAlgoFactory providing Delabella-based
|
||||
//! algorithms of different complexity depending on type of target surface.
|
||||
class BRepMesh_DelabellaMeshAlgoFactory : public IMeshTools_MeshAlgoFactory
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT BRepMesh_DelabellaMeshAlgoFactory ();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelabellaMeshAlgoFactory ();
|
||||
|
||||
//! Creates instance of meshing algorithm for the given type of surface.
|
||||
Standard_EXPORT virtual Handle(IMeshTools_MeshAlgo) GetAlgo(
|
||||
const GeomAbs_SurfaceType theSurfaceType,
|
||||
const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
};
|
||||
|
||||
#endif
|
@@ -34,6 +34,7 @@
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#include <stack>
|
||||
|
||||
const Standard_Real AngDeviation1Deg = M_PI/180.;
|
||||
const Standard_Real AngDeviation90Deg = 90 * AngDeviation1Deg;
|
||||
@@ -70,7 +71,7 @@ namespace {
|
||||
Handle(BRepMesh_DataStructureOfDelaun) myStructure;
|
||||
};
|
||||
|
||||
inline void UpdateBndBox(const gp_XY& thePnt1, const gp_XY& thePnt2, Bnd_B2d& theBox)
|
||||
void UpdateBndBox(const gp_XY& thePnt1, const gp_XY& thePnt2, Bnd_B2d& theBox)
|
||||
{
|
||||
theBox.Add( thePnt1 );
|
||||
theBox.Add( thePnt2 );
|
||||
@@ -89,7 +90,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (
|
||||
const Standard_Boolean isFillCircles)
|
||||
: myMeshData ( theOldMesh ),
|
||||
myCircles (new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3),
|
||||
myInitCircles (Standard_False)
|
||||
{
|
||||
if (isFillCircles)
|
||||
{
|
||||
@@ -103,7 +106,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (
|
||||
//=======================================================================
|
||||
BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myCircles (theVertices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3),
|
||||
myInitCircles (Standard_False)
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
@@ -123,7 +128,9 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
IMeshData::Array1OfVertexOfDelaun& theVertices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3),
|
||||
myInitCircles (Standard_False)
|
||||
{
|
||||
if ( theVertices.Length() > 2 )
|
||||
{
|
||||
@@ -140,7 +147,9 @@ BRepMesh_Delaun::BRepMesh_Delaun(
|
||||
IMeshData::VectorOfInteger& theVertexIndices)
|
||||
: myMeshData( theOldMesh ),
|
||||
myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3),
|
||||
myInitCircles (Standard_False)
|
||||
{
|
||||
perform(theVertexIndices);
|
||||
}
|
||||
@@ -155,7 +164,9 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
|
||||
const Standard_Integer theCellsCountV)
|
||||
: myMeshData (theOldMesh),
|
||||
myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
mySupVert (3),
|
||||
myInitCircles (Standard_False)
|
||||
{
|
||||
perform (theVertexIndices, theCellsCountU, theCellsCountV);
|
||||
}
|
||||
@@ -234,6 +245,8 @@ void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d& theBox,
|
||||
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
|
||||
myCircles.SetCellSize ( aDeltaX / Max (theCellsCountU, aScaler),
|
||||
aDeltaY / Max (theCellsCountV, aScaler));
|
||||
|
||||
myInitCircles = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -284,14 +297,14 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
|
||||
Standard_Real aDelta = aDeltaX + aDeltaY;
|
||||
|
||||
mySupVert[0] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) ) );
|
||||
|
||||
mySupVert[1] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
|
||||
|
||||
mySupVert[2] = myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
|
||||
mySupVert.Append (myMeshData->AddNode(
|
||||
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
|
||||
|
||||
Standard_Integer e[3];
|
||||
Standard_Boolean o[3];
|
||||
@@ -318,7 +331,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
|
||||
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
|
||||
IMeshData::MapOfIntegerInteger& theLoopEdges )
|
||||
{
|
||||
if (!myCircles.IsEmpty())
|
||||
if (myInitCircles)
|
||||
{
|
||||
myCircles.Delete (theIndex);
|
||||
}
|
||||
@@ -367,12 +380,25 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
createTrianglesOnNewVertices( theVertexIndexes );
|
||||
}
|
||||
|
||||
RemoveAuxElements ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveAuxElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::RemoveAuxElements ()
|
||||
{
|
||||
Handle (NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator (
|
||||
IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges (10, aAllocator);
|
||||
|
||||
// Destruction of triangles containing a top of the super triangle
|
||||
BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
|
||||
BRepMesh_SelectorOfDataStructureOfDelaun aSelector (myMeshData);
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size(); ++aSupVertId)
|
||||
aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
|
||||
|
||||
aLoopEdges.Clear();
|
||||
|
||||
IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
|
||||
for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
|
||||
deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
|
||||
@@ -387,7 +413,7 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
}
|
||||
|
||||
// The tops of the super triangle are destroyed
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
|
||||
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size (); ++aSupVertId)
|
||||
myMeshData->RemoveNode( mySupVert[aSupVertId] );
|
||||
}
|
||||
|
||||
@@ -610,7 +636,7 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::insertInternalEdges()
|
||||
{
|
||||
Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();;
|
||||
Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();
|
||||
|
||||
// Destruction of triancles intersecting internal edges
|
||||
// and their replacement by makeshift triangles
|
||||
@@ -652,53 +678,56 @@ void BRepMesh_Delaun::insertInternalEdges()
|
||||
|
||||
//=======================================================================
|
||||
//function : isBoundToFrontier
|
||||
//purpose : Goes through the neighbour triangles around the given node
|
||||
// started from the given link, returns TRUE if some triangle
|
||||
// has a bounding frontier edge or FALSE elsewhere.
|
||||
// Stop link is used to prevent cycles.
|
||||
// Previous element Id is used to identify next neighbor element.
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_Delaun::isBoundToFrontier(
|
||||
const Standard_Integer theRefNodeId,
|
||||
const Standard_Integer theRefLinkId,
|
||||
const Standard_Integer theStopLinkId,
|
||||
const Standard_Integer thePrevElementId)
|
||||
const Standard_Integer theRefLinkId)
|
||||
{
|
||||
const BRepMesh_PairOfIndex& aPair =
|
||||
myMeshData->ElementsConnectedTo( theRefLinkId );
|
||||
if ( aPair.IsEmpty() )
|
||||
return Standard_False;
|
||||
std::stack<Standard_Integer> aLinkStack;
|
||||
TColStd_PackedMapOfInteger aVisitedLinks;
|
||||
|
||||
Standard_Integer aNbElements = aPair.Extent();
|
||||
for ( Standard_Integer anElemIt = 1; anElemIt <= aNbElements; ++anElemIt )
|
||||
aLinkStack.push (theRefLinkId);
|
||||
while (!aLinkStack.empty ())
|
||||
{
|
||||
const Standard_Integer aTriId = aPair.Index(anElemIt);
|
||||
if ( aTriId < 0 || aTriId == thePrevElementId )
|
||||
continue;
|
||||
const Standard_Integer aCurrentLinkId = aLinkStack.top ();
|
||||
aLinkStack.pop ();
|
||||
|
||||
const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
|
||||
const Standard_Integer(&anEdges)[3] = aElement.myEdges;
|
||||
const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo (aCurrentLinkId);
|
||||
if (aPair.IsEmpty ())
|
||||
return Standard_False;
|
||||
|
||||
for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
|
||||
const Standard_Integer aNbElements = aPair.Extent ();
|
||||
for (Standard_Integer anElemIt = 1; anElemIt <= aNbElements; ++anElemIt)
|
||||
{
|
||||
const Standard_Integer anEdgeId = anEdges[anEdgeIt];
|
||||
if ( anEdgeId == theRefLinkId )
|
||||
const Standard_Integer aTriId = aPair.Index (anElemIt);
|
||||
if (aTriId < 0)
|
||||
continue;
|
||||
|
||||
if ( anEdgeId == theStopLinkId )
|
||||
return Standard_False;
|
||||
const BRepMesh_Triangle& aElement = GetTriangle (aTriId);
|
||||
const Standard_Integer (&anEdges)[3] = aElement.myEdges;
|
||||
|
||||
const BRepMesh_Edge& anEdge = GetEdge( anEdgeId );
|
||||
if ( anEdge.FirstNode() != theRefNodeId &&
|
||||
anEdge.LastNode() != theRefNodeId )
|
||||
for (Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt)
|
||||
{
|
||||
continue;
|
||||
const Standard_Integer anEdgeId = anEdges[anEdgeIt];
|
||||
if (anEdgeId == aCurrentLinkId)
|
||||
continue;
|
||||
|
||||
const BRepMesh_Edge& anEdge = GetEdge (anEdgeId);
|
||||
if (anEdge.FirstNode () != theRefNodeId &&
|
||||
anEdge.LastNode () != theRefNodeId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (anEdge.Movability () != BRepMesh_Free)
|
||||
return Standard_True;
|
||||
|
||||
if (aVisitedLinks.Add (anEdgeId))
|
||||
{
|
||||
aLinkStack.push (anEdgeId);
|
||||
}
|
||||
}
|
||||
|
||||
if ( anEdge.Movability() != BRepMesh_Free )
|
||||
return Standard_True;
|
||||
|
||||
return isBoundToFrontier( theRefNodeId, anEdgeId, theStopLinkId, aTriId );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,9 +800,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
myMeshData->ElementNodes (aCurTriangle, v);
|
||||
for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
|
||||
{
|
||||
if (v[aNodeIdx] == mySupVert[0] ||
|
||||
v[aNodeIdx] == mySupVert[1] ||
|
||||
v[aNodeIdx] == mySupVert[2])
|
||||
if (isSupVertex (v[aNodeIdx]))
|
||||
{
|
||||
isCanNotBeRemoved = Standard_False;
|
||||
}
|
||||
@@ -792,8 +819,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
for ( Standard_Integer aLinkNodeIt = 0; aLinkNodeIt < 2; ++aLinkNodeIt )
|
||||
{
|
||||
isConnected[aLinkNodeIt] = isBoundToFrontier( ( aLinkNodeIt == 0 ) ?
|
||||
anEdge.FirstNode() : anEdge.LastNode(),
|
||||
aFreeEdgeId, aFreeEdgeId, -1);
|
||||
anEdge.FirstNode() : anEdge.LastNode(), aFreeEdgeId);
|
||||
}
|
||||
|
||||
if ( !isConnected[0] || !isConnected[1] )
|
||||
@@ -1224,19 +1250,23 @@ Standard_Boolean BRepMesh_Delaun::checkIntersection(
|
||||
//function : addTriangle
|
||||
//purpose : Add a triangle based on the given oriented edges into mesh
|
||||
//=======================================================================
|
||||
inline void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3] )
|
||||
void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3] )
|
||||
{
|
||||
Standard_Integer aNewTriangleId =
|
||||
myMeshData->AddElement(BRepMesh_Triangle(theEdgesId,
|
||||
theEdgesOri, BRepMesh_Free));
|
||||
|
||||
Standard_Boolean isAdded = myCircles.Bind(
|
||||
aNewTriangleId,
|
||||
GetVertex( theNodesId[0] ).Coord(),
|
||||
GetVertex( theNodesId[1] ).Coord(),
|
||||
GetVertex( theNodesId[2] ).Coord() );
|
||||
Standard_Boolean isAdded = Standard_True;
|
||||
if (myInitCircles)
|
||||
{
|
||||
isAdded = myCircles.Bind(
|
||||
aNewTriangleId,
|
||||
GetVertex( theNodesId[0] ).Coord(),
|
||||
GetVertex( theNodesId[1] ).Coord(),
|
||||
GetVertex( theNodesId[2] ).Coord() );
|
||||
}
|
||||
|
||||
if ( !isAdded )
|
||||
myMeshData->RemoveElement( aNewTriangleId );
|
||||
@@ -1890,7 +1920,7 @@ void BRepMesh_Delaun::meshPolygon(IMeshData::SequenceOfInteger& thePolygon,
|
||||
//function : meshElementaryPolygon
|
||||
//purpose : Triangulation of closed polygon containing only three edges.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
|
||||
Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
|
||||
const IMeshData::SequenceOfInteger& thePolygon)
|
||||
{
|
||||
Standard_Integer aPolyLen = thePolygon.Length();
|
||||
|
@@ -82,13 +82,13 @@ public:
|
||||
Standard_EXPORT Standard_Boolean UseEdge (const Standard_Integer theEdge);
|
||||
|
||||
//! Gives the Mesh data structure.
|
||||
inline const Handle(BRepMesh_DataStructureOfDelaun)& Result() const
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& Result() const
|
||||
{
|
||||
return myMeshData;
|
||||
}
|
||||
|
||||
//! Forces insertion of constraint edges into the base triangulation.
|
||||
inline void ProcessConstraints()
|
||||
void ProcessConstraints()
|
||||
{
|
||||
insertInternalEdges();
|
||||
|
||||
@@ -97,43 +97,43 @@ public:
|
||||
}
|
||||
|
||||
//! Gives the list of frontier edges.
|
||||
inline Handle(IMeshData::MapOfInteger) Frontier() const
|
||||
Handle(IMeshData::MapOfInteger) Frontier() const
|
||||
{
|
||||
return getEdgesByType (BRepMesh_Frontier);
|
||||
}
|
||||
|
||||
//! Gives the list of internal edges.
|
||||
inline Handle(IMeshData::MapOfInteger) InternalEdges() const
|
||||
Handle(IMeshData::MapOfInteger) InternalEdges() const
|
||||
{
|
||||
return getEdgesByType (BRepMesh_Fixed);
|
||||
}
|
||||
|
||||
//! Gives the list of free edges used only one time
|
||||
inline Handle(IMeshData::MapOfInteger) FreeEdges() const
|
||||
Handle(IMeshData::MapOfInteger) FreeEdges() const
|
||||
{
|
||||
return getEdgesByType (BRepMesh_Free);
|
||||
}
|
||||
|
||||
//! Gives vertex with the given index
|
||||
inline const BRepMesh_Vertex& GetVertex (const Standard_Integer theIndex) const
|
||||
const BRepMesh_Vertex& GetVertex (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myMeshData->GetNode (theIndex);
|
||||
}
|
||||
|
||||
//! Gives edge with the given index
|
||||
inline const BRepMesh_Edge& GetEdge (const Standard_Integer theIndex) const
|
||||
const BRepMesh_Edge& GetEdge (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myMeshData->GetLink (theIndex);
|
||||
}
|
||||
|
||||
//! Gives triangle with the given index
|
||||
inline const BRepMesh_Triangle& GetTriangle (const Standard_Integer theIndex) const
|
||||
const BRepMesh_Triangle& GetTriangle (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myMeshData->GetElement (theIndex);
|
||||
}
|
||||
|
||||
//! Returns tool used to build mesh consistent to Delaunay criteria.
|
||||
inline const BRepMesh_CircleTool& Circles() const
|
||||
const BRepMesh_CircleTool& Circles() const
|
||||
{
|
||||
return myCircles;
|
||||
}
|
||||
@@ -147,6 +147,17 @@ public:
|
||||
const Standard_Real theSqTolerance,
|
||||
Standard_Integer& theEdgeOn) const;
|
||||
|
||||
//! Explicitly sets ids of auxiliary vertices used to build mesh and used by 3rd-party algorithms.
|
||||
inline void SetAuxVertices (const IMeshData::VectorOfInteger& theSupVert)
|
||||
{
|
||||
mySupVert = theSupVert;
|
||||
}
|
||||
|
||||
//! Destruction of auxiliary triangles containing the given vertices.
|
||||
//! Removes auxiliary vertices also.
|
||||
//! @param theAuxVertices auxiliary vertices to be cleaned up.
|
||||
Standard_EXPORT void RemoveAuxElements ();
|
||||
|
||||
private:
|
||||
|
||||
enum ReplaceFlag
|
||||
@@ -247,16 +258,16 @@ private:
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxesCut);
|
||||
|
||||
//! Triangulation of closed polygon containing only three edges.
|
||||
inline Standard_Boolean meshElementaryPolygon (const IMeshData::SequenceOfInteger& thePolygon);
|
||||
Standard_Boolean meshElementaryPolygon (const IMeshData::SequenceOfInteger& thePolygon);
|
||||
|
||||
//! Creates the triangles beetween the given node and the given polyline.
|
||||
void createTriangles (const Standard_Integer theVertexIndex,
|
||||
IMeshData::MapOfIntegerInteger& thePoly);
|
||||
|
||||
//! Add a triangle based on the given oriented edges into mesh
|
||||
inline void addTriangle (const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3]);
|
||||
void addTriangle (const Standard_Integer (&theEdgesId)[3],
|
||||
const Standard_Boolean (&theEdgesOri)[3],
|
||||
const Standard_Integer (&theNodesId)[3]);
|
||||
|
||||
//! Deletes the triangle with the given index and adds the free edges into the map.
|
||||
//! When an edge is suppressed more than one time it is destroyed.
|
||||
@@ -292,12 +303,8 @@ private:
|
||||
//! Goes through the neighbour triangles around the given node started
|
||||
//! from the given link, returns TRUE if some triangle has a bounding
|
||||
//! frontier edge or FALSE elsewhere.
|
||||
//! Stop link is used to prevent cycles.
|
||||
//! Previous element Id is used to identify next neighbor element.
|
||||
Standard_Boolean isBoundToFrontier (const Standard_Integer theRefNodeId,
|
||||
const Standard_Integer theRefLinkId,
|
||||
const Standard_Integer theStopLinkId,
|
||||
const Standard_Integer thePrevElementId);
|
||||
const Standard_Integer theRefLinkId);
|
||||
|
||||
//! Remove internal triangles from the given polygon.
|
||||
void cleanupPolygon (const IMeshData::SequenceOfInteger& thePolygon,
|
||||
@@ -354,13 +361,27 @@ private:
|
||||
//! Performs insertion of internal edges into mesh.
|
||||
void insertInternalEdges();
|
||||
|
||||
//! Checks whether the given vertex id relates to super contour.
|
||||
Standard_Boolean isSupVertex (const Standard_Integer theVertexIdx) const
|
||||
{
|
||||
for (IMeshData::VectorOfInteger::Iterator aIt (mySupVert); aIt.More (); aIt.Next ())
|
||||
{
|
||||
if (theVertexIdx == aIt.Value ())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Handle(BRepMesh_DataStructureOfDelaun) myMeshData;
|
||||
BRepMesh_CircleTool myCircles;
|
||||
Standard_Integer mySupVert[3];
|
||||
IMeshData::VectorOfInteger mySupVert;
|
||||
Standard_Boolean myInitCircles;
|
||||
BRepMesh_Triangle mySupTrian;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <BRepMesh_MeshTool.hxx>
|
||||
#include <BRepMesh_Delaun.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -23,7 +23,7 @@
|
||||
class BRepMesh_DataStructureOfDelaun;
|
||||
class BRepMesh_Delaun;
|
||||
|
||||
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
|
||||
//! Class provides base functionality to build face triangulation using Dealunay approach.
|
||||
//! Performs generation of mesh using raw data from model.
|
||||
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
|
||||
{
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_DelaunayBaseMeshAlgo();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_DelaunayBaseMeshAlgo, BRepMesh_ConstrainedBaseMeshAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -34,7 +34,8 @@ public:
|
||||
//! Constructor.
|
||||
BRepMesh_DelaunayDeflectionControlMeshAlgo()
|
||||
: myMaxSqDeflection(-1.),
|
||||
myIsAllDegenerated(Standard_False)
|
||||
myIsAllDegenerated(Standard_False),
|
||||
myCircles(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,6 +108,11 @@ private:
|
||||
//! Contains geometrical data related to node of triangle.
|
||||
struct TriangleNodeInfo
|
||||
{
|
||||
TriangleNodeInfo()
|
||||
: isFrontierLink(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
gp_XY Point2d;
|
||||
gp_XYZ Point;
|
||||
Standard_Boolean isFrontierLink;
|
||||
@@ -172,7 +178,7 @@ private:
|
||||
};
|
||||
|
||||
//! Returns nodes info of the given triangle.
|
||||
inline void getTriangleInfo(
|
||||
void getTriangleInfo(
|
||||
const BRepMesh_Triangle& theTriangle,
|
||||
const Standard_Integer (&theNodesIndices)[3],
|
||||
TriangleNodeInfo (&theInfo)[3]) const
|
||||
@@ -216,7 +222,7 @@ private:
|
||||
|
||||
//! Updates array of links vectors.
|
||||
//! @return False on degenerative triangle.
|
||||
inline Standard_Boolean computeTriangleGeometry(
|
||||
Standard_Boolean computeTriangleGeometry(
|
||||
const TriangleNodeInfo(&theNodesInfo)[3],
|
||||
gp_Vec (&theLinks)[3],
|
||||
gp_Vec &theNormal)
|
||||
@@ -237,7 +243,7 @@ private:
|
||||
|
||||
//! Updates array of links vectors.
|
||||
//! @return False on degenerative triangle.
|
||||
inline Standard_Boolean checkTriangleForDegenerativityAndGetLinks(
|
||||
Standard_Boolean checkTriangleForDegenerativityAndGetLinks(
|
||||
const TriangleNodeInfo (&theNodesInfo)[3],
|
||||
gp_Vec (&theLinks)[3])
|
||||
{
|
||||
@@ -256,7 +262,7 @@ private:
|
||||
|
||||
//! Checks area of triangle in parametric space for degenerativity.
|
||||
//! @return False on degenerative triangle.
|
||||
inline Standard_Boolean checkTriangleArea2d(
|
||||
Standard_Boolean checkTriangleArea2d(
|
||||
const TriangleNodeInfo (&theNodesInfo)[3])
|
||||
{
|
||||
const gp_Vec2d aLink2d1(theNodesInfo[0].Point2d, theNodesInfo[1].Point2d);
|
||||
@@ -268,9 +274,9 @@ private:
|
||||
|
||||
//! Computes normal using two link vectors.
|
||||
//! @return True on success, False in case of normal of null magnitude.
|
||||
inline Standard_Boolean computeNormal(const gp_Vec& theLink1,
|
||||
const gp_Vec& theLink2,
|
||||
gp_Vec& theNormal)
|
||||
Standard_Boolean computeNormal(const gp_Vec& theLink1,
|
||||
const gp_Vec& theLink2,
|
||||
gp_Vec& theNormal)
|
||||
{
|
||||
const gp_Vec aNormal(theLink1 ^ theLink2);
|
||||
if (aNormal.SquareMagnitude() > gp::Resolution())
|
||||
@@ -284,7 +290,7 @@ private:
|
||||
|
||||
//! Computes deflection of midpoints of triangles links.
|
||||
//! @return True if point fits specified deflection.
|
||||
inline void splitLinks(
|
||||
void splitLinks(
|
||||
const TriangleNodeInfo (&theNodesInfo)[3],
|
||||
const Standard_Integer (&theNodesIndices)[3])
|
||||
{
|
||||
@@ -364,7 +370,7 @@ private:
|
||||
//! insertion in case if it overflows deflection.
|
||||
//! @return True if point has been cached for insertion.
|
||||
template<class DeflectionFunctor>
|
||||
inline Standard_Boolean usePoint(
|
||||
Standard_Boolean usePoint(
|
||||
const gp_XY& thePnt2d,
|
||||
const DeflectionFunctor& theDeflectionFunctor)
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns PreProcessSurfaceNodes flag.
|
||||
inline Standard_Boolean IsPreProcessSurfaceNodes () const
|
||||
Standard_Boolean IsPreProcessSurfaceNodes () const
|
||||
{
|
||||
return myIsPreProcessSurfaceNodes;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
//! Sets PreProcessSurfaceNodes flag.
|
||||
//! If TRUE, registers surface nodes before generation of base mesh.
|
||||
//! If FALSE, inserts surface nodes after generation of base mesh.
|
||||
inline void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
|
||||
void SetPreProcessSurfaceNodes (const Standard_Boolean isPreProcessSurfaceNodes)
|
||||
{
|
||||
myIsPreProcessSurfaceNodes = isPreProcessSurfaceNodes;
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ public:
|
||||
Standard_EXPORT static BRepMesh_DiscretFactory& Get();
|
||||
|
||||
//! Returns the list of registered meshing algorithms.
|
||||
inline const TColStd_MapOfAsciiString& Names() const
|
||||
const TColStd_MapOfAsciiString& Names() const
|
||||
{
|
||||
return myNames;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns name for current meshing algorithm.
|
||||
inline const TCollection_AsciiString& DefaultName() const
|
||||
const TCollection_AsciiString& DefaultName() const
|
||||
{
|
||||
return myDefaultName;
|
||||
}
|
||||
@@ -67,13 +67,13 @@ public:
|
||||
}
|
||||
|
||||
//! Returns function name that should be exported by plugin.
|
||||
inline const TCollection_AsciiString& FunctionName() const
|
||||
const TCollection_AsciiString& FunctionName() const
|
||||
{
|
||||
return myFunctionName;
|
||||
}
|
||||
|
||||
//! Returns error status for last meshing algorithm switch.
|
||||
inline BRepMesh_FactoryError ErrorStatus() const
|
||||
BRepMesh_FactoryError ErrorStatus() const
|
||||
{
|
||||
return myErrorStatus;
|
||||
}
|
||||
|
@@ -29,18 +29,18 @@ public:
|
||||
Standard_EXPORT virtual ~BRepMesh_DiscretRoot();
|
||||
|
||||
//! Set the shape to triangulate.
|
||||
inline void SetShape(const TopoDS_Shape& theShape)
|
||||
void SetShape(const TopoDS_Shape& theShape)
|
||||
{
|
||||
myShape = theShape;
|
||||
}
|
||||
|
||||
inline const TopoDS_Shape& Shape() const
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
//! Returns true if triangualtion was performed and has success.
|
||||
inline Standard_Boolean IsDone() const
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
@@ -57,13 +57,13 @@ protected:
|
||||
Standard_EXPORT BRepMesh_DiscretRoot();
|
||||
|
||||
//! Sets IsDone flag.
|
||||
inline void setDone()
|
||||
void setDone()
|
||||
{
|
||||
myIsDone = Standard_True;
|
||||
}
|
||||
|
||||
//! Clears IsDone flag.
|
||||
inline void setNotDone()
|
||||
void setNotDone()
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
|
@@ -43,14 +43,14 @@ public:
|
||||
}
|
||||
|
||||
//! Returns movability flag of the Link.
|
||||
inline BRepMesh_DegreeOfFreedom Movability() const
|
||||
BRepMesh_DegreeOfFreedom Movability() const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
||||
|
||||
//! Sets movability flag of the Link.
|
||||
//! @param theMovability flag to be set.
|
||||
inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
myMovability = theMovability;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
//! Checks if the given edge and this one have the same orientation.
|
||||
//! @param theOther edge to be checked against this one.
|
||||
//! \retrun TRUE if edges have the same orientation, FALSE if not.
|
||||
inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
|
||||
Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
|
||||
{
|
||||
return BRepMesh_OrientedEdge::IsEqual(theOther);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
//! Checks for equality with another edge.
|
||||
//! @param theOther edge to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
|
||||
return Standard_False;
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
inline Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include <BRepMesh_CurveTessellator.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
@@ -155,8 +157,10 @@ void BRepMesh_EdgeDiscret::process (const Standard_Integer theEdgeIndex) const
|
||||
const Handle (Poly_Polygon3D)& aPoly3D = BRep_Tool::Polygon3D (aDEdge->GetEdge (), aLoc);
|
||||
if (!aPoly3D.IsNull ())
|
||||
{
|
||||
if (aPoly3D->HasParameters () &&
|
||||
aPoly3D->Deflection () < 1.1 * aDEdge->GetDeflection ())
|
||||
if (aPoly3D->HasParameters() &&
|
||||
BRepMesh_Deflection::IsConsistent (aPoly3D->Deflection(),
|
||||
aDEdge->GetDeflection(),
|
||||
myParameters.AllowQualityDecrease))
|
||||
{
|
||||
// Edge already has suitable 3d polygon.
|
||||
aDEdge->SetStatus(IMeshData_Reused);
|
||||
@@ -209,8 +213,10 @@ Standard_Real BRepMesh_EdgeDiscret::checkExistingPolygonAndUpdateStatus(
|
||||
|
||||
if (!aPolygon.IsNull ())
|
||||
{
|
||||
Standard_Boolean isConsistent = aPolygon->HasParameters () &&
|
||||
aPolygon->Deflection () < 1.1 * theDEdge->GetDeflection ();
|
||||
Standard_Boolean isConsistent = aPolygon->HasParameters() &&
|
||||
BRepMesh_Deflection::IsConsistent (aPolygon->Deflection(),
|
||||
theDEdge->GetDeflection(),
|
||||
myParameters.AllowQualityDecrease);
|
||||
|
||||
if (!isConsistent)
|
||||
{
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
const IMeshData::IFaceHandle& theDFace);
|
||||
|
||||
//! Functor API to discretize the given edge.
|
||||
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
||||
void operator() (const Standard_Integer theEdgeIndex) const {
|
||||
process (theEdgeIndex);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
const IMeshData::IEdgeHandle& theDEdge,
|
||||
const Standard_Boolean theUpdateEnds);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -45,6 +45,12 @@ public:
|
||||
|
||||
//! Constructor. Initializes empty provider.
|
||||
BRepMesh_EdgeParameterProvider()
|
||||
: myIsSameParam(Standard_False),
|
||||
myFirstParam(0.0),
|
||||
myOldFirstParam(0.0),
|
||||
myScale(0.0),
|
||||
myCurParam(0.0),
|
||||
myFoundParam(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include <IMeshData_Face.hxx>
|
||||
#include <IMeshData_Edge.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
gp_Pnt& thePoint,
|
||||
Standard_Real& theParameter) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <BRepMesh_GeomTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceChecker, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
const Standard_Real MaxTangentAngle = 5. * M_PI / 180.;
|
||||
@@ -103,6 +105,7 @@ namespace
|
||||
BndBox2dTreeSelector(const Standard_Real theTolerance)
|
||||
: myMaxLoopSize(M_PI * theTolerance * theTolerance),
|
||||
mySelfSegmentIndex(-1),
|
||||
mySegment(0),
|
||||
myIndices(256, new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE))
|
||||
{
|
||||
}
|
||||
|
@@ -38,8 +38,9 @@ public: //! @name mesher API
|
||||
gp_Pnt2d* Point2; // / using indices.
|
||||
|
||||
Segment()
|
||||
: Point1(NULL)
|
||||
, Point2(NULL)
|
||||
: EdgePtr(NULL),
|
||||
Point1(NULL),
|
||||
Point2(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,17 +78,17 @@ public: //! @name mesher API
|
||||
}
|
||||
|
||||
//! Checks wire with the given index for intersection with others.
|
||||
inline void operator()(const Standard_Integer theWireIndex) const
|
||||
void operator()(const Standard_Integer theWireIndex) const
|
||||
{
|
||||
perform(theWireIndex);
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceChecker, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_FaceChecker, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
//! Returns True in case if check can be performed in parallel mode.
|
||||
inline Standard_Boolean isParallel() const
|
||||
Standard_Boolean isParallel() const
|
||||
{
|
||||
return (myParameters.InParallel && myDFace->WiresNb() > 1);
|
||||
}
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include <IMeshTools_MeshAlgo.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
@@ -39,6 +41,24 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
|
||||
{
|
||||
}
|
||||
|
||||
//! Auxiliary functor for parallel processing of Faces.
|
||||
class BRepMesh_FaceDiscret::FaceListFunctor
|
||||
{
|
||||
public:
|
||||
FaceListFunctor (BRepMesh_FaceDiscret* theAlgo)
|
||||
: myAlgo (theAlgo)
|
||||
{
|
||||
}
|
||||
|
||||
void operator() (const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
myAlgo->process(theFaceIndex);
|
||||
}
|
||||
|
||||
private:
|
||||
mutable BRepMesh_FaceDiscret* myAlgo;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
// Function: Perform
|
||||
// Purpose :
|
||||
@@ -54,7 +74,8 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1));
|
||||
FaceListFunctor aFunctor(this);
|
||||
OSD_Parallel::For(0, myModel->FacesNb(), aFunctor, !(myParameters.InParallel && myModel->FacesNb() > 1));
|
||||
|
||||
myModel.Nullify(); // Do not hold link to model.
|
||||
return Standard_True;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
#include <IMeshData_Types.hxx>
|
||||
#include <IMeshTools_MeshAlgoFactory.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
//! Class implements functionality starting triangulation of model's faces.
|
||||
//! Each face is processed separately and can be executed in parallel mode.
|
||||
@@ -36,12 +37,7 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
|
||||
|
||||
//! Functor API to discretize the given edge.
|
||||
inline void operator() (const Standard_Integer theFaceIndex) const {
|
||||
process(theFaceIndex);
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -55,6 +51,9 @@ private:
|
||||
//! Checks existing discretization of the face and updates data model.
|
||||
void process(const Standard_Integer theFaceIndex) const;
|
||||
|
||||
private:
|
||||
class FaceListFunctor;
|
||||
|
||||
private:
|
||||
|
||||
Handle(IMeshTools_MeshAlgoFactory) myAlgoFactory;
|
||||
|
@@ -99,15 +99,15 @@ public:
|
||||
//! @param theIsReplace if TRUE replaces existing point lying within
|
||||
//! parameteric tolerance of the given point.
|
||||
//! @return index of new added point or found with parametric tolerance
|
||||
inline Standard_Integer AddPoint(const gp_Pnt& thePoint,
|
||||
const Standard_Real theParam,
|
||||
const Standard_Boolean theIsReplace = Standard_True)
|
||||
Standard_Integer AddPoint(const gp_Pnt& thePoint,
|
||||
const Standard_Real theParam,
|
||||
const Standard_Boolean theIsReplace = Standard_True)
|
||||
{
|
||||
return myDiscretTool.AddPoint(thePoint, theParam, theIsReplace);
|
||||
}
|
||||
|
||||
//! Returns number of discretization points.
|
||||
inline Standard_Integer NbPoints() const
|
||||
Standard_Integer NbPoints() const
|
||||
{
|
||||
return myDiscretTool.NbPoints();
|
||||
}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <IMeshData_Wire.hxx>
|
||||
#include <IMeshTools_MeshBuilder.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Default flag to control parallelization for BRepMesh_IncrementalMesh
|
||||
@@ -108,15 +110,18 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
|
||||
|
||||
myStatus = IMeshData_NoError;
|
||||
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
|
||||
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
|
||||
if (!aModel.IsNull())
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
|
||||
myStatus |= aDFace->GetStatusMask();
|
||||
|
||||
for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
|
||||
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
|
||||
{
|
||||
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
|
||||
myStatus |= aDWire->GetStatusMask();
|
||||
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
|
||||
myStatus |= aDFace->GetStatusMask();
|
||||
|
||||
for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
|
||||
{
|
||||
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
|
||||
myStatus |= aDWire->GetStatusMask();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -61,25 +61,25 @@ public: //! @name mesher API
|
||||
public: //! @name accessing to parameters.
|
||||
|
||||
//! Returns meshing parameters
|
||||
inline const IMeshTools_Parameters& Parameters() const
|
||||
const IMeshTools_Parameters& Parameters() const
|
||||
{
|
||||
return myParameters;
|
||||
}
|
||||
|
||||
//! Returns modifiable meshing parameters
|
||||
inline IMeshTools_Parameters& ChangeParameters()
|
||||
IMeshTools_Parameters& ChangeParameters()
|
||||
{
|
||||
return myParameters;
|
||||
}
|
||||
|
||||
//! Returns modified flag.
|
||||
inline Standard_Boolean IsModified() const
|
||||
Standard_Boolean IsModified() const
|
||||
{
|
||||
return myModified;
|
||||
}
|
||||
|
||||
//! Returns accumulated status flags faced during meshing.
|
||||
inline Standard_Integer GetStatusFlags() const
|
||||
Standard_Integer GetStatusFlags() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public: //! @name accessing to parameters.
|
||||
private:
|
||||
|
||||
//! Initializes specific parameters
|
||||
inline void initParameters()
|
||||
void initParameters()
|
||||
{
|
||||
if (myParameters.DeflectionInterior < Precision::Confusion())
|
||||
{
|
||||
@@ -129,7 +129,7 @@ public: //! @name plugin API
|
||||
//! Discret() static method (thus applied only to Mesh Factories).
|
||||
Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
|
||||
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
|
||||
namespace
|
||||
{
|
||||
struct BaseMeshAlgo
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <IMeshTools_MeshAlgoFactory.hxx>
|
||||
|
||||
//! Default implementation of IMeshTools_MeshAlgoFactory providing algorithms
|
||||
//! of different compexity depending on type of target surface.
|
||||
//! of different complexity depending on type of target surface.
|
||||
class BRepMesh_MeshAlgoFactory : public IMeshTools_MeshAlgoFactory
|
||||
{
|
||||
public:
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
const GeomAbs_SurfaceType theSurfaceType,
|
||||
const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
|
||||
};
|
||||
|
||||
#endif
|
@@ -24,10 +24,12 @@
|
||||
#include <BRepTools.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshTool, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Returns index of triangle node opposite to the given link.
|
||||
inline Standard_Integer findApexIndex(
|
||||
Standard_Integer findApexIndex(
|
||||
const Standard_Integer(&aNodes)[3],
|
||||
const BRepMesh_Edge& theLink)
|
||||
{
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
mySign = myConstraint.Direction().X() > 0;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IsAbove(const Standard_Integer theNodeIndex) const
|
||||
Standard_Boolean IsAbove(const Standard_Integer theNodeIndex) const
|
||||
{
|
||||
const BRepMesh_Vertex& aVertex = myStructure->GetNode(theNodeIndex);
|
||||
const gp_Vec2d aNodeVec(myConstraint.Location(), aVertex.Coord());
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
Standard_EXPORT virtual ~BRepMesh_MeshTool();
|
||||
|
||||
//! Returns data structure manipulated by this tool.
|
||||
inline const Handle(BRepMesh_DataStructureOfDelaun)& GetStructure() const
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& GetStructure() const
|
||||
{
|
||||
return myStructure;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
|
||||
//! Adds new triangle with specified nodes to mesh.
|
||||
//! Legalizes triangle in case if it violates circle criteria.
|
||||
inline void AddAndLegalizeTriangle(
|
||||
void AddAndLegalizeTriangle(
|
||||
const Standard_Integer thePoint1,
|
||||
const Standard_Integer thePoint2,
|
||||
const Standard_Integer thePoint3)
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
//! Adds new triangle with specified nodes to mesh.
|
||||
inline void AddTriangle(
|
||||
void AddTriangle(
|
||||
const Standard_Integer thePoint1,
|
||||
const Standard_Integer thePoint2,
|
||||
const Standard_Integer thePoint3,
|
||||
@@ -128,10 +128,10 @@ public:
|
||||
|
||||
//! Adds new link to mesh.
|
||||
//! Updates link index and link orientaion parameters.
|
||||
inline void AddLink(const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode,
|
||||
Standard_Integer& theLinkIndex,
|
||||
Standard_Boolean& theLinkOri)
|
||||
void AddLink(const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode,
|
||||
Standard_Integer& theLinkIndex,
|
||||
Standard_Boolean& theLinkOri)
|
||||
{
|
||||
const Standard_Integer aLinkIt = myStructure->AddLink(
|
||||
BRepMesh_Edge(theFirstNode, theLastNode, BRepMesh_Free));
|
||||
@@ -169,12 +169,12 @@ public:
|
||||
//! Gives the list of edges with type defined by input parameter.
|
||||
Standard_EXPORT Handle(IMeshData::MapOfInteger) GetEdgesByType(const BRepMesh_DegreeOfFreedom theEdgeType) const;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_MeshTool, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_MeshTool, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
//! Returns True if the given point lies within circumcircle of the given triangle.
|
||||
inline Standard_Boolean checkCircle(
|
||||
Standard_Boolean checkCircle(
|
||||
const Standard_Integer(&aNodes)[3],
|
||||
const Standard_Integer thePoint)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ private:
|
||||
|
||||
//! Adds new triangle with the given nodes and updates
|
||||
//! links stack by ones are not in used map.
|
||||
inline void addTriangleAndUpdateStack(
|
||||
void addTriangleAndUpdateStack(
|
||||
const Standard_Integer theNode0,
|
||||
const Standard_Integer theNode1,
|
||||
const Standard_Integer theNode2,
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_ModelBuilder ();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelBuilder, IMeshTools_ModelBuilder)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -33,6 +33,8 @@
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Decreases deflection of the given edge and tries to update discretization.
|
||||
@@ -73,7 +75,7 @@ namespace
|
||||
};
|
||||
|
||||
//! Returns True if some of two vertcies is same with reference one.
|
||||
inline Standard_Boolean isSameWithSomeOf(
|
||||
Standard_Boolean isSameWithSomeOf(
|
||||
const TopoDS_Vertex& theRefVertex,
|
||||
const TopoDS_Vertex& theVertex1,
|
||||
const TopoDS_Vertex& theVertex2)
|
||||
@@ -83,7 +85,7 @@ namespace
|
||||
}
|
||||
|
||||
//! Returns True if some of two vertcies is within tolerance of reference one.
|
||||
inline Standard_Boolean isInToleranceWithSomeOf(
|
||||
Standard_Boolean isInToleranceWithSomeOf(
|
||||
const gp_Pnt& theRefPoint,
|
||||
const gp_Pnt& thePoint1,
|
||||
const gp_Pnt& thePoint2,
|
||||
|
@@ -45,16 +45,16 @@ public:
|
||||
Standard_EXPORT virtual ~BRepMesh_ModelHealer();
|
||||
|
||||
//! Functor API to discretize the given edge.
|
||||
inline void operator() (const Standard_Integer theEdgeIndex) const {
|
||||
void operator() (const Standard_Integer theEdgeIndex) const {
|
||||
process(theEdgeIndex);
|
||||
}
|
||||
|
||||
//! Functor API to discretize the given edge.
|
||||
inline void operator() (const IMeshData::IFaceHandle& theDFace) const {
|
||||
void operator() (const IMeshData::IFaceHandle& theDFace) const {
|
||||
process(theDFace);
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelHealer, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
private:
|
||||
|
||||
//! Checks existing discretization of the face and updates data model.
|
||||
inline void process(const Standard_Integer theFaceIndex) const
|
||||
void process(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
process(aDFace);
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
//! Chooses the most closest point to reference one from the given pair.
|
||||
//! Returns square distance between reference point and closest one as
|
||||
//! well as pointer to closest point.
|
||||
inline Standard_Real closestPoint(
|
||||
Standard_Real closestPoint(
|
||||
gp_Pnt2d& theRefPnt,
|
||||
gp_Pnt2d& theFristPnt,
|
||||
gp_Pnt2d& theSecondPnt,
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
//! Chooses the most closest points among the given to reference one from the given pair.
|
||||
//! Returns square distance between reference point and closest one as
|
||||
//! well as pointer to closest point.
|
||||
inline Standard_Real closestPoints(
|
||||
Standard_Real closestPoints(
|
||||
gp_Pnt2d& theFirstPnt1,
|
||||
gp_Pnt2d& theSecondPnt1,
|
||||
gp_Pnt2d& theFirstPnt2,
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
//! Adjusts the given pair of points supposed to be the same.
|
||||
//! In addition, adjusts another end-point of an edge in order
|
||||
//! to perform correct matching in case of gap.
|
||||
inline void adjustSamePoints(
|
||||
void adjustSamePoints(
|
||||
gp_Pnt2d*& theMajorSamePnt1,
|
||||
gp_Pnt2d*& theMinorSamePnt1,
|
||||
gp_Pnt2d*& theMajorSamePnt2,
|
||||
@@ -167,7 +167,7 @@ private:
|
||||
void fixFaceBoundaries(const IMeshData::IFaceHandle& theDFace) const;
|
||||
|
||||
//! Returns True if check can be done in parallel.
|
||||
inline Standard_Boolean isParallel() const
|
||||
Standard_Boolean isParallel() const
|
||||
{
|
||||
return (myParameters.InParallel && myModel->FacesNb() > 1);
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include <IMeshData_PCurve.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Commits 3D polygons and polygons on triangulations for corresponding edges.
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_ModelPostProcessor();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepMesh_ModelPreProcessor.hxx>
|
||||
#include <BRepMesh_Deflection.hxx>
|
||||
#include <BRepMesh_ShapeTool.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <IMeshData_Model.hxx>
|
||||
@@ -23,6 +24,8 @@
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <BRepMesh_ConeRangeSplitter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Checks consistency of triangulation stored in topological face.
|
||||
@@ -30,8 +33,10 @@ namespace
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
TriangulationConsistency(const Handle(IMeshData_Model)& theModel)
|
||||
TriangulationConsistency(const Handle(IMeshData_Model)& theModel,
|
||||
const Standard_Boolean theAllowQualityDecrease)
|
||||
: myModel (theModel)
|
||||
, myAllowQualityDecrease (theAllowQualityDecrease)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,7 +56,9 @@ namespace
|
||||
if (!aTriangulation.IsNull())
|
||||
{
|
||||
Standard_Boolean isTriangulationConsistent =
|
||||
aTriangulation->Deflection() < 1.1 * aDFace->GetDeflection();
|
||||
BRepMesh_Deflection::IsConsistent (aTriangulation->Deflection(),
|
||||
aDFace->GetDeflection(),
|
||||
myAllowQualityDecrease);
|
||||
|
||||
if (isTriangulationConsistent)
|
||||
{
|
||||
@@ -88,6 +95,7 @@ namespace
|
||||
private:
|
||||
|
||||
Handle(IMeshData_Model) myModel;
|
||||
Standard_Boolean myAllowQualityDecrease; //!< Flag used for consistency check
|
||||
};
|
||||
|
||||
//! Adds additional points to seam edges on specific surfaces.
|
||||
@@ -251,8 +259,10 @@ Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
OSD_Parallel::For(0, theModel->FacesNb(), SeamEdgeAmplifier(theModel, theParameters), !theParameters.InParallel);
|
||||
OSD_Parallel::For(0, theModel->FacesNb(), TriangulationConsistency(theModel), !theParameters.InParallel);
|
||||
const Standard_Integer aFacesNb = theModel->FacesNb();
|
||||
const Standard_Boolean isOneThread = !theParameters.InParallel;
|
||||
OSD_Parallel::For(0, aFacesNb, SeamEdgeAmplifier (theModel, theParameters), isOneThread);
|
||||
OSD_Parallel::For(0, aFacesNb, TriangulationConsistency (theModel, theParameters.AllowQualityDecrease), isOneThread);
|
||||
|
||||
// Clean edges and faces from outdated polygons.
|
||||
Handle(NCollection_IncAllocator) aTmpAlloc(new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE));
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_ModelPreProcessor();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ModelPreProcessor, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -44,7 +44,10 @@ namespace
|
||||
myParamsForbiddenToRemove(theParamsForbiddenToRemove),
|
||||
myControlParamsForbiddenToRemove(theControlParamsForbiddenToRemove),
|
||||
myAllocator(new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
|
||||
myControlParamsToRemove(new IMeshData::MapOfReal(1, myAllocator))
|
||||
myControlParamsToRemove(new IMeshData::MapOfReal(1, myAllocator)),
|
||||
myCurrParam(0.0),
|
||||
myCurrControlParam(0.0),
|
||||
myPrevControlParam(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -214,7 +217,7 @@ namespace
|
||||
};
|
||||
|
||||
//! Adds param to map if it fits specified range.
|
||||
inline Standard_Boolean addParam(
|
||||
Standard_Boolean addParam(
|
||||
const Standard_Real& theParam,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
IMeshData::IMapOfReal& theParams)
|
||||
@@ -230,7 +233,7 @@ namespace
|
||||
}
|
||||
|
||||
//! Initializes parameters map using CN intervals.
|
||||
inline Standard_Boolean initParamsFromIntervals(
|
||||
Standard_Boolean initParamsFromIntervals(
|
||||
const TColStd_Array1OfReal& theIntervals,
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
const Standard_Boolean isSplitIntervals,
|
||||
@@ -269,11 +272,17 @@ namespace
|
||||
for (; aIntervalU <= theIntervals[0].Upper (); ++aIntervalU)
|
||||
{
|
||||
const Standard_Real aParamU = theIntervals[0].Value(aIntervalU);
|
||||
if (Precision::IsInfinite (aParamU))
|
||||
continue;
|
||||
|
||||
Standard_Integer aIntervalV = theIntervals[1].Lower ();
|
||||
for (; aIntervalV <= theIntervals[1].Upper (); ++aIntervalV)
|
||||
{
|
||||
gp_Dir aNorm;
|
||||
const Standard_Real aParamV = theIntervals[1].Value(aIntervalV);
|
||||
if (Precision::IsInfinite (aParamV))
|
||||
continue;
|
||||
|
||||
if (GeomLib::NormEstim (theSurf, gp_Pnt2d (aParamU, aParamV), Precision::Confusion (), aNorm) != 0)
|
||||
{
|
||||
return Standard_True;
|
||||
|
@@ -28,6 +28,7 @@ public:
|
||||
|
||||
//! Constructor.
|
||||
BRepMesh_NURBSRangeSplitter()
|
||||
: mySurfaceType(GeomAbs_OtherSurface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -43,13 +43,13 @@ public:
|
||||
}
|
||||
|
||||
//! Returns index of first node of the Link.
|
||||
inline Standard_Integer FirstNode() const
|
||||
Standard_Integer FirstNode() const
|
||||
{
|
||||
return myFirstNode;
|
||||
}
|
||||
|
||||
//! Returns index of last node of the Link.
|
||||
inline Standard_Integer LastNode() const
|
||||
Standard_Integer LastNode() const
|
||||
{
|
||||
return myLastNode;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
//! Computes a hash code for this oriented edge, in the range [1, theUpperBound]
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
inline Standard_Integer HashCode (const Standard_Integer theUpperBound) const
|
||||
Standard_Integer HashCode (const Standard_Integer theUpperBound) const
|
||||
{
|
||||
return ::HashCode (myFirstNode + myLastNode, theUpperBound);
|
||||
}
|
||||
@@ -65,13 +65,13 @@ public:
|
||||
//! Checks this and other edge for equality.
|
||||
//! @param theOther edge to be checked against this one.
|
||||
//! @retrun TRUE if edges have the same orientation, FALSE if not.
|
||||
inline Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
|
||||
{
|
||||
return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
inline Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
|
||||
Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
|
||||
//! Appends index to the pair.
|
||||
inline void Append(const Standard_Integer theIndex)
|
||||
void Append(const Standard_Integer theIndex)
|
||||
{
|
||||
if (myIndex[0] < 0)
|
||||
myIndex[0] = theIndex;
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
//! Prepends index to the pair.
|
||||
inline void Prepend(const Standard_Integer theIndex)
|
||||
void Prepend(const Standard_Integer theIndex)
|
||||
{
|
||||
if (myIndex[1] >= 0)
|
||||
throw Standard_OutOfRange("BRepMesh_PairOfIndex::Prepend, more than two index to store");
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns is pair is empty.
|
||||
inline Standard_Boolean IsEmpty() const
|
||||
Standard_Boolean IsEmpty() const
|
||||
{
|
||||
// Check only first index. It is impossible to update
|
||||
// second index if the first one is empty.
|
||||
@@ -70,26 +70,26 @@ public:
|
||||
}
|
||||
|
||||
//! Returns number of initialized indeces.
|
||||
inline Standard_Integer Extent() const
|
||||
Standard_Integer Extent() const
|
||||
{
|
||||
return (myIndex[0] < 0 ? 0 : (myIndex[1] < 0 ? 1 : 2));
|
||||
}
|
||||
|
||||
//! Returns first index of pair.
|
||||
inline Standard_Integer FirstIndex() const
|
||||
Standard_Integer FirstIndex() const
|
||||
{
|
||||
return myIndex[0];
|
||||
}
|
||||
|
||||
//! Returns last index of pair
|
||||
inline Standard_Integer LastIndex() const
|
||||
Standard_Integer LastIndex() const
|
||||
{
|
||||
return (myIndex[1] < 0 ? myIndex[0] : myIndex[1]);
|
||||
}
|
||||
|
||||
//! Returns index corresponding to the given position in the pair.
|
||||
//! @param thePairPos position of index in the pair (1 or 2).
|
||||
inline Standard_Integer Index(const Standard_Integer thePairPos) const
|
||||
Standard_Integer Index(const Standard_Integer thePairPos) const
|
||||
{
|
||||
if (thePairPos != 1 && thePairPos != 2)
|
||||
throw Standard_OutOfRange("BRepMesh_PairOfIndex::Index, requested index is out of range");
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
//! Sets index corresponding to the given position in the pair.
|
||||
//! @param thePairPos position of index in the pair (1 or 2).
|
||||
//! @param theIndex index to be stored.
|
||||
inline void SetIndex(const Standard_Integer thePairPos,
|
||||
const Standard_Integer theIndex)
|
||||
void SetIndex(const Standard_Integer thePairPos,
|
||||
const Standard_Integer theIndex)
|
||||
{
|
||||
if (thePairPos != 1 && thePairPos != 2)
|
||||
throw Standard_OutOfRange("BRepMesh_PairOfIndex::SetIndex, requested index is out of range");
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
//! Remove index from the given position.
|
||||
//! @param thePairPos position of index in the pair (1 or 2).
|
||||
inline void RemoveIndex(const Standard_Integer thePairPos)
|
||||
void RemoveIndex(const Standard_Integer thePairPos)
|
||||
{
|
||||
if (thePairPos != 1 && thePairPos != 2)
|
||||
throw Standard_OutOfRange("BRepMesh_PairOfIndex::RemoveIndex, requested index is out of range");
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <BRepMesh_PairOfIndex.hxx>
|
||||
#include <BRepMesh_Edge.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Default constructor
|
||||
//purpose :
|
||||
|
@@ -60,40 +60,40 @@ public:
|
||||
Standard_EXPORT void NeighboursByEdgeOf(const BRepMesh_Triangle& theElement);
|
||||
|
||||
//! Adds a level of neighbours by edge to the selector.
|
||||
inline void NeighboursOf(const BRepMesh_SelectorOfDataStructureOfDelaun& /*theSelector*/)
|
||||
void NeighboursOf(const BRepMesh_SelectorOfDataStructureOfDelaun& /*theSelector*/)
|
||||
{
|
||||
}
|
||||
|
||||
//! Adds a level of neighbours by edge the selector.
|
||||
inline void AddNeighbours()
|
||||
void AddNeighbours()
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns selected nodes.
|
||||
inline const IMeshData::MapOfInteger& Nodes() const
|
||||
const IMeshData::MapOfInteger& Nodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
//! Returns selected links.
|
||||
inline const IMeshData::MapOfInteger& Links() const
|
||||
const IMeshData::MapOfInteger& Links() const
|
||||
{
|
||||
return myLinks;
|
||||
}
|
||||
|
||||
//! Returns selected elements.
|
||||
inline const IMeshData::MapOfInteger& Elements() const
|
||||
const IMeshData::MapOfInteger& Elements() const
|
||||
{
|
||||
return myElements;
|
||||
}
|
||||
|
||||
//! Gives the list of incices of frontier links.
|
||||
inline const IMeshData::MapOfInteger& FrontierLinks() const
|
||||
const IMeshData::MapOfInteger& FrontierLinks() const
|
||||
{
|
||||
return myFrontier;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Auxilary struct to take a tolerance of edge.
|
||||
@@ -72,7 +74,7 @@ Standard_Real BRepMesh_ShapeTool::MaxFaceTolerance(const TopoDS_Face& theFace)
|
||||
Standard_Real aMaxTolerance = BRep_Tool::Tolerance(theFace);
|
||||
|
||||
Standard_Real aTolerance = Max(
|
||||
MaxTolerance<TopAbs_EDGE, EdgeTolerance >(theFace),
|
||||
MaxTolerance<TopAbs_EDGE, EdgeTolerance >(theFace),
|
||||
MaxTolerance<TopAbs_VERTEX, VertexTolerance>(theFace));
|
||||
|
||||
return Max(aMaxTolerance, aTolerance);
|
||||
|
@@ -150,7 +150,7 @@ public:
|
||||
Standard_Real& theLastParam,
|
||||
const Standard_Boolean isConsiderOrientation = Standard_False);
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeTool, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeTool, Standard_Transient)
|
||||
};
|
||||
|
||||
#endif
|
@@ -33,6 +33,8 @@
|
||||
#include <IMeshTools_Context.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
//! Handles TopoDS_Edge object.
|
||||
Standard_EXPORT virtual void Visit (const TopoDS_Edge& theEdge) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_ShapeVisitor, IMeshTools_ShapeVisitor)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
private:
|
||||
|
||||
//! Computes step for the given range.
|
||||
inline void computeStep(
|
||||
void computeStep(
|
||||
const std::pair<Standard_Real, Standard_Real>& theRange,
|
||||
const Standard_Real theDefaultStep,
|
||||
std::pair<Standard_Real, Standard_Real>& theStepAndOffset) const
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
//! @param theEdges array of edges of triangle.
|
||||
//! @param theOrientations array of edge's orientations.
|
||||
//! @param theMovability movability of triangle.
|
||||
inline void Initialize(
|
||||
void Initialize(
|
||||
const Standard_Integer (&theEdges)[3],
|
||||
const Standard_Boolean (&theOrientations)[3],
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
@@ -73,21 +73,21 @@ public:
|
||||
//! Gets edges with orientations composing the triangle.
|
||||
//! @param[out] theEdges array edges are stored to.
|
||||
//! @param[out] theOrientations array orientations are stored to.
|
||||
inline void Edges(Standard_Integer (&theEdges)[3],
|
||||
Standard_Boolean (&theOrientations)[3]) const
|
||||
void Edges(Standard_Integer (&theEdges)[3],
|
||||
Standard_Boolean (&theOrientations)[3]) const
|
||||
{
|
||||
memcpy(theEdges, myEdges, sizeof(myEdges));
|
||||
memcpy(theOrientations, myOrientations, sizeof(myOrientations));
|
||||
}
|
||||
|
||||
//! Returns movability of the triangle.
|
||||
inline BRepMesh_DegreeOfFreedom Movability() const
|
||||
BRepMesh_DegreeOfFreedom Movability() const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
||||
|
||||
//! Sets movability of the triangle.
|
||||
inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
myMovability = theMovability;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
//! Computes a hash code for this triangle, in the range [1, theUpperBound]
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
inline Standard_Integer HashCode (const Standard_Integer theUpperBound) const
|
||||
Standard_Integer HashCode (const Standard_Integer theUpperBound) const
|
||||
{
|
||||
return ::HashCode (myEdges[0] + myEdges[1] + myEdges[2], theUpperBound);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
//! Checks for equality with another triangle.
|
||||
//! @param theOther triangle to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
inline Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
|
||||
return Standard_False;
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
inline Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
@@ -49,25 +49,25 @@ public:
|
||||
|
||||
public:
|
||||
//! Returns U parameters.
|
||||
inline const IMeshData::IMapOfReal& GetParametersU() const
|
||||
const IMeshData::IMapOfReal& GetParametersU() const
|
||||
{
|
||||
return myUParams;
|
||||
}
|
||||
|
||||
//! Returns U parameters.
|
||||
inline IMeshData::IMapOfReal& GetParametersU()
|
||||
IMeshData::IMapOfReal& GetParametersU()
|
||||
{
|
||||
return myUParams;
|
||||
}
|
||||
|
||||
//! Returns V parameters.
|
||||
inline const IMeshData::IMapOfReal& GetParametersV() const
|
||||
const IMeshData::IMapOfReal& GetParametersV() const
|
||||
{
|
||||
return myVParams;
|
||||
}
|
||||
|
||||
//! Returns V parameters.
|
||||
inline IMeshData::IMapOfReal& GetParametersV()
|
||||
IMeshData::IMapOfReal& GetParametersV()
|
||||
{
|
||||
return myVParams;
|
||||
}
|
||||
|
@@ -65,9 +65,9 @@ public:
|
||||
//! @param theUV position of vertex in parametric space.
|
||||
//! @param theLocation3d index of 3d point to be associated with vertex.
|
||||
//! @param theMovability movability of the vertex.
|
||||
inline void Initialize(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
void Initialize(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
myUV = theUV;
|
||||
myLocation3d = theLocation3d;
|
||||
@@ -75,31 +75,31 @@ public:
|
||||
}
|
||||
|
||||
//! Returns position of the vertex in parametric space.
|
||||
inline const gp_XY& Coord() const
|
||||
const gp_XY& Coord() const
|
||||
{
|
||||
return myUV;
|
||||
}
|
||||
|
||||
//! Returns position of the vertex in parametric space for modification.
|
||||
inline gp_XY& ChangeCoord()
|
||||
gp_XY& ChangeCoord()
|
||||
{
|
||||
return myUV;
|
||||
}
|
||||
|
||||
//! Returns index of 3d point associated with the vertex.
|
||||
inline Standard_Integer Location3d() const
|
||||
Standard_Integer Location3d() const
|
||||
{
|
||||
return myLocation3d;
|
||||
}
|
||||
|
||||
//! Returns movability of the vertex.
|
||||
inline BRepMesh_DegreeOfFreedom Movability() const
|
||||
BRepMesh_DegreeOfFreedom Movability() const
|
||||
{
|
||||
return myMovability;
|
||||
}
|
||||
|
||||
//! Sets movability of the vertex.
|
||||
inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
myMovability = theMovability;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
//! Computes a hash code for this vertex, in the range [1, theUpperBound]
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
inline Standard_Integer HashCode(const Standard_Integer theUpperBound) const
|
||||
Standard_Integer HashCode(const Standard_Integer theUpperBound) const
|
||||
{
|
||||
return ::HashCode(Floor(1e5 * myUV.X()) * Floor(1e5 * myUV.Y()), theUpperBound);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
//! Checks for equality with another vertex.
|
||||
//! @param theOther vertex to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
inline Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted ||
|
||||
theOther.myMovability == BRepMesh_Deleted)
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
inline Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
//! Sets the tolerance to be used for identification of
|
||||
//! coincident vertices equal for both dimensions.
|
||||
inline void SetTolerance(const Standard_Real theTolerance)
|
||||
void SetTolerance(const Standard_Real theTolerance)
|
||||
{
|
||||
myTolerance[0] = theTolerance * theTolerance;
|
||||
myTolerance[1] = 0.;
|
||||
@@ -70,15 +70,15 @@ public:
|
||||
//! coincident vertices.
|
||||
//! @param theToleranceX tolerance for X dimension.
|
||||
//! @param theToleranceY tolerance for Y dimension.
|
||||
inline void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
{
|
||||
myTolerance[0] = theToleranceX * theToleranceX;
|
||||
myTolerance[1] = theToleranceY * theToleranceY;
|
||||
}
|
||||
|
||||
//! Clear inspector's internal data structures.
|
||||
inline void Clear()
|
||||
void Clear()
|
||||
{
|
||||
myVertices->Clear();
|
||||
myDelNodes.Clear();
|
||||
@@ -86,26 +86,26 @@ public:
|
||||
|
||||
//! Deletes vertex with the given index.
|
||||
//! @param theIndex index of vertex to be removed.
|
||||
inline void Delete(const Standard_Integer theIndex)
|
||||
void Delete(const Standard_Integer theIndex)
|
||||
{
|
||||
myVertices->ChangeValue(theIndex - 1).SetMovability(BRepMesh_Deleted);
|
||||
myDelNodes.Append(theIndex);
|
||||
}
|
||||
|
||||
//! Returns number of registered vertices.
|
||||
inline Standard_Integer NbVertices() const
|
||||
Standard_Integer NbVertices() const
|
||||
{
|
||||
return myVertices->Length();
|
||||
}
|
||||
|
||||
//! Returns vertex with the given index.
|
||||
inline BRepMesh_Vertex& GetVertex(Standard_Integer theIndex)
|
||||
BRepMesh_Vertex& GetVertex(Standard_Integer theIndex)
|
||||
{
|
||||
return myVertices->ChangeValue(theIndex - 1);
|
||||
}
|
||||
|
||||
//! Set reference point to be checked.
|
||||
inline void SetPoint(const gp_XY& thePoint)
|
||||
void SetPoint(const gp_XY& thePoint)
|
||||
{
|
||||
myIndex = 0;
|
||||
myMinSqDist = RealLast();
|
||||
@@ -113,26 +113,26 @@ public:
|
||||
}
|
||||
|
||||
//! Returns index of point coinciding with regerence one.
|
||||
inline Standard_Integer GetCoincidentPoint() const
|
||||
Standard_Integer GetCoincidentPoint() const
|
||||
{
|
||||
return myIndex;
|
||||
}
|
||||
|
||||
//! Returns list with indexes of vertices that have movability attribute
|
||||
//! equal to BRepMesh_Deleted and can be replaced with another node.
|
||||
inline const IMeshData::ListOfInteger& GetListOfDelPoints() const
|
||||
const IMeshData::ListOfInteger& GetListOfDelPoints() const
|
||||
{
|
||||
return myDelNodes;
|
||||
}
|
||||
|
||||
//! Returns set of mesh vertices.
|
||||
inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
|
||||
const Handle(IMeshData::VectorOfVertex)& Vertices() const
|
||||
{
|
||||
return myVertices;
|
||||
}
|
||||
|
||||
//! Returns set of mesh vertices for modification.
|
||||
inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
|
||||
Handle(IMeshData::VectorOfVertex)& ChangeVertices()
|
||||
{
|
||||
return myVertices;
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include <BRepMesh_VertexTool.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Inspect
|
||||
//purpose :
|
||||
|
@@ -99,19 +99,19 @@ public:
|
||||
Standard_EXPORT void DeleteVertex(const Standard_Integer theIndex);
|
||||
|
||||
//! Returns set of mesh vertices.
|
||||
inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
|
||||
const Handle(IMeshData::VectorOfVertex)& Vertices() const
|
||||
{
|
||||
return mySelector.Vertices();
|
||||
}
|
||||
|
||||
//! Returns set of mesh vertices.
|
||||
inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
|
||||
Handle(IMeshData::VectorOfVertex)& ChangeVertices()
|
||||
{
|
||||
return mySelector.ChangeVertices();
|
||||
}
|
||||
|
||||
//! Returns vertex by the given index.
|
||||
inline const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex)
|
||||
const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex)
|
||||
{
|
||||
return mySelector.GetVertex(theIndex);
|
||||
}
|
||||
@@ -125,13 +125,13 @@ public:
|
||||
}
|
||||
|
||||
//! Returns a number of vertices.
|
||||
inline Standard_Integer Extent() const
|
||||
Standard_Integer Extent() const
|
||||
{
|
||||
return mySelector.NbVertices();
|
||||
}
|
||||
|
||||
//! Returns True when the map contains no keys. <br>
|
||||
inline Standard_Boolean IsEmpty() const
|
||||
Standard_Boolean IsEmpty() const
|
||||
{
|
||||
return (Extent() == 0);
|
||||
}
|
||||
@@ -143,14 +143,14 @@ public:
|
||||
const BRepMesh_Vertex& theVertex);
|
||||
|
||||
//! Remove last node from the structure.
|
||||
inline void RemoveLast()
|
||||
void RemoveLast()
|
||||
{
|
||||
DeleteVertex(Extent());
|
||||
}
|
||||
|
||||
//! Returns the list with indexes of vertices that have movability attribute
|
||||
//! equal to BRepMesh_Deleted and can be replaced with another node.
|
||||
inline const IMeshData::ListOfInteger& GetListOfDelNodes() const
|
||||
const IMeshData::ListOfInteger& GetListOfDelNodes() const
|
||||
{
|
||||
return mySelector.GetListOfDelPoints();
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
//! Prints statistics.
|
||||
Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_VertexTool, Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
@@ -166,9 +166,9 @@ private:
|
||||
//! @param thePoint point to be expanded.
|
||||
//! @param[out] theMinPoint bottom left corner of area defined by expanded point.
|
||||
//! @param[out] theMaxPoint top right corner of area defined by expanded point.
|
||||
inline void expandPoint(const gp_XY& thePoint,
|
||||
gp_XY& theMinPoint,
|
||||
gp_XY& theMaxPoint)
|
||||
void expandPoint(const gp_XY& thePoint,
|
||||
gp_XY& theMinPoint,
|
||||
gp_XY& theMaxPoint)
|
||||
{
|
||||
theMinPoint.SetX(thePoint.X() - myTolerance[0]);
|
||||
theMinPoint.SetY(thePoint.Y() - myTolerance[1]);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
BRepMesh_BaseMeshAlgo.cxx
|
||||
BRepMesh_BaseMeshAlgo.hxx
|
||||
BRepMesh_ConstrainedBaseMeshAlgo.hxx
|
||||
BRepMesh_ConstrainedBaseMeshAlgo.cxx
|
||||
BRepMesh_BoundaryParamsRangeSplitter.hxx
|
||||
BRepMesh_Circle.hxx
|
||||
BRepMesh_CircleInspector.hxx
|
||||
@@ -85,4 +86,11 @@ BRepMesh_VertexInspector.hxx
|
||||
BRepMesh_VertexTool.cxx
|
||||
BRepMesh_VertexTool.hxx
|
||||
BRepMesh_CustomBaseMeshAlgo.hxx
|
||||
BRepMesh_CustomBaseMeshAlgo.cxx
|
||||
BRepMesh_CustomDelaunayBaseMeshAlgo.hxx
|
||||
delabella.pxx
|
||||
delabella.cpp
|
||||
BRepMesh_DelabellaBaseMeshAlgo.hxx
|
||||
BRepMesh_DelabellaBaseMeshAlgo.cxx
|
||||
BRepMesh_DelabellaMeshAlgoFactory.hxx
|
||||
BRepMesh_DelabellaMeshAlgoFactory.cxx
|
||||
|
1047
src/BRepMesh/delabella.cpp
Normal file
1047
src/BRepMesh/delabella.cpp
Normal file
File diff suppressed because it is too large
Load Diff
90
src/BRepMesh/delabella.pxx
Normal file
90
src/BRepMesh/delabella.pxx
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
MIT License
|
||||
|
||||
DELABELLA - Delaunay triangulation library
|
||||
Copyright (C) 2018 GUMIX - Marcin Sokalski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DELABELLA_H
|
||||
#define DELABELLA_H
|
||||
|
||||
// returns: positive value: number of triangle indices, negative: number of line segment indices (degenerated input)
|
||||
// triangle indices in abc array are always returned in clockwise order
|
||||
// DEPRECIATED. move to new API either extern "C" or IDelaBella (C++)
|
||||
int DelaBella(int points, const double* xy/*[points][2]*/, int* abc/*[2*points-5][3]*/, int (*errlog)(const char* fmt,...) = printf);
|
||||
|
||||
struct DelaBella_Vertex
|
||||
{
|
||||
int i; // index of original point
|
||||
double x, y; // coordinates (input copy)
|
||||
DelaBella_Vertex* next; // next silhouette vertex
|
||||
};
|
||||
|
||||
struct DelaBella_Triangle
|
||||
{
|
||||
DelaBella_Vertex* v[3]; // 3 vertices spanning this triangle
|
||||
DelaBella_Triangle* f[3]; // 3 adjacent faces, f[i] is at the edge opposite to vertex v[i]
|
||||
DelaBella_Triangle* next; // next triangle (of delaunay set or hull set)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct IDelaBella
|
||||
{
|
||||
static IDelaBella* Create();
|
||||
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
virtual void SetErrLog(int(*proc)(void* stream, const char* fmt, ...), void* stream) = 0;
|
||||
|
||||
// return 0: no output
|
||||
// negative: all points are colinear, output hull vertices form colinear segment list, no triangles on output
|
||||
// positive: output hull vertices form counter-clockwise ordered segment contour, delaunay and hull triangles are available
|
||||
// if 'y' pointer is null, y coords are treated to be located immediately after every x
|
||||
// if advance_bytes is less than 2*sizeof coordinate type, it is treated as 2*sizeof coordinate type
|
||||
virtual int Triangulate(int points, const float* x, const float* y = 0, int advance_bytes = 0) = 0;
|
||||
virtual int Triangulate(int points, const double* x, const double* y = 0, int advance_bytes = 0) = 0;
|
||||
|
||||
// num of points passed to last call to Triangulate()
|
||||
virtual int GetNumInputPoints() const = 0;
|
||||
|
||||
// num of verts returned from last call to Triangulate()
|
||||
virtual int GetNumOutputVerts() const = 0;
|
||||
|
||||
virtual const DelaBella_Triangle* GetFirstDelaunayTriangle() const = 0; // valid only if Triangulate() > 0
|
||||
virtual const DelaBella_Triangle* GetFirstHullTriangle() const = 0; // valid only if Triangulate() > 0
|
||||
virtual const DelaBella_Vertex* GetFirstHullVertex() const = 0; // if Triangulate() < 0 it is list, otherwise closed contour!
|
||||
};
|
||||
#else
|
||||
void* DelaBella_Create();
|
||||
void DelaBella_Destroy(void* db);
|
||||
void DelaBella_SetErrLog(void* db, int(*proc)(void* stream, const char* fmt, ...), void* stream);
|
||||
int DelaBella_TriangulateFloat(void* db, int points, float* x, float* y = 0, int advance_bytes = 0);
|
||||
int DelaBella_TriangulateDouble(void* db, int points, double* x, double* y = 0, int advance_bytes = 0);
|
||||
int DelaBella_GetNumInputPoints(void* db);
|
||||
int DelaBella_GetNumOutputVerts(void* db);
|
||||
const DelaBella_Triangle* GetFirstDelaunayTriangle(void* db);
|
||||
const DelaBella_Triangle* GetFirstHullTriangle(void* db);
|
||||
const DelaBella_Vertex* GetFirstHullVertex(void* db);
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -18,6 +18,8 @@
|
||||
#include <BRepMesh_OrientedEdge.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Curve, IMeshData_Curve)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
//! Clears parameters list.
|
||||
Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Curve, IMeshData_Curve)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_Curve, IMeshData_Curve)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <BRepMesh_OrientedEdge.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Edge, IMeshData_Edge)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
|
||||
const Standard_Integer theIndex) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Edge, IMeshData_Edge)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_Edge, IMeshData_Edge)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <BRepMesh_OrientedEdge.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Face, IMeshData_Face)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
const TopoDS_Wire& theWire,
|
||||
const Standard_Integer theEdgeNb = 0) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Face, IMeshData_Face)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_Face, IMeshData_Face)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -35,18 +35,18 @@ public:
|
||||
Standard_EXPORT virtual ~BRepMeshData_Model ();
|
||||
|
||||
//! Returns maximum size of shape's bounding box.
|
||||
Standard_EXPORT virtual Standard_Real GetMaxSize () const Standard_OVERRIDE
|
||||
virtual Standard_Real GetMaxSize () const Standard_OVERRIDE
|
||||
{
|
||||
return myMaxSize;
|
||||
}
|
||||
|
||||
//! Sets maximum size of shape's bounding box.
|
||||
inline void SetMaxSize (const Standard_Real theValue)
|
||||
void SetMaxSize (const Standard_Real theValue)
|
||||
{
|
||||
myMaxSize = theValue;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Model, IMeshData_Model)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_Model, IMeshData_Model)
|
||||
|
||||
public: //! @name discrete faces
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_PCurve, IMeshData_PCurve)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
//! Clears parameters list.
|
||||
Standard_EXPORT virtual void Clear(const Standard_Boolean isKeepEndPoints) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_PCurve, IMeshData_PCurve)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_PCurve, IMeshData_PCurve)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#include <BRepMesh_OrientedEdge.hxx>
|
||||
#include <BRepMesh_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMeshData_Wire, IMeshData_Wire)
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
Standard_EXPORT virtual TopAbs_Orientation GetEdgeOrientation (
|
||||
const Standard_Integer theIndex) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMeshData_Wire, IMeshData_Wire)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMeshData_Wire, IMeshData_Wire)
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -1,13 +1,22 @@
|
||||
IMeshData_Curve.hxx
|
||||
IMeshData_Curve.cxx
|
||||
IMeshData_Edge.hxx
|
||||
IMeshData_Edge.cxx
|
||||
IMeshData_Face.hxx
|
||||
IMeshData_Face.cxx
|
||||
IMeshData_Model.hxx
|
||||
IMeshData_Model.cxx
|
||||
IMeshData_ParametersList.hxx
|
||||
IMeshData_ParametersList.cxx
|
||||
IMeshData_ParametersListArrayAdaptor.hxx
|
||||
IMeshData_PCurve.hxx
|
||||
IMeshData_PCurve.cxx
|
||||
IMeshData_Shape.hxx
|
||||
IMeshData_Shape.cxx
|
||||
IMeshData_Status.hxx
|
||||
IMeshData_StatusOwner.hxx
|
||||
IMeshData_TessellatedShape.hxx
|
||||
IMeshData_TessellatedShape.cxx
|
||||
IMeshData_Types.hxx
|
||||
IMeshData_Wire.hxx
|
||||
IMeshData_Wire.cxx
|
||||
|
18
src/IMeshData/IMeshData_Curve.cxx
Normal file
18
src/IMeshData/IMeshData_Curve.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IMeshData_Curve.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Curve, IMeshData_ParametersList)
|
@@ -28,7 +28,7 @@ class IMeshData_Curve : public IMeshData_ParametersList
|
||||
public:
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IMeshData_Curve()
|
||||
virtual ~IMeshData_Curve()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ public:
|
||||
//! Removes point with the given index.
|
||||
Standard_EXPORT virtual void RemovePoint (const Standard_Integer theIndex) = 0;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshData_Curve, IMeshData_ParametersList)
|
||||
DEFINE_STANDARD_RTTIEXT(IMeshData_Curve, IMeshData_ParametersList)
|
||||
|
||||
protected:
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT IMeshData_Curve()
|
||||
IMeshData_Curve()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
18
src/IMeshData/IMeshData_Edge.cxx
Normal file
18
src/IMeshData/IMeshData_Edge.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IMeshData_Edge.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
|
@@ -34,12 +34,12 @@ class IMeshData_Edge : public IMeshData_TessellatedShape, public IMeshData_Statu
|
||||
public:
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IMeshData_Edge()
|
||||
virtual ~IMeshData_Edge()
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns TopoDS_Edge attached to model.
|
||||
inline const TopoDS_Edge& GetEdge () const
|
||||
const TopoDS_Edge& GetEdge () const
|
||||
{
|
||||
return TopoDS::Edge (GetShape ());
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
const Standard_Integer theIndex) const = 0;
|
||||
|
||||
//! Clears curve and all pcurves assigned to the edge from discretization.
|
||||
inline void Clear(const Standard_Boolean isKeepEndPoints)
|
||||
void Clear(const Standard_Boolean isKeepEndPoints)
|
||||
{
|
||||
myCurve->Clear(isKeepEndPoints);
|
||||
for (Standard_Integer aPCurveIt = 0; aPCurveIt < PCurvesNb(); ++aPCurveIt)
|
||||
@@ -72,81 +72,81 @@ public:
|
||||
}
|
||||
|
||||
//! Returns true in case if the edge is free one, i.e. it does not have pcurves.
|
||||
inline Standard_Boolean IsFree () const
|
||||
Standard_Boolean IsFree () const
|
||||
{
|
||||
return (PCurvesNb () == 0);
|
||||
}
|
||||
|
||||
//! Sets 3d curve associated with current edge.
|
||||
inline void SetCurve (const IMeshData::ICurveHandle& theCurve)
|
||||
void SetCurve (const IMeshData::ICurveHandle& theCurve)
|
||||
{
|
||||
myCurve = theCurve;
|
||||
}
|
||||
|
||||
//! Returns 3d curve associated with current edge.
|
||||
inline const IMeshData::ICurveHandle& GetCurve () const
|
||||
const IMeshData::ICurveHandle& GetCurve () const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
|
||||
//! Gets value of angular deflection for the discrete model.
|
||||
inline Standard_Real GetAngularDeflection () const
|
||||
Standard_Real GetAngularDeflection () const
|
||||
{
|
||||
return myAngDeflection;
|
||||
}
|
||||
|
||||
//! Sets value of angular deflection for the discrete model.
|
||||
inline void SetAngularDeflection (const Standard_Real theValue)
|
||||
void SetAngularDeflection (const Standard_Real theValue)
|
||||
{
|
||||
myAngDeflection = theValue;
|
||||
}
|
||||
|
||||
//! Returns same param flag.
|
||||
//! By default equals to flag stored in topological shape.
|
||||
inline Standard_Boolean GetSameParam () const
|
||||
Standard_Boolean GetSameParam () const
|
||||
{
|
||||
return mySameParam;
|
||||
}
|
||||
|
||||
//! Updates same param flag.
|
||||
inline void SetSameParam (const Standard_Boolean theValue)
|
||||
void SetSameParam (const Standard_Boolean theValue)
|
||||
{
|
||||
mySameParam = theValue;
|
||||
}
|
||||
|
||||
//! Returns same range flag.
|
||||
//! By default equals to flag stored in topological shape.
|
||||
inline Standard_Boolean GetSameRange () const
|
||||
Standard_Boolean GetSameRange () const
|
||||
{
|
||||
return mySameRange;
|
||||
}
|
||||
|
||||
//! Updates same range flag.
|
||||
inline void SetSameRange (const Standard_Boolean theValue)
|
||||
void SetSameRange (const Standard_Boolean theValue)
|
||||
{
|
||||
mySameRange = theValue;
|
||||
}
|
||||
|
||||
//! Returns degenerative flag.
|
||||
//! By default equals to flag stored in topological shape.
|
||||
inline Standard_Boolean GetDegenerated () const
|
||||
Standard_Boolean GetDegenerated () const
|
||||
{
|
||||
return myDegenerated;
|
||||
}
|
||||
|
||||
//! Updates degenerative flag.
|
||||
inline void SetDegenerated (const Standard_Boolean theValue)
|
||||
void SetDegenerated (const Standard_Boolean theValue)
|
||||
{
|
||||
myDegenerated = theValue;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshData_Edge, IMeshData_TessellatedShape)
|
||||
DEFINE_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
|
||||
|
||||
protected:
|
||||
|
||||
//! Constructor.
|
||||
//! Initializes empty model.
|
||||
Standard_EXPORT IMeshData_Edge (const TopoDS_Edge& theEdge)
|
||||
IMeshData_Edge (const TopoDS_Edge& theEdge)
|
||||
: IMeshData_TessellatedShape(theEdge),
|
||||
mySameParam (BRep_Tool::SameParameter(theEdge)),
|
||||
mySameRange (BRep_Tool::SameRange (theEdge)),
|
||||
|
18
src/IMeshData/IMeshData_Face.cxx
Normal file
18
src/IMeshData/IMeshData_Face.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IMeshData_Face.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
|
@@ -36,7 +36,7 @@ class IMeshData_Face : public IMeshData_TessellatedShape, public IMeshData_Statu
|
||||
public:
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IMeshData_Face()
|
||||
virtual ~IMeshData_Face()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,32 +53,32 @@ public:
|
||||
const Standard_Integer theIndex) const = 0;
|
||||
|
||||
//! Returns face's surface.
|
||||
inline const Handle(BRepAdaptor_HSurface)& GetSurface() const
|
||||
const Handle(BRepAdaptor_HSurface)& GetSurface() const
|
||||
{
|
||||
return mySurface;
|
||||
}
|
||||
|
||||
//! Returns TopoDS_Face attached to model.
|
||||
inline const TopoDS_Face& GetFace () const
|
||||
const TopoDS_Face& GetFace () const
|
||||
{
|
||||
return TopoDS::Face (GetShape ());
|
||||
}
|
||||
|
||||
//! Returns whether the face discrete model is valid.
|
||||
inline Standard_Boolean IsValid () const
|
||||
Standard_Boolean IsValid () const
|
||||
{
|
||||
return (IsEqual(IMeshData_NoError) ||
|
||||
IsEqual(IMeshData_ReMesh) ||
|
||||
IsEqual(IMeshData_UnorientedWire));
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshData_Face, IMeshData_TessellatedShape)
|
||||
DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
|
||||
|
||||
protected:
|
||||
|
||||
//! Constructor.
|
||||
//! Initializes empty model.
|
||||
Standard_EXPORT IMeshData_Face (const TopoDS_Face& theFace)
|
||||
IMeshData_Face (const TopoDS_Face& theFace)
|
||||
: IMeshData_TessellatedShape(theFace)
|
||||
{
|
||||
BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
|
||||
|
18
src/IMeshData/IMeshData_Model.cxx
Normal file
18
src/IMeshData/IMeshData_Model.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2020-09-28
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
// Created by: Maria KRYLOVA
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IMeshData_Model.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IMeshData_Model, IMeshData_Shape)
|
@@ -32,14 +32,14 @@ class IMeshData_Model : public IMeshData_Shape
|
||||
public:
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IMeshData_Model()
|
||||
virtual ~IMeshData_Model()
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns maximum size of shape model.
|
||||
Standard_EXPORT virtual Standard_Real GetMaxSize () const = 0;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshData_Model, IMeshData_Shape)
|
||||
DEFINE_STANDARD_RTTIEXT(IMeshData_Model, IMeshData_Shape)
|
||||
|
||||
public: //! @name discrete faces
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
|
||||
//! Constructor.
|
||||
//! Initializes empty model.
|
||||
Standard_EXPORT IMeshData_Model (const TopoDS_Shape& theShape)
|
||||
IMeshData_Model (const TopoDS_Shape& theShape)
|
||||
: IMeshData_Shape(theShape)
|
||||
{
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user