n BRepLib
n BRepMAT2d
n BRepMesh
+n BRepMeshData
n BRepOffset
n BRepOffsetAPI
n BRepPrim
n HLRAppli
n Hatch
n HatchGen
+n IMeshData
+n IMeshTools
n IntCurve
n IntCurveSurface
n IntCurvesFace
Handle(BRepMesh_DataStructureOfDelaun) aMeshStructure = new BRepMesh_DataStructureOfDelaun(anAllocator);
Standard_Integer aPtsLower = myPoints.Lower();
Standard_Integer aPtsUpper = myPoints.Upper();
- BRepMesh::Array1OfInteger anIndexes (0, myPoints.Length() - 1);
+ IMeshData::VectorOfInteger anIndexes (myPoints.Length(), anAllocator);
for (Standard_Integer aPtIdx = aPtsLower; aPtIdx <= aPtsUpper; ++aPtIdx)
{
gp_XY aP ((Standard_Real)myPoints.Value (aPtIdx).x(),
(Standard_Real)myPoints.Value (aPtIdx).y());
BRepMesh_Vertex aVertex (aP, aPtIdx, BRepMesh_Frontier);
- anIndexes.ChangeValue (aPtIdx - aPtsLower) = aMeshStructure->AddNode (aVertex);
+ anIndexes.Append (aMeshStructure->AddNode (aVertex));
}
Standard_Real aPtSum = 0;
}
BRepMesh_Delaun aTriangulation (aMeshStructure, anIndexes);
- const BRepMesh::MapOfInteger& aTriangles = aMeshStructure->ElementsOfDomain();
+ const IMeshData::MapOfInteger& aTriangles = aMeshStructure->ElementsOfDomain();
if (aTriangles.Extent() < 1)
return Standard_False;
}
Standard_Integer aVertexIndex = 1;
- BRepMesh::MapOfInteger::Iterator aTriangleIt (aTriangles);
+ IMeshData::IteratorOfMapOfInteger aTriangleIt (aTriangles);
for (; aTriangleIt.More(); aTriangleIt.Next())
{
const Standard_Integer aTriangleId = aTriangleIt.Key();
#ifndef BRepMesh_CircleInspector_Header
#define BRepMesh_CircleInspector_Header
-#include <BRepMesh.hxx>
+#include <IMeshData_Types.hxx>
#include <BRepMesh_Circle.hxx>
#include <Precision.hxx>
#include <gp_XY.hxx>
const Handle(NCollection_IncAllocator)& theAllocator)
: myTolerance(theTolerance*theTolerance),
myResIndices(theAllocator),
- myCircles(theReservedSize)
+ myCircles(theReservedSize, theAllocator)
{
}
}
//! Resutns vector of registered circles.
- inline const BRepMesh::VectorOfCircle& Circles() const
+ inline const IMeshData::VectorOfCircle& Circles() const
{
return myCircles;
}
}
//! Returns list of circles shot by the reference point.
- inline BRepMesh::ListOfInteger& GetShotCircles()
+ inline IMeshData::ListOfInteger& GetShotCircles()
{
return myResIndices;
}
//! Performs inspection of a circle with the given index.
//! @param theTargetIndex index of a circle to be checked.
//! @return status of the check.
- Standard_EXPORT NCollection_CellFilter_Action Inspect(
- const Standard_Integer theTargetIndex);
+ inline NCollection_CellFilter_Action Inspect(
+ const Standard_Integer theTargetIndex)
+ {
+ BRepMesh_Circle& aCircle = myCircles(theTargetIndex);
+ const Standard_Real& aRadius = aCircle.Radius();
+ if (aRadius < 0.)
+ return CellFilter_Purge;
+
+ gp_XY& aLoc = const_cast<gp_XY&>(aCircle.Location());
+
+ const Standard_Real aDX = myPoint.ChangeCoord(1) - aLoc.ChangeCoord(1);
+ const Standard_Real aDY = myPoint.ChangeCoord(2) - aLoc.ChangeCoord(2);
+ if ((aDX * aDX + aDY * aDY) - (aRadius * aRadius) <= myTolerance)
+ myResIndices.Append(theTargetIndex);
+
+ return CellFilter_Keep;
+ }
//! Checks indices for equlity.
static Standard_Boolean IsEqual(
}
private:
- Standard_Real myTolerance;
- BRepMesh::ListOfInteger myResIndices;
- BRepMesh::VectorOfCircle myCircles;
- gp_XY myPoint;
+ Standard_Real myTolerance;
+ IMeshData::ListOfInteger myResIndices;
+ IMeshData::VectorOfCircle myCircles;
+ gp_XY myPoint;
};
#endif
#include <BRepMesh_Circle.hxx>
#include <BRepMesh_CircleInspector.hxx>
-//=======================================================================
-//function : Inspect
-//purpose :
-//=======================================================================
-NCollection_CellFilter_Action BRepMesh_CircleInspector::Inspect(
- const Standard_Integer theTargetIndex)
-{
- const BRepMesh_Circle& aCircle = myCircles(theTargetIndex);
- Standard_Real aRadius = aCircle.Radius();
- if(aRadius < 0.)
- return CellFilter_Purge;
-
- const gp_XY& aLoc = aCircle.Location();
-
- if ((myPoint - aLoc).SquareModulus() - (aRadius * aRadius) <= myTolerance)
- myResIndices.Append(theTargetIndex);
-
- return CellFilter_Keep;
-}
-
-
//=======================================================================
//function : BRepMesh_CircleTool
//purpose :
static const Standard_Real aPrecision = Precision::PConfusion();
static const Standard_Real aSqPrecision = aPrecision * aPrecision;
- if ((thePoint1 - thePoint3).SquareModulus() < aSqPrecision)
- return Standard_False;
-
- gp_XY aLink1(thePoint2 - thePoint1);
+ gp_XY aLink1(const_cast<gp_XY&>(thePoint3).ChangeCoord(1) - const_cast<gp_XY&>(thePoint2).ChangeCoord(1),
+ const_cast<gp_XY&>(thePoint2).ChangeCoord(2) - const_cast<gp_XY&>(thePoint3).ChangeCoord(2));
if (aLink1.SquareModulus() < aSqPrecision)
return Standard_False;
- gp_XY aLink2(thePoint3 - thePoint2);
+ gp_XY aLink2(const_cast<gp_XY&>(thePoint1).ChangeCoord(1) - const_cast<gp_XY&>(thePoint3).ChangeCoord(1),
+ const_cast<gp_XY&>(thePoint3).ChangeCoord(2) - const_cast<gp_XY&>(thePoint1).ChangeCoord(2));
if (aLink2.SquareModulus() < aSqPrecision)
return Standard_False;
- gp_XY aMidPnt1 = (thePoint1 + thePoint2) / 2.;
- gp_XY aNorm1 = gp_XY(aLink1.Y(), -aLink1.X());
- aNorm1.Add(aMidPnt1);
-
- if (aLink2.SquareModulus() < aSqPrecision)
+ gp_XY aLink3(const_cast<gp_XY&>(thePoint2).ChangeCoord(1) - const_cast<gp_XY&>(thePoint1).ChangeCoord(1),
+ const_cast<gp_XY&>(thePoint1).ChangeCoord(2) - const_cast<gp_XY&>(thePoint2).ChangeCoord(2));
+ if (aLink3.SquareModulus() < aSqPrecision)
return Standard_False;
- gp_XY aMidPnt2 = (thePoint2 + thePoint3) / 2.;
- gp_XY aNorm2 = gp_XY(aLink2.Y(), -aLink2.X());
- aNorm2.Add(aMidPnt2);
+ const Standard_Real aD = 2 * (const_cast<gp_XY&>(thePoint1).ChangeCoord(1) * aLink1.Y() +
+ const_cast<gp_XY&>(thePoint2).ChangeCoord(1) * aLink2.Y() +
+ const_cast<gp_XY&>(thePoint3).ChangeCoord(1) * aLink3.Y());
- gp_XY aIntPnt;
- Standard_Real aParam[2];
- BRepMesh_GeomTool::IntFlag aIntFlag =
- BRepMesh_GeomTool::IntLinLin(aMidPnt1, aNorm1,
- aMidPnt2, aNorm2, aIntPnt, aParam);
-
- if (aIntFlag != BRepMesh_GeomTool::Cross)
+ if (Abs(aD) < gp::Resolution())
return Standard_False;
- theLocation = aIntPnt;
+ const Standard_Real aInvD = 1. / aD;
+ const Standard_Real aSqMod1 = thePoint1.SquareModulus();
+ const Standard_Real aSqMod2 = thePoint2.SquareModulus();
+ const Standard_Real aSqMod3 = thePoint3.SquareModulus();
+ theLocation.ChangeCoord(1) = (aSqMod1 * aLink1.Y() +
+ aSqMod2 * aLink2.Y() +
+ aSqMod3 * aLink3.Y()) * aInvD;
+
+ theLocation.ChangeCoord(2) = (aSqMod1 * aLink1.X() +
+ aSqMod2 * aLink2.X() +
+ aSqMod3 * aLink3.X()) * aInvD;
- theRadius = Sqrt(Max(Max((thePoint1 - aIntPnt).SquareModulus(),
- (thePoint2 - aIntPnt).SquareModulus()),
- (thePoint3 - aIntPnt).SquareModulus())) + 2 * RealEpsilon();
+ theRadius = Sqrt(Max(Max((thePoint1 - theLocation).SquareModulus(),
+ (thePoint2 - theLocation).SquareModulus()),
+ (thePoint3 - theLocation).SquareModulus())) + 2 * RealEpsilon();
return Standard_True;
}
//function : Select
//purpose :
//=======================================================================
-BRepMesh::ListOfInteger& BRepMesh_CircleTool::Select(const gp_XY& thePoint)
+IMeshData::ListOfInteger& BRepMesh_CircleTool::Select(const gp_XY& thePoint)
{
mySelector.SetPoint(thePoint);
myCellFilter.Inspect(thePoint, mySelector);
#include <gp_XYZ.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
-#include <BRepMesh.hxx>
+#include <IMeshData_Types.hxx>
#include <NCollection_Array1.hxx>
class gp_Circ2d;
//! Select the circles shot by the given point.
//! @param thePoint bullet point.
- Standard_EXPORT BRepMesh::ListOfInteger& Select(const gp_XY& thePoint);
+ Standard_EXPORT IMeshData::ListOfInteger& Select(const gp_XY& thePoint);
private:
Standard_Real myTolerance;
Handle(NCollection_IncAllocator) myAllocator;
- BRepMesh::CircleCellFilter myCellFilter;
+ IMeshData::CircleCellFilter myCellFilter;
BRepMesh_CircleInspector mySelector;
gp_XY myFaceMax;
gp_XY myFaceMin;
-// Created on: 1997-06-26
-// Created by: Laurent PAINNOT
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Created on: 2016-07-07
+// Copyright (c) 2016 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
{
}
+//=======================================================================
+//function : Destructor
+//purpose :
+//=======================================================================
+BRepMesh_Classifier::~BRepMesh_Classifier()
+{
+}
+
//=======================================================================
//function : Perform
//purpose :
Standard_Boolean isOut = Standard_False;
Standard_Integer aNb = myTabClass.Length();
- for (Standard_Integer i = 1; i <= aNb; i++)
+ for (Standard_Integer i = 0; i < aNb; i++)
{
- Standard_Integer aCur = ((CSLib_Class2d*)myTabClass(i))->SiDans(thePoint);
+ const Standard_Integer aCur = myTabClass(i)->SiDans(thePoint);
if (aCur == 0)
{
// Point is ON, but mark it as OUT
isOut = Standard_True;
}
else
+ {
isOut = myTabOrient(i) ? (aCur == -1) : (aCur == 1);
+ }
if (isOut)
+ {
return TopAbs_OUT;
+ }
}
return TopAbs_IN;
//purpose :
//=======================================================================
void BRepMesh_Classifier::RegisterWire(
- const NCollection_Sequence<gp_Pnt2d>& theWire,
- const Standard_Real theTolUV,
- const Standard_Real theUmin,
- const Standard_Real theUmax,
- const Standard_Real theVmin,
- const Standard_Real theVmax)
+ const NCollection_Sequence<const gp_Pnt2d*>& theWire,
+ const std::pair<Standard_Real, Standard_Real>& theTolUV,
+ const std::pair<Standard_Real, Standard_Real>& theRangeU,
+ const std::pair<Standard_Real, Standard_Real>& theRangeV)
{
const Standard_Integer aNbPnts = theWire.Length();
if (aNbPnts < 2)
+ {
return;
+ }
// Accumulate angle
TColgp_Array1OfPnt2d aPClass(1, aNbPnts);
Standard_Real anAngle = 0.0;
- gp_Pnt2d p1 = theWire(1), p2 = theWire(2), p3;
- aPClass(1) = p1;
- aPClass(2) = p2;
+ const gp_Pnt2d *p1 = theWire(1), *p2 = theWire(2), *p3;
+ aPClass(1) = *p1;
+ aPClass(2) = *p2;
const Standard_Real aAngTol = Precision::Angular();
const Standard_Real aSqConfusion =
Standard_Integer ii = i + 2;
if (ii > aNbPnts)
{
- p3 = aPClass(ii - aNbPnts);
+ p3 = &aPClass(ii - aNbPnts);
}
else
{
p3 = theWire.Value(ii);
- aPClass(ii) = p3;
+ aPClass(ii) = *p3;
}
- gp_Vec2d A(p1,p2), B(p2,p3);
+ const gp_Vec2d A(*p1,*p2), B(*p2,*p3);
if (A.SquareMagnitude() > aSqConfusion &&
B.SquareMagnitude() > aSqConfusion)
{
if (Abs(anAngle) < aAngTol)
anAngle = 0.0;
- myTabClass.Append( (void *)new CSLib_Class2d(aPClass,
- theTolUV, theTolUV, theUmin, theVmin, theUmax, theVmax) );
- myTabOrient.Append( !(anAngle < 0.0) );
-}
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-void BRepMesh_Classifier::Destroy()
-{
- Standard_Integer aNb = myTabClass.Length();
- for (Standard_Integer i = 1; i <= aNb; i++)
- {
- if (myTabClass(i))
- {
- delete ((CSLib_Class2d*)myTabClass(i));
- myTabClass(i) = NULL;
- }
- }
+ myTabClass.Append(std::shared_ptr<CSLib_Class2d>(new CSLib_Class2d(
+ aPClass, theTolUV.first, theTolUV.second,
+ theRangeU.first, theRangeV.first,
+ theRangeU.second, theRangeV.second)));
- myTabClass.Clear();
- myTabOrient.Clear();
+ myTabOrient.Append( !(anAngle < 0.0) );
}
-// Created on: 2014-06-03
+// Created on: 2016-07-07
+// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#define _BRepMesh_Classifier_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
-#include <BRepTopAdaptor_SeqOfPtr.hxx>
-#include <TColStd_SequenceOfBoolean.hxx>
#include <TopAbs_State.hxx>
-#include <NCollection_Sequence.hxx>
-#include <gp_Pnt2d.hxx>
+#include <IMeshData_Types.hxx>
-//! Auxilary class contains information about correctness of discretized
-//! face and used for classification of points regarding face internals.
-class BRepMesh_Classifier
+#include <memory>
+
+class gp_Pnt2d;
+class CSLib_Class2d;
+
+//! Auxilary class intended for classification of points
+//! regarding internals of discrete face.
+class BRepMesh_Classifier : public Standard_Transient
{
public:
- DEFINE_STANDARD_ALLOC
-
//! Constructor.
Standard_EXPORT BRepMesh_Classifier();
//! Destructor.
- Standard_EXPORT virtual ~BRepMesh_Classifier()
- {
- Destroy();
- }
-
- //! Method is called on destruction.
- //! Clears internal data structures.
- Standard_EXPORT void Destroy();
+ Standard_EXPORT virtual ~BRepMesh_Classifier();
//! Performs classification of the given point regarding to face internals.
//! @param thePoint Point in parametric space to be classified.
- //! @return
+ //! @return TopAbs_IN if point lies within face boundaries and TopAbs_OUT elsewhere.
Standard_EXPORT TopAbs_State Perform(const gp_Pnt2d& thePoint) const;
//! Registers wire specified by sequence of points for
//! @param theVmin Lower V boundary of the face in parametric space.
//! @param theVmax Upper V boundary of the face in parametric space.
Standard_EXPORT void RegisterWire(
- const NCollection_Sequence<gp_Pnt2d>& theWire,
- const Standard_Real theTolUV,
- const Standard_Real theUmin,
- const Standard_Real theUmax,
- const Standard_Real theVmin,
- const Standard_Real theVmax);
+ const NCollection_Sequence<const gp_Pnt2d*>& theWire,
+ const std::pair<Standard_Real, Standard_Real>& theTolUV,
+ const std::pair<Standard_Real, Standard_Real>& theRangeU,
+ const std::pair<Standard_Real, Standard_Real>& theRangeV);
+
+ DEFINE_STANDARD_RTTI_INLINE (BRepMesh_Classifier, Standard_Transient)
private:
- BRepTopAdaptor_SeqOfPtr myTabClass;
- TColStd_SequenceOfBoolean myTabOrient;
+ NCollection_Vector<std::shared_ptr<CSLib_Class2d> > myTabClass;
+ IMeshData::VectorOfBoolean myTabOrient;
};
#endif
// commercial license or contractual agreement.
#include <BRepMesh_DataStructureOfDelaun.hxx>
-#include <BRepMesh_PairOfIndex.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepMesh_Edge.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <Standard_ErrorHandler.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun,Standard_Transient)
-
//=======================================================================
//function : BRepMesh_DataStructureOfDelaun
//purpose :
myNodeLinks (theReservedNodeSize * 3, myAllocator),
myLinks (theReservedNodeSize * 3, myAllocator),
myDelLinks (myAllocator),
- myElements (theReservedNodeSize * 2, myAllocator),
- myElementsOfDomain(theReservedNodeSize * 2, myAllocator),
- myLinksOfDomain (theReservedNodeSize * 2, myAllocator)
+ myElements (theReservedNodeSize * 2, myAllocator)
{
}
{
const Standard_Integer aNodeId = myNodes->Add(theNode, isForceAdd);
if (!myNodeLinks.IsBound(aNodeId))
- myNodeLinks.Bind(aNodeId, BRepMesh::ListOfInteger(myAllocator));
+ myNodeLinks.Bind(aNodeId, IMeshData::ListOfInteger(myAllocator));
return aNodeId;
}
const Standard_Integer aNodeId = (i == 0) ?
theLink.FirstNode() : theLink.LastNode();
- BRepMesh::ListOfInteger& aLinkList = linksConnectedTo(aNodeId);
- BRepMesh::ListOfInteger::Iterator aLinkIt(aLinkList);
+ IMeshData::ListOfInteger& aLinkList = linksConnectedTo(aNodeId);
+ IMeshData::ListOfInteger::Iterator aLinkIt(aLinkList);
for(; aLinkIt.More(); aLinkIt.Next())
{
if (aLinkIt.Value() == theIndex)
Standard_Integer BRepMesh_DataStructureOfDelaun::AddElement(
const BRepMesh_Triangle& theElement)
{
- Standard_Integer aElementIndex = IndexOf(theElement);
- if (aElementIndex > 0)
- return aElementIndex;
-
- aElementIndex = myElements.Add(theElement);
+ myElements.Append(theElement);
+ Standard_Integer aElementIndex = myElements.Size();
myElementsOfDomain.Add(aElementIndex);
- Standard_Integer e[3];
- Standard_Boolean o[3];
- theElement.Edges(e, o);
+ const Standard_Integer (&e)[3] = theElement.myEdges;
for (Standard_Integer i = 0; i < 3; ++i)
myLinks(e[i]).Append(aElementIndex);
if (theElement.Movability() != BRepMesh_Free)
return;
- Standard_Integer e[3];
- Standard_Boolean o[3];
- theElement.Edges(e, o);
-
+ const Standard_Integer(&e)[3] = theElement.myEdges;
for (Standard_Integer i = 0; i < 3; ++i)
removeElementIndex(theIndex, myLinks(e[i]));
}
const BRepMesh_Triangle& aElement = GetElement(theIndex);
if (aElement.Movability() == BRepMesh_Deleted)
{
- myElements.Substitute(theIndex, theNewElement);
+ myElements(theIndex) = theNewElement;
return Standard_True;
}
- if (IndexOf(theNewElement) != 0)
- return Standard_False;
-
cleanElement(theIndex, aElement);
// Warning: here new element and old element should have different Hash code
- myElements.Substitute(theIndex, theNewElement);
+ myElements(theIndex) = theNewElement;
- Standard_Integer e[3];
- Standard_Boolean o[3];
- theNewElement.Edges(e, o);
+ const Standard_Integer(&e)[3] = theNewElement.myEdges;
for (Standard_Integer i = 0; i < 3; ++i)
myLinks(e[i]).Append(theIndex);
const BRepMesh_Triangle& theElement,
Standard_Integer (&theNodes)[3])
{
- Standard_Integer e[3];
- Standard_Boolean o[3];
- theElement.Edges(e, o);
+ const Standard_Integer(&e)[3] = theElement.myEdges;
+ const Standard_Boolean(&o)[3] = theElement.myOrientations;
const BRepMesh_Edge& aLink1 = GetLink(e[0]);
if (o[0])
//=======================================================================
void BRepMesh_DataStructureOfDelaun::ClearDomain()
{
- BRepMesh::MapOfInteger aFreeEdges;
- BRepMesh::MapOfInteger::Iterator aElementIt(myElementsOfDomain);
+ IMeshData::MapOfInteger aFreeEdges;
+ IMeshData::IteratorOfMapOfInteger aElementIt(myElementsOfDomain);
for (; aElementIt.More(); aElementIt.Next())
{
const Standard_Integer aElementId = aElementIt.Key();
BRepMesh_Triangle& aElement = (BRepMesh_Triangle&)GetElement(aElementId);
- Standard_Integer e[3];
- Standard_Boolean o[3];
- aElement.Edges(e, o);
+ const Standard_Integer(&e)[3] = aElement.myEdges;
for (Standard_Integer i = 0; i < 3; ++i)
aFreeEdges.Add(e[i]);
}
myElementsOfDomain.Clear();
- BRepMesh::MapOfInteger::Iterator aEdgeIt(aFreeEdges);
+ IMeshData::IteratorOfMapOfInteger aEdgeIt(aFreeEdges);
for (; aEdgeIt.More(); aEdgeIt.Next())
RemoveLink(aEdgeIt.Key());
}
--aLastLiveItem;
const Standard_Integer aLastLiveItemId = aLastLiveItem + 1;
- BRepMesh::ListOfInteger::Iterator aLinkIt;
+ IMeshData::ListOfInteger::Iterator aLinkIt;
// update link references
for (Standard_Integer i = 0; i < 2; ++i)
{
// update elements references
for(Standard_Integer j = 1, jn = aPair.Extent(); j <= jn; ++j)
{
- const BRepMesh_Triangle& aElement = GetElement(aPair.Index(j));
-
Standard_Integer e[3];
Standard_Boolean o[3];
+ const BRepMesh_Triangle& aElement = GetElement(aPair.Index(j));
aElement.Edges(e, o);
for (Standard_Integer i = 0; i < 3; ++i)
{
}
}
- myElements.Substitute(aLinkIt.Value(),
- BRepMesh_Triangle(e, o, aElement.Movability()));
+ myElements(aLinkIt.Value()) = BRepMesh_Triangle(e, o, aElement.Movability());
}
}
}
//=======================================================================
void BRepMesh_DataStructureOfDelaun::clearDeletedNodes()
{
- BRepMesh::ListOfInteger& aDelNodes =
- (BRepMesh::ListOfInteger&)myNodes->GetListOfDelNodes();
+ IMeshData::ListOfInteger& aDelNodes =
+ (IMeshData::ListOfInteger&)myNodes->GetListOfDelNodes();
Standard_Integer aLastLiveItem = NbNodes();
while (!aDelNodes.IsEmpty())
continue;
BRepMesh_Vertex aNode = GetNode(aLastLiveItem);
- BRepMesh::ListOfInteger& aLinkList = linksConnectedTo(aLastLiveItem);
+ IMeshData::ListOfInteger& aLinkList = linksConnectedTo(aLastLiveItem);
myNodes->RemoveLast();
--aLastLiveItem;
myNodeLinks.ChangeFind(aDelItem) = aLinkList;
const Standard_Integer aLastLiveItemId = aLastLiveItem + 1;
- BRepMesh::ListOfInteger::Iterator aLinkIt(aLinkList);
+ IMeshData::ListOfInteger::Iterator aLinkIt(aLinkList);
for (; aLinkIt.More(); aLinkIt.Next())
{
const Standard_Integer aLinkId = aLinkIt.Value();
theStream << "\n Deleted links : " << myDelLinks.Extent() << endl;
theStream << "\n\n Map of elements : \n";
- myElements.Statistics(theStream);
+ theStream << "\n Elements : " << myElements.Size() << endl;
}
//=======================================================================
return "Error: file name or mesh data is null";
}
- Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
+ Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
*(Handle(BRepMesh_DataStructureOfDelaun)*)theMeshHandlePtr;
if (aMeshData.IsNull())
}
else
{
- BRepMesh::MapOfInteger::Iterator aLinksIt(aMeshData->LinksOfDomain());
+ IMeshData::IteratorOfMapOfInteger aLinksIt(aMeshData->LinksOfDomain());
for (; aLinksIt.More(); aLinksIt.Next())
{
- const BRepMesh_Edge& aLink = aMeshData->GetLink(aLinksIt.Value());
+ const BRepMesh_Edge& aLink = aMeshData->GetLink(aLinksIt.Key());
gp_Pnt aPnt[2];
for (Standard_Integer i = 0; i < 2; ++i)
{
return theFileNameStr;
}
+
+void BRepMesh_DataStructureOfDelaun::Dump(Standard_CString theFileNameStr)
+{
+ Handle(BRepMesh_DataStructureOfDelaun) aMeshData (this);
+ BRepMesh_Dump((void*)&aMeshData, theFileNameStr);
+}
#ifndef _BRepMesh_DataStructureOfDelaun_HeaderFile
#define _BRepMesh_DataStructureOfDelaun_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-#include <BRepMesh_VertexTool.hxx>
#include <Standard_Transient.hxx>
#include <BRepMesh_Triangle.hxx>
#include <BRepMesh_PairOfIndex.hxx>
#include <Standard_OStream.hxx>
-#include <BRepMesh.hxx>
+#include <IMeshData_Types.hxx>
+#include <BRepMesh_VertexTool.hxx>
class BRepMesh_Vertex;
-class BRepMesh_VertexTool;
class BRepMesh_Edge;
//! Describes the data structure necessary for the mesh algorithms in
//! 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 BRepMesh::ListOfInteger& LinksConnectedTo(
+ inline const IMeshData::ListOfInteger& LinksConnectedTo(
const Standard_Integer theIndex) const
{
return linksConnectedTo(theIndex);
}
//! Returns map of indices of links registered in mesh.
- inline const BRepMesh::MapOfInteger& LinksOfDomain() const
+ inline const IMeshData::MapOfInteger& LinksOfDomain() const
{
return myLinksOfDomain;
}
//! Returns number of links.
inline Standard_Integer NbElements() const
{
- return myElements.Extent();
+ return myElements.Size();
}
//! Adds element to the mesh if it is not already in the mesh.
//! @return index of the element in the structure.
Standard_EXPORT Standard_Integer AddElement(const BRepMesh_Triangle& theElement);
- //! Finds the index of the given element.
- //! @param theElement element to find.
- //! @return index of the given element of zero if element is not in the mesh.
- Standard_Integer IndexOf(const BRepMesh_Triangle& theElement) const
- {
- return myElements.FindIndex(theElement);
- }
-
//! Get element by the index.
//! @param theIndex index of an element.
//! @return element with the given index.
const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
{
- return myElements.FindKey(theIndex);
+ return myElements.ChangeValue(theIndex - 1);
}
//! Returns map of indices of elements registered in mesh.
- inline const BRepMesh::MapOfInteger& ElementsOfDomain() const
+ inline const IMeshData::MapOfInteger& ElementsOfDomain() const
{
return myElementsOfDomain;
}
const BRepMesh_Triangle& theElement,
Standard_Integer (&theNodes)[3]);
+ Standard_EXPORT void Dump(Standard_CString theFileNameStr);
+
public: //! @name Auxilary API
}
//! Gives the data structure for initialization of cell size and tolerance.
- inline BRepMesh::HVertexTool& Data()
+ inline const Handle(BRepMesh_VertexTool)& Data()
{
return myNodes;
}
clearDeletedNodes();
}
- DEFINE_STANDARD_RTTIEXT(BRepMesh_DataStructureOfDelaun,Standard_Transient)
+ DEFINE_STANDARD_RTTI_INLINE(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 BRepMesh::ListOfInteger& linksConnectedTo(
+ inline IMeshData::ListOfInteger& linksConnectedTo(
const Standard_Integer theIndex) const
{
- return (BRepMesh::ListOfInteger&)myNodeLinks.Find(theIndex);
+ return (IMeshData::ListOfInteger&)myNodeLinks.Find(theIndex);
}
//! Substitutes deleted links by the last one from corresponding map
private:
Handle(NCollection_IncAllocator) myAllocator;
- BRepMesh::HVertexTool myNodes;
- BRepMesh::DMapOfIntegerListOfInteger myNodeLinks;
- BRepMesh::IDMapOfLink myLinks;
- BRepMesh::ListOfInteger myDelLinks;
- BRepMesh::IMapOfElement myElements;
- BRepMesh::MapOfInteger myElementsOfDomain;
- BRepMesh::MapOfInteger myLinksOfDomain;
+ Handle(BRepMesh_VertexTool) myNodes;
+ IMeshData::DMapOfIntegerListOfInteger myNodeLinks;
+ IMeshData::IDMapOfLink myLinks;
+ IMeshData::ListOfInteger myDelLinks;
+ IMeshData::VectorOfElements myElements;
+ IMeshData::MapOfInteger myElementsOfDomain;
+ IMeshData::MapOfInteger myLinksOfDomain;
};
-DEFINE_STANDARD_HANDLE(BRepMesh_DataStructureOfDelaun,Standard_Transient)
-
#endif
//function : BRepMesh_Delaun
//purpose : Creates the triangulation with an empty Mesh data structure
//=======================================================================
-BRepMesh_Delaun::BRepMesh_Delaun(BRepMesh::Array1OfVertexOfDelaun& theVertices)
+BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
: myCircles (theVertices.Length(), new NCollection_IncAllocator(
- BRepMesh::MEMORY_BLOCK_SIZE_HUGE))
+ IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
if ( theVertices.Length() > 2 )
{
myMeshData = new BRepMesh_DataStructureOfDelaun(
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE),
+ new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE),
theVertices.Length() );
Init( theVertices );
}
//purpose : Creates the triangulation with and existent Mesh data structure
//=======================================================================
BRepMesh_Delaun::BRepMesh_Delaun(
- const Handle( BRepMesh_DataStructureOfDelaun )& theOldMesh,
- BRepMesh::Array1OfVertexOfDelaun& theVertices)
+ const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
+ IMeshData::Array1OfVertexOfDelaun& theVertices)
: myMeshData( theOldMesh ),
myCircles ( theVertices.Length(), theOldMesh->Allocator() )
{
//purpose : Creates the triangulation with and existent Mesh data structure
//=======================================================================
BRepMesh_Delaun::BRepMesh_Delaun(
- const Handle( BRepMesh_DataStructureOfDelaun )& theOldMesh,
- BRepMesh::Array1OfInteger& theVertexIndices)
+ const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
+ IMeshData::VectorOfInteger& theVertexIndices)
: myMeshData( theOldMesh ),
myCircles ( theVertexIndices.Length(), theOldMesh->Allocator() )
{
//function : Init
//purpose : Initializes the triangulation with an Array of Vertex
//=======================================================================
-void BRepMesh_Delaun::Init(BRepMesh::Array1OfVertexOfDelaun& theVertices)
+void BRepMesh_Delaun::Init(IMeshData::Array1OfVertexOfDelaun& theVertices)
{
Bnd_Box2d aBox;
Standard_Integer aLowerIdx = theVertices.Lower();
Standard_Integer anUpperIdx = theVertices.Upper();
- BRepMesh::Array1OfInteger aVertexIndexes( aLowerIdx, anUpperIdx );
+ IMeshData::VectorOfInteger aVertexIndexes(theVertices.Size());
Standard_Integer anIndex = aLowerIdx;
for ( ; anIndex <= anUpperIdx; ++anIndex )
{
aBox.Add( gp_Pnt2d( theVertices( anIndex ).Coord() ) );
- aVertexIndexes( anIndex ) = myMeshData->AddNode( theVertices( anIndex ) );
+ aVertexIndexes.Append(myMeshData->AddNode( theVertices( anIndex ) ));
}
perform( aBox, aVertexIndexes );
//function : perform
//purpose : Create super mesh and run triangulation procedure
//=======================================================================
-void BRepMesh_Delaun::perform(Bnd_Box2d& theBndBox,
- BRepMesh::Array1OfInteger& theVertexIndexes)
+void BRepMesh_Delaun::perform(Bnd_Box2d& theBndBox,
+ IMeshData::VectorOfInteger& theVertexIndexes)
{
theBndBox.Enlarge( Precision );
superMesh( theBndBox );
// edges into the map.
// When an edge is suppressed more than one time it is destroyed.
//=======================================================================
-void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
- BRepMesh::MapOfIntegerInteger& theLoopEdges )
+void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
+ IMeshData::MapOfIntegerInteger& theLoopEdges )
{
myCircles.Delete( theIndex );
- Standard_Integer e[3];
- Standard_Boolean o[3];
- GetTriangle( theIndex ).Edges( e, o );
-
+ const BRepMesh_Triangle& aElement = GetTriangle(theIndex);
+ const Standard_Integer(&e)[3] = aElement.myEdges;
+ const Standard_Boolean(&o)[3] = aElement.myOrientations;
+
myMeshData->RemoveElement( theIndex );
for ( Standard_Integer i = 0; i < 3; ++i )
//purpose : Computes the triangulation and add the vertices edges and
// triangles to the Mesh data structure
//=======================================================================
-void BRepMesh_Delaun::compute(BRepMesh::Array1OfInteger& theVertexIndexes)
+void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
{
// Insertion of edges of super triangles in the list of free edges:
- BRepMesh::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
- Standard_Integer e[3];
- Standard_Boolean o[3];
- mySupTrian.Edges( e, o );
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, myMeshData->Allocator());
+ const Standard_Integer(&e)[3] = mySupTrian.myEdges;
aLoopEdges.Bind( e[0], Standard_True );
aLoopEdges.Bind( e[1], Standard_True );
aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
aLoopEdges.Clear();
- BRepMesh::MapOfInteger::Iterator aFreeTriangles( aSelector.Elements() );
+ IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
// All edges that remain free are removed from aLoopEdges;
// only the boundary edges of the triangulation remain there
- BRepMesh::MapOfIntegerInteger::Iterator aFreeEdges( aLoopEdges );
+ IMeshData::MapOfIntegerInteger::Iterator aFreeEdges( aLoopEdges );
for ( ; aFreeEdges.More(); aFreeEdges.Next() )
{
if ( myMeshData->ElementsConnectedTo( aFreeEdges.Key() ).IsEmpty() )
//function : createTriangles
//purpose : Creates the triangles beetween the node and the polyline.
//=======================================================================
-void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
- BRepMesh::MapOfIntegerInteger& thePoly)
+void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexIndex,
+ IMeshData::MapOfIntegerInteger& thePoly)
{
- BRepMesh::ListOfInteger aLoopEdges, anExternalEdges;
+ IMeshData::ListOfInteger aLoopEdges, anExternalEdges;
const gp_XY& aVertexCoord = myMeshData->GetNode( theVertexIndex ).Coord();
- BRepMesh::MapOfIntegerInteger::Iterator anEdges( thePoly );
+ IMeshData::MapOfIntegerInteger::Iterator anEdges( thePoly );
for ( ; anEdges.More(); anEdges.Next() )
{
Standard_Integer anEdgeId = anEdges.Key();
const BRepMesh_Edge& anEdge = GetEdge( anEdgeId );
- const Standard_Boolean isPositive = thePoly (anEdgeId) != 0;
+ Standard_Boolean isPositive = thePoly( anEdgeId ) != 0;
Standard_Integer aNodes[3];
if ( isPositive )
//purpose : Creation of triangles from the new nodes
//=======================================================================
void BRepMesh_Delaun::createTrianglesOnNewVertices(
- BRepMesh::Array1OfInteger& theVertexIndexes)
+ IMeshData::VectorOfInteger& theVertexIndexes)
{
Handle(NCollection_IncAllocator) aAllocator =
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
+ new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
Standard_Real aTolU, aTolV;
myMeshData->Data()->GetTolerance(aTolU, aTolV);
for( ; anIndex <= anUpper; ++anIndex )
{
aAllocator->Reset(Standard_False);
- BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
// Iterator in the list of indexes of circles containing the node
- BRepMesh::ListOfInteger& aCirclesList = myCircles.Select( aVertex.Coord() );
+ IMeshData::ListOfInteger& aCirclesList = myCircles.Select( aVertex.Coord() );
Standard_Integer onEgdeId = 0, aTriangleId = 0;
- BRepMesh::ListOfInteger::Iterator aCircleIt( aCirclesList );
+ IMeshData::ListOfInteger::Iterator aCircleIt( aCirclesList );
for ( ; aCircleIt.More(); aCircleIt.Next() )
{
// To add a node in the mesh it is necessary to check conditions:
while ( isModify && !aCirclesList.IsEmpty() )
{
isModify = Standard_False;
- BRepMesh::ListOfInteger::Iterator aCircleIt1( aCirclesList );
+ IMeshData::ListOfInteger::Iterator aCircleIt1( aCirclesList );
for ( ; aCircleIt1.More(); aCircleIt1.Next() )
{
- Standard_Integer e[3];
- Standard_Boolean o[3];
- GetTriangle( aCircleIt1.Value() ).Edges( e, o );
+ const BRepMesh_Triangle& aElement = GetTriangle(aCircleIt1.Value());
+ const Standard_Integer(&e)[3] = aElement.myEdges;
if ( aLoopEdges.IsBound( e[0] ) ||
aLoopEdges.IsBound( e[1] ) ||
//=======================================================================
void BRepMesh_Delaun::insertInternalEdges()
{
- BRepMesh::HMapOfInteger anInternalEdges = InternalEdges();
+ Handle(IMeshData::MapOfInteger) anInternalEdges = InternalEdges();;
// Destruction of triancles intersecting internal edges
// and their replacement by makeshift triangles
- Standard_Integer e[3];
- Standard_Boolean o[3];
- BRepMesh::MapOfInteger::Iterator anInernalEdgesIt( *anInternalEdges );
+ IMeshData::IteratorOfMapOfInteger anInernalEdgesIt( *anInternalEdges );
for ( ; anInernalEdgesIt.More(); anInernalEdgesIt.Next() )
{
const Standard_Integer aLinkIndex = anInernalEdgesIt.Key();
Standard_Boolean isGo[2] = { Standard_True, Standard_True };
for (Standard_Integer aTriangleIt = 1; aTriangleIt <= aPair.Extent(); ++aTriangleIt)
{
- GetTriangle(aPair.Index(aTriangleIt)).Edges(e, o);
+ const BRepMesh_Triangle& aElement = GetTriangle(aPair.Index(aTriangleIt));
+ const Standard_Integer(&e)[3] = aElement.myEdges;
+ const Standard_Boolean(&o)[3] = aElement.myOrientations;
+
for (Standard_Integer i = 0; i < 3; ++i)
{
if (e[i] == aLinkIndex)
if ( aTriId < 0 || aTriId == thePrevElementId )
continue;
- Standard_Integer anEdges[3];
- Standard_Boolean anEdgesOri[3];
- GetTriangle( aTriId ).Edges( anEdges, anEdgesOri );
+ const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
+ const Standard_Integer(&anEdges)[3] = aElement.myEdges;
for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
{
void BRepMesh_Delaun::cleanupMesh()
{
Handle(NCollection_IncAllocator) aAllocator =
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
+ new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
for(;;)
{
aAllocator->Reset(Standard_False);
- BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
- BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
+ IMeshData::MapOfInteger aDelTriangles;
- BRepMesh::HMapOfInteger aFreeEdges = FreeEdges();
- BRepMesh::MapOfInteger::Iterator aFreeEdgesIt( *aFreeEdges );
+ Handle(IMeshData::MapOfInteger) aFreeEdges = FreeEdges();
+ IMeshData::IteratorOfMapOfInteger aFreeEdgesIt( *aFreeEdges );
for ( ; aFreeEdgesIt.More(); aFreeEdgesIt.Next() )
{
const Standard_Integer& aFreeEdgeId = aFreeEdgesIt.Key();
Standard_Integer aTriId = aPair.FirstIndex();
// Check that the connected triangle is not surrounded by another triangles
- Standard_Integer anEdges[3];
- Standard_Boolean anEdgesOri[3];
- GetTriangle( aTriId ).Edges( anEdges, anEdgesOri );
+ const BRepMesh_Triangle& aElement = GetTriangle(aTriId);
+ const Standard_Integer(&anEdges)[3] = aElement.myEdges;
Standard_Boolean isCanNotBeRemoved = Standard_True;
for ( Standard_Integer aCurEdgeIdx = 0; aCurEdgeIdx < 3; ++aCurEdgeIdx )
// Destruction of triangles :
Standard_Integer aDeletedTrianglesNb = 0;
- BRepMesh::MapOfInteger::Iterator aDelTrianglesIt( aDelTriangles );
+ IMeshData::IteratorOfMapOfInteger aDelTrianglesIt( aDelTriangles );
for ( ; aDelTrianglesIt.More(); aDelTrianglesIt.Next() )
{
deleteTriangle( aDelTrianglesIt.Key(), aLoopEdges );
}
// Destruction of remaining hanging edges
- BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
+ IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
{
if ( myMeshData->ElementsConnectedTo( aLoopEdgesIt.Key() ).IsEmpty() )
//=======================================================================
void BRepMesh_Delaun::frontierAdjust()
{
- BRepMesh::HMapOfInteger aFrontier = Frontier();
+ Handle(IMeshData::MapOfInteger) aFrontier = Frontier();
Handle(NCollection_IncAllocator) aAllocator =
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
+ new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
- BRepMesh::VectorOfInteger aFailedFrontiers(256, aAllocator);
- BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
- BRepMesh::HMapOfInteger aIntFrontierEdges =
- new BRepMesh::MapOfInteger(10, aAllocator);
+ IMeshData::VectorOfInteger aFailedFrontiers(256, aAllocator);
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
+ Handle(IMeshData::MapOfInteger) aIntFrontierEdges = new IMeshData::MapOfInteger;
for ( Standard_Integer aPass = 1; aPass <= 2; ++aPass )
{
// 2 pass): find external triangles on boundary edges appeared
// during triangles replacement.
- BRepMesh::MapOfInteger::Iterator aFrontierIt( *aFrontier );
+ IMeshData::IteratorOfMapOfInteger aFrontierIt( *aFrontier );
for ( ; aFrontierIt.More(); aFrontierIt.Next() )
{
Standard_Integer aFrontierId = aFrontierIt.Key();
if( aPriorElemId < 0 )
continue;
- Standard_Integer e[3];
- Standard_Boolean o[3];
- GetTriangle( aPriorElemId ).Edges( e, o );
+ const BRepMesh_Triangle& aElement = GetTriangle(aPriorElemId);
+ const Standard_Integer(&e)[3] = aElement.myEdges;
+ const Standard_Boolean(&o)[3] = aElement.myOrientations;
Standard_Boolean isTriangleFound = Standard_False;
for ( Standard_Integer n = 0; n < 3; ++n )
}
// destrucrion of remaining hanging edges :
- BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
+ IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
{
Standard_Integer aLoopEdgeId = aLoopEdgesIt.Key();
// situation when frontier edge has a triangle at a right side, but its free
// links cross another frontieres and meshLeftPolygonOf itself can't collect
// a closed polygon.
- BRepMesh::VectorOfInteger::Iterator aFailedFrontiersIt( aFailedFrontiers );
+ IMeshData::VectorOfInteger::Iterator aFailedFrontiersIt( aFailedFrontiers );
for ( ; aFailedFrontiersIt.More(); aFailedFrontiersIt.Next() )
{
Standard_Integer aFrontierId = aFailedFrontiersIt.Value();
//purpose : Add boundig box for edge defined by start & end point to
// the given vector of bounding boxes for triangulation edges
//=======================================================================
-void BRepMesh_Delaun::fillBndBox(BRepMesh::SequenceOfBndB2d& theBoxes,
- const BRepMesh_Vertex& theV1,
- const BRepMesh_Vertex& theV2)
+void BRepMesh_Delaun::fillBndBox(IMeshData::SequenceOfBndB2d& theBoxes,
+ const BRepMesh_Vertex& theV1,
+ const BRepMesh_Vertex& theV2)
{
Bnd_B2d aBox;
UpdateBndBox(theV1.Coord(), theV2.Coord(), aBox);
//purpose : Collect the polygon at the left of the given edge (material side)
//=======================================================================
Standard_Boolean BRepMesh_Delaun::meshLeftPolygonOf(
- const Standard_Integer theStartEdgeId,
- const Standard_Boolean isForward,
- BRepMesh::HMapOfInteger theSkipped )
+ const Standard_Integer theStartEdgeId,
+ const Standard_Boolean isForward,
+ Handle(IMeshData::MapOfInteger) theSkipped)
{
if ( !theSkipped.IsNull() && theSkipped->Contains( theStartEdgeId ) )
return Standard_True;
const BRepMesh_Edge& aRefEdge = GetEdge( theStartEdgeId );
- BRepMesh::SequenceOfInteger aPolygon;
+ IMeshData::SequenceOfInteger aPolygon;
Standard_Integer aStartNode, aPivotNode;
if ( isForward )
{
// Auxilary structures.
// Bounding boxes of polygon links to be used for preliminary
// analysis of intersections
- BRepMesh::SequenceOfBndB2d aBoxes;
+ IMeshData::SequenceOfBndB2d aBoxes;
fillBndBox( aBoxes, aStartEdgeVertexS, aPivotVertex );
// Hanging ends
- BRepMesh::MapOfInteger aDeadLinks;
+ IMeshData::MapOfInteger aDeadLinks;
// Links are temporarily excluded from consideration
- BRepMesh::MapOfInteger aLeprousLinks;
+ IMeshData::MapOfInteger aLeprousLinks;
aLeprousLinks.Add( theStartEdgeId );
Standard_Boolean isSkipLeprous = Standard_True;
// consideration next time until a hanging end is occured.
//=======================================================================
Standard_Integer BRepMesh_Delaun::findNextPolygonLink(
- const Standard_Integer& theFirstNode,
- const Standard_Integer& thePivotNode,
- const BRepMesh_Vertex& thePivotVertex,
- const gp_Vec2d& theRefLinkDir,
- const BRepMesh::SequenceOfBndB2d& theBoxes,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::HMapOfInteger theSkipped,
- const Standard_Boolean& isSkipLeprous,
- BRepMesh::MapOfInteger& theLeprousLinks,
- BRepMesh::MapOfInteger& theDeadLinks,
- Standard_Integer& theNextPivotNode,
- gp_Vec2d& theNextLinkDir,
- Bnd_B2d& theNextLinkBndBox )
+ const Standard_Integer& theFirstNode,
+ const Standard_Integer& thePivotNode,
+ const BRepMesh_Vertex& thePivotVertex,
+ const gp_Vec2d& theRefLinkDir,
+ const IMeshData::SequenceOfBndB2d& theBoxes,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const Handle(IMeshData::MapOfInteger) theSkipped,
+ const Standard_Boolean& isSkipLeprous,
+ IMeshData::MapOfInteger& theLeprousLinks,
+ IMeshData::MapOfInteger& theDeadLinks,
+ Standard_Integer& theNextPivotNode,
+ gp_Vec2d& theNextLinkDir,
+ Bnd_B2d& theNextLinkBndBox )
{
// Find the next link having the greatest angle
// respect to a direction of a reference one
Standard_Real aMaxAngle = RealFirst();
Standard_Integer aNextLinkId = 0;
- BRepMesh::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( thePivotNode ) );
+ IMeshData::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( thePivotNode ) );
for ( ; aLinkIt.More(); aLinkIt.Next() )
{
const Standard_Integer& aNeighbourLinkInfo = aLinkIt.Value();
// <theLinkBndBox> parameter.
//=======================================================================
Standard_Boolean BRepMesh_Delaun::checkIntersection(
- const BRepMesh_Edge& theLink,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- const Standard_Boolean isConsiderEndPointTouch,
- const Standard_Boolean isConsiderPointOnEdge,
- const Standard_Boolean isSkipLastEdge,
- Bnd_B2d& theLinkBndBox ) const
+ const BRepMesh_Edge& theLink,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ const Standard_Boolean isConsiderEndPointTouch,
+ const Standard_Boolean isConsiderPointOnEdge,
+ const Standard_Boolean isSkipLastEdge,
+ Bnd_B2d& theLinkBndBox ) const
{
UpdateBndBox(GetVertex(theLink.FirstNode()).Coord(),
GetVertex(theLink.LastNode()).Coord(), theLinkBndBox);
continue;
gp_Pnt2d anIntPnt;
- BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( theLink, aPolyLink,
+ BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( theLink, aPolyLink,
isConsiderEndPointTouch, isConsiderPointOnEdge, anIntPnt );
if ( aIntFlag != BRepMesh_GeomTool::NoIntersection )
//function : addTriangle
//purpose : Add a triangle based on the given oriented edges into mesh
//=======================================================================
-void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
- const Standard_Boolean (&theEdgesOri)[3],
- const Standard_Integer (&theNodesId)[3])
+inline void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
+ const Standard_Boolean (&theEdgesOri)[3],
+ const Standard_Integer (&theNodesId)[3] )
{
- for (Standard_Integer i = 0; i < 3; ++i)
- {
- const BRepMesh_PairOfIndex& aPair = myMeshData->ElementsConnectedTo(theEdgesId[i]);
- if (aPair.Extent() == 2)
- // it is forbidden to have more than two triangles connected to the same link
- return;
- }
Standard_Integer aNewTriangleId =
myMeshData->AddElement(BRepMesh_Triangle(theEdgesId,
theEdgesOri, BRepMesh_Free));
//function : cleanupPolygon
//purpose : Remove internal triangles from the given polygon
//=======================================================================
-void BRepMesh_Delaun::cleanupPolygon(const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes )
+void BRepMesh_Delaun::cleanupPolygon(const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes )
{
Standard_Integer aPolyLen = thePolygon.Length();
if ( aPolyLen < 3 )
return;
Handle(NCollection_IncAllocator) aAllocator =
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
+ new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
- BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
- BRepMesh::MapOfInteger anIgnoredEdges(10, aAllocator);
- BRepMesh::MapOfInteger aPolyVerticesFindMap(10, aAllocator);
- BRepMesh::VectorOfInteger aPolyVertices(256, aAllocator);
+ IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
+ IMeshData::MapOfInteger anIgnoredEdges;
+ IMeshData::MapOfInteger aPolyVerticesFindMap;
+ IMeshData::VectorOfInteger aPolyVertices(256, aAllocator);
// Collect boundary vertices of the polygon
for ( Standard_Integer aPolyIt = 1; aPolyIt <= aPolyLen; ++aPolyIt )
{
if ( anElemId < 0 )
continue;
- Standard_Integer anEdges[3];
- Standard_Boolean anEdgesOri[3];
- GetTriangle( anElemId ).Edges(anEdges, anEdgesOri);
+ const BRepMesh_Triangle& aElement = GetTriangle(anElemId);
+ const Standard_Integer(&anEdges)[3] = aElement.myEdges;
+ const Standard_Boolean(&anEdgesOri)[3] = aElement.myOrientations;
Standard_Integer isTriangleFound = Standard_False;
for ( Standard_Integer anEdgeIt = 0; anEdgeIt < 3; ++anEdgeIt )
if ( aPolyVertices.First() != aPolyVertices.Last() )
aPolyVertices.Append( aPolyVertices.First() );
- BRepMesh::MapOfInteger aSurvivedLinks( anIgnoredEdges );
+ IMeshData::MapOfInteger aSurvivedLinks( anIgnoredEdges );
Standard_Integer aPolyVertIt = 0;
Standard_Integer anUniqueVerticesNum = aPolyVertices.Length() - 1;
thePolyBoxes, aSurvivedLinks, aLoopEdges );
}
- BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
+ IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
for ( ; aLoopEdgesIt.More(); aLoopEdgesIt.Next() )
{
const Standard_Integer& aLoopEdgeId = aLoopEdgesIt.Key();
// inside the polygon or crossed it.
//=======================================================================
void BRepMesh_Delaun::killTrianglesAroundVertex(
- const Standard_Integer theZombieNodeId,
- const BRepMesh::VectorOfInteger& thePolyVertices,
- const BRepMesh::MapOfInteger& thePolyVerticesFindMap,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::MapOfInteger& theSurvivedLinks,
- BRepMesh::MapOfIntegerInteger& theLoopEdges )
+ const Standard_Integer theZombieNodeId,
+ const IMeshData::VectorOfInteger& thePolyVertices,
+ const IMeshData::MapOfInteger& thePolyVerticesFindMap,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::MapOfInteger& theSurvivedLinks,
+ IMeshData::MapOfIntegerInteger& theLoopEdges )
{
- BRepMesh::ListOfInteger::Iterator aNeighborsIt =
+ IMeshData::ListOfInteger::Iterator aNeighborsIt =
myMeshData->LinksConnectedTo( theZombieNodeId );
// Try to infect neighbor nodes
- BRepMesh::VectorOfInteger aVictimNodes;
+ IMeshData::VectorOfInteger aVictimNodes;
for ( ; aNeighborsIt.More(); aNeighborsIt.Next() )
{
const Standard_Integer& aNeighborLinkId = aNeighborsIt.Value();
}
// Go and do your job!
- BRepMesh::VectorOfInteger::Iterator aVictimIt( aVictimNodes );
+ IMeshData::VectorOfInteger::Iterator aVictimIt( aVictimNodes );
for ( ; aVictimIt.More(); aVictimIt.Next() )
{
killTrianglesAroundVertex( aVictimIt.Value(), thePolyVertices,
//purpose : Checks is the given vertex lies inside the polygon
//=======================================================================
Standard_Boolean BRepMesh_Delaun::isVertexInsidePolygon(
- const Standard_Integer& theVertexId,
- const BRepMesh::VectorOfInteger& thePolygonVertices ) const
+ const Standard_Integer& theVertexId,
+ const IMeshData::VectorOfInteger& thePolygonVertices ) const
{
Standard_Integer aPolyLen = thePolygonVertices.Length();
if ( aPolyLen < 3 )
// boundary intersection. Does nothing elsewhere.
//=======================================================================
void BRepMesh_Delaun::killTrianglesOnIntersectingLinks(
- const Standard_Integer& theLinkToCheckId,
- const BRepMesh_Edge& theLinkToCheck,
- const Standard_Integer& theEndPoint,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::MapOfInteger& theSurvivedLinks,
- BRepMesh::MapOfIntegerInteger& theLoopEdges )
+ const Standard_Integer& theLinkToCheckId,
+ const BRepMesh_Edge& theLinkToCheck,
+ const Standard_Integer& theEndPoint,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::MapOfInteger& theSurvivedLinks,
+ IMeshData::MapOfIntegerInteger& theLoopEdges )
{
if ( theSurvivedLinks.Contains( theLinkToCheckId ) )
return;
killLinkTriangles( theLinkToCheckId, theLoopEdges );
- BRepMesh::ListOfInteger::Iterator aNeighborsIt(
+ IMeshData::ListOfInteger::Iterator aNeighborsIt(
myMeshData->LinksConnectedTo(theEndPoint));
for ( ; aNeighborsIt.More(); aNeighborsIt.Next() )
//purpose : Kill triangles bound to the given link.
//=======================================================================
void BRepMesh_Delaun::killLinkTriangles(
- const Standard_Integer& theLinkId,
- BRepMesh::MapOfIntegerInteger& theLoopEdges )
+ const Standard_Integer& theLinkId,
+ IMeshData::MapOfIntegerInteger& theLoopEdges )
{
const BRepMesh_PairOfIndex& aPair =
myMeshData->ElementsConnectedTo( theLinkId );
//purpose : Processes loop within the given polygon formed by range of
// its links specified by start and end link indices.
//=======================================================================
-void BRepMesh_Delaun::processLoop(const Standard_Integer theLinkFrom,
- const Standard_Integer theLinkTo,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes)
+void BRepMesh_Delaun::processLoop(const Standard_Integer theLinkFrom,
+ const Standard_Integer theLinkTo,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes)
{
Standard_Integer aNbOfLinksInLoop = theLinkTo - theLinkFrom - 1;
if ( aNbOfLinksInLoop < 3 )
return;
- BRepMesh::SequenceOfInteger aPolygon;
- BRepMesh::SequenceOfBndB2d aPolyBoxes;
+ IMeshData::SequenceOfInteger aPolygon;
+ IMeshData::SequenceOfBndB2d aPolyBoxes;
for ( ; aNbOfLinksInLoop > 0; --aNbOfLinksInLoop )
{
Standard_Integer aLoopLinkIndex = theLinkFrom + aNbOfLinksInLoop;
Standard_Integer BRepMesh_Delaun::createAndReplacePolygonLink(
const Standard_Integer *theNodes,
const gp_Pnt2d *thePnts,
- const Standard_Integer theRootIndex,
- const ReplaceFlag theReplaceFlag,
- BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes )
+ const Standard_Integer theRootIndex,
+ const ReplaceFlag theReplaceFlag,
+ IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes )
{
Standard_Integer aNewEdgeId =
myMeshData->AddLink( BRepMesh_Edge(
//function : meshPolygon
//purpose :
//=======================================================================
-void BRepMesh_Delaun::meshPolygon(BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::HMapOfInteger theSkipped )
+void BRepMesh_Delaun::meshPolygon(IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ Handle(IMeshData::MapOfInteger) theSkipped)
{
// Check is the source polygon elementary
if ( meshElementaryPolygon( thePolygon ) )
};
gp_Pnt2d anIntPnt;
- BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( *aCurEdge, *aNextEdge,
+ BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( *aCurEdge, *aNextEdge,
Standard_False, Standard_True, anIntPnt );
if ( aIntFlag == BRepMesh_GeomTool::NoIntersection )
}
}
- BRepMesh::SequenceOfInteger* aPolygon1 = &thePolygon;
- BRepMesh::SequenceOfBndB2d* aPolyBoxes1 = &thePolyBoxes;
+ IMeshData::SequenceOfInteger* aPolygon1 = &thePolygon;
+ IMeshData::SequenceOfBndB2d* aPolyBoxes1 = &thePolyBoxes;
- BRepMesh::HSequenceOfInteger aPolygon2 = new BRepMesh::SequenceOfInteger;
- BRepMesh::HSequenceOfBndB2d aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
+ Handle(IMeshData::SequenceOfInteger) aPolygon2 = new IMeshData::SequenceOfInteger;
+ Handle(IMeshData::SequenceOfBndB2d) aPolyBoxes2 = new IMeshData::SequenceOfBndB2d;
- NCollection_Sequence<BRepMesh::HSequenceOfInteger> aPolyStack;
- NCollection_Sequence<BRepMesh::HSequenceOfBndB2d> aPolyBoxStack;
+ NCollection_Sequence<Handle(IMeshData::SequenceOfInteger)> aPolyStack;
+ NCollection_Sequence<Handle(IMeshData::SequenceOfBndB2d)> aPolyBoxStack;
for (;;)
{
decomposeSimplePolygon(*aPolygon1, *aPolyBoxes1, *aPolygon2, *aPolyBoxes2);
aPolyStack.Append(aPolygon2);
aPolyBoxStack.Append(aPolyBoxes2);
- aPolygon2 = new BRepMesh::SequenceOfInteger;
- aPolyBoxes2 = new BRepMesh::SequenceOfBndB2d;
+ aPolygon2 = new IMeshData::SequenceOfInteger;
+ aPolyBoxes2 = new IMeshData::SequenceOfBndB2d;
}
if (aPolygon1->IsEmpty())
//purpose : Triangulation of closed polygon containing only three edges.
//=======================================================================
inline Standard_Boolean BRepMesh_Delaun::meshElementaryPolygon(
- const BRepMesh::SequenceOfInteger& thePolygon)
+ const IMeshData::SequenceOfInteger& thePolygon)
{
Standard_Integer aPolyLen = thePolygon.Length();
if ( aPolyLen < 3 )
//purpose :
//=======================================================================
void BRepMesh_Delaun::decomposeSimplePolygon(
- BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::SequenceOfInteger& thePolygonCut,
- BRepMesh::SequenceOfBndB2d& thePolyBoxesCut)
+ IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::SequenceOfInteger& thePolygonCut,
+ IMeshData::SequenceOfBndB2d& thePolyBoxesCut)
{
// Check is the given polygon elementary
if ( meshElementaryPolygon( thePolygon ) )
// intersection is possible...
gp_Pnt2d anIntPnt;
- BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( aCheckLink, aPolyLink,
+ BRepMesh_GeomTool::IntFlag aIntFlag = intSegSeg( aCheckLink, aPolyLink,
Standard_False, Standard_False, anIntPnt );
if( aIntFlag != BRepMesh_GeomTool::NoIntersection )
BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
aSelector.NeighboursOf( theVertex );
- BRepMesh::MapOfIntegerInteger aLoopEdges;//( 10, myMeshData->Allocator() );
+ IMeshData::MapOfIntegerInteger aLoopEdges;//( 10, myMeshData->Allocator() );
// Loop on triangles to be destroyed :
- BRepMesh::MapOfInteger::Iterator aTriangleIt( aSelector.Elements() );
+ IMeshData::IteratorOfMapOfInteger aTriangleIt( aSelector.Elements() );
for ( ; aTriangleIt.More(); aTriangleIt.Next() )
deleteTriangle( aTriangleIt.Key(), aLoopEdges );
- BRepMesh::SequenceOfBndB2d aBoxes;
- BRepMesh::SequenceOfInteger aPolygon;
+ IMeshData::SequenceOfBndB2d aBoxes;
+ IMeshData::SequenceOfInteger aPolygon;
Standard_Integer aLoopEdgesCount = aLoopEdges.Extent();
- BRepMesh::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
+ IMeshData::MapOfIntegerInteger::Iterator aLoopEdgesIt( aLoopEdges );
if ( aLoopEdgesIt.More() )
{
Standard_Integer aPivotNode = anEdge.LastNode();
Standard_Integer anEdgeId = aLoopEdgesIt.Key();
- Standard_Boolean isPositive = (aLoopEdges (anEdgeId) != 0);
+ Standard_Boolean isPositive = aLoopEdges( anEdgeId ) != 0;
if ( !isPositive )
{
Standard_Integer aTmp;
aLastNode = aFirstNode;
while ( aPivotNode != aLastNode )
{
- BRepMesh::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( aPivotNode ) );
+ IMeshData::ListOfInteger::Iterator aLinkIt( myMeshData->LinksConnectedTo( aPivotNode ) );
for ( ; aLinkIt.More(); aLinkIt.Next() )
{
if ( aLinkIt.Value() != anEdgeId &&
//function : AddVertices
//purpose : Adds some vertices in the triangulation.
//=======================================================================
-void BRepMesh_Delaun::AddVertices(BRepMesh::Array1OfVertexOfDelaun& theVertices)
+void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices)
{
- std::make_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
- std::sort_heap(theVertices.begin(), theVertices.end(), ComparatorOfVertexOfDelaun());
-
- Standard_Integer aLower = theVertices.Lower();
- Standard_Integer anUpper = theVertices.Upper();
-
- BRepMesh::Array1OfInteger aVertexIndexes( aLower, anUpper );
- for ( Standard_Integer i = aLower; i <= anUpper; ++i )
- aVertexIndexes(i) = myMeshData->AddNode( theVertices(i) );
+ ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
+ std::make_heap(theVertices.begin(), theVertices.end(), aCmp);
+ std::sort_heap(theVertices.begin(), theVertices.end(), aCmp);
- createTrianglesOnNewVertices( aVertexIndexes );
+ createTrianglesOnNewVertices(theVertices);
}
//=======================================================================
//function : getEdgesByType
//purpose : Gives the list of edges with type defined by input parameter
//=======================================================================
-BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
+Handle(IMeshData::MapOfInteger) BRepMesh_Delaun::getEdgesByType(
const BRepMesh_DegreeOfFreedom theEdgeType ) const
{
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
- BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
- BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
+ Handle(IMeshData::MapOfInteger) aResult = new IMeshData::MapOfInteger;
+ IMeshData::IteratorOfMapOfInteger anEdgeIt( myMeshData->LinksOfDomain() );
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
{
{
theEdgeOn = 0;
- Standard_Integer e[3];
- Standard_Boolean o[3];
Standard_Integer p[3];
const BRepMesh_Triangle& aElement = GetTriangle( theTriangleId );
- aElement.Edges(e, o);
+ const Standard_Integer(&e)[3] = aElement.myEdges;
const BRepMesh_Edge* anEdges[3] = { &GetEdge( e[0] ),
&GetEdge( e[1] ),
//function : intSegSeg
//purpose : Checks intersection between the two segments.
//=============================================================================
-BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
+BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
const BRepMesh_Edge& theEdg1,
const BRepMesh_Edge& theEdg2,
const Standard_Boolean isConsiderEndPointTouch,
//purpose : Returns area of the loop of the given polygon defined by indices
// of its start and end links.
//=============================================================================
-Standard_Real BRepMesh_Delaun::polyArea(const BRepMesh::SequenceOfInteger& thePolygon,
- const Standard_Integer theStartIndex,
- const Standard_Integer theEndIndex) const
+Standard_Real BRepMesh_Delaun::polyArea(const IMeshData::SequenceOfInteger& thePolygon,
+ const Standard_Integer theStartIndex,
+ const Standard_Integer theEndIndex) const
{
Standard_Real aArea = 0.0;
Standard_Integer aPolyLen = thePolygon.Length();
return "Error: file name or polygon data is null";
}
- BRepMesh::SequenceOfInteger& aPolygon = *(BRepMesh::SequenceOfInteger*)thePolygon;
+ IMeshData::SequenceOfInteger& aPolygon = *(IMeshData::SequenceOfInteger*)thePolygon;
- Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
+ Handle(BRepMesh_DataStructureOfDelaun) aMeshData =
*(Handle(BRepMesh_DataStructureOfDelaun)*)theMeshHandlePtr;
if (aMeshData.IsNull())
{
OCC_CATCH_SIGNALS
- BRepMesh::SequenceOfInteger::Iterator aLinksIt(aPolygon);
+ IMeshData::SequenceOfInteger::Iterator aLinksIt(aPolygon);
for (; aLinksIt.More(); aLinksIt.Next())
{
const BRepMesh_Edge& aLink = aMeshData->GetLink(Abs(aLinksIt.Value()));
#include <BRepMesh_CircleTool.hxx>
#include <BRepMesh_Triangle.hxx>
#include <BRepMesh_Edge.hxx>
-#include <BRepMesh.hxx>
+#include <IMeshData_Types.hxx>
#include <BRepMesh_DataStructureOfDelaun.hxx>
#include <BRepMesh_GeomTool.hxx>
#include <TColStd_Array1OfInteger.hxx>
DEFINE_STANDARD_ALLOC
//! Creates the triangulation with an empty Mesh data structure.
- Standard_EXPORT BRepMesh_Delaun (BRepMesh::Array1OfVertexOfDelaun& theVertices);
+ Standard_EXPORT BRepMesh_Delaun (IMeshData::Array1OfVertexOfDelaun& theVertices);
//! Creates the triangulation with an existent Mesh data structure.
Standard_EXPORT BRepMesh_Delaun (const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
- BRepMesh::Array1OfVertexOfDelaun& theVertices);
+ IMeshData::Array1OfVertexOfDelaun& theVertices);
//! Creates the triangulation with an existant Mesh data structure.
Standard_EXPORT BRepMesh_Delaun (const Handle(BRepMesh_DataStructureOfDelaun)& theOldMesh,
- BRepMesh::Array1OfInteger& theVertexIndices);
+ IMeshData::VectorOfInteger& theVertexIndices);
//! Initializes the triangulation with an array of vertices.
- Standard_EXPORT void Init (BRepMesh::Array1OfVertexOfDelaun& theVertices);
+ Standard_EXPORT void Init (IMeshData::Array1OfVertexOfDelaun& theVertices);
//! Removes a vertex from the triangulation.
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
//! Adds some vertices into the triangulation.
- Standard_EXPORT void AddVertices (BRepMesh::Array1OfVertexOfDelaun& theVertices);
+ Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices);
//! Modify mesh to use the edge.
//! @return True if done
}
//! Gives the list of frontier edges.
- inline BRepMesh::HMapOfInteger Frontier() const
+ inline Handle(IMeshData::MapOfInteger) Frontier() const
{
return getEdgesByType (BRepMesh_Frontier);
}
//! Gives the list of internal edges.
- inline BRepMesh::HMapOfInteger InternalEdges() const
+ inline Handle(IMeshData::MapOfInteger) InternalEdges() const
{
return getEdgesByType (BRepMesh_Fixed);
}
//! Gives the list of free edges used only one time
- inline BRepMesh::HMapOfInteger FreeEdges() const
+ inline Handle(IMeshData::MapOfInteger) FreeEdges() const
{
return getEdgesByType (BRepMesh_Free);
}
InsertBefore
};
- typedef NCollection_DataMap<Standard_Integer, BRepMesh::MapOfInteger> DataMapOfMap;
+ typedef NCollection_DataMap<Standard_Integer, IMeshData::MapOfInteger> DataMapOfMap;
//! Add boundig box for edge defined by start & end point to
//! the given vector of bounding boxes for triangulation edges.
- void fillBndBox (BRepMesh::SequenceOfBndB2d& theBoxes,
+ void fillBndBox (IMeshData::SequenceOfBndB2d& theBoxes,
const BRepMesh_Vertex& theV1,
const BRepMesh_Vertex& theV2);
//! Gives the list of edges with type defined by the input parameter.
//! If the given type is BRepMesh_Free returns list of edges
//! that have number of connected elements less or equal 1.
- BRepMesh::HMapOfInteger getEdgesByType (const BRepMesh_DegreeOfFreedom theEdgeType) const;
+ Handle(IMeshData::MapOfInteger) getEdgesByType (const BRepMesh_DegreeOfFreedom theEdgeType) const;
//! Create super mesh and run triangulation procedure.
void perform (Bnd_Box2d& theBndBox,
- BRepMesh::Array1OfInteger& theVertexIndices);
+ IMeshData::VectorOfInteger& theVertexIndices);
//! Build the super mesh.
void superMesh (const Bnd_Box2d& theBox);
//! Computes the triangulation and adds the vertices,
//! edges and triangles to the Mesh data structure.
- void compute (BRepMesh::Array1OfInteger& theVertexIndices);
+ void compute (IMeshData::VectorOfInteger& theVertexIndices);
//! Adjust the mesh on the frontier.
void frontierAdjust();
//! Find left polygon of the given edge and call meshPolygon.
Standard_Boolean meshLeftPolygonOf(
- const Standard_Integer theEdgeIndex,
- const Standard_Boolean isForward,
- BRepMesh::HMapOfInteger theSkipped = NULL);
+ const Standard_Integer theEdgeIndex,
+ const Standard_Boolean isForward,
+ Handle(IMeshData::MapOfInteger) theSkipped = NULL);
//! Find next link starting from the given node and has maximum
//! angle respect the given reference link.
//! Each time the next link is found other neighbor links at the pivot
//! node are marked as leprous and will be excluded from consideration
//! next time until a hanging end is occured.
- Standard_Integer findNextPolygonLink (const Standard_Integer& theFirstNode,
- const Standard_Integer& thePivotNode,
- const BRepMesh_Vertex& thePivotVertex,
- const gp_Vec2d& theRefLinkDir,
- const BRepMesh::SequenceOfBndB2d& theBoxes,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::HMapOfInteger theSkipped,
- const Standard_Boolean& isSkipLeprous,
- BRepMesh::MapOfInteger& theLeprousLinks,
- BRepMesh::MapOfInteger& theDeadLinks,
- Standard_Integer& theNextPivotNode,
- gp_Vec2d& theNextLinkDir,
- Bnd_B2d& theNextLinkBndBox);
+ Standard_Integer findNextPolygonLink (const Standard_Integer& theFirstNode,
+ const Standard_Integer& thePivotNode,
+ const BRepMesh_Vertex& thePivotVertex,
+ const gp_Vec2d& theRefLinkDir,
+ const IMeshData::SequenceOfBndB2d& theBoxes,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const Handle(IMeshData::MapOfInteger) theSkipped,
+ const Standard_Boolean& isSkipLeprous,
+ IMeshData::MapOfInteger& theLeprousLinks,
+ IMeshData::MapOfInteger& theDeadLinks,
+ Standard_Integer& theNextPivotNode,
+ gp_Vec2d& theNextLinkDir,
+ Bnd_B2d& theNextLinkBndBox);
//! Check is the given link intersects the polygon boundaries.
//! Returns bounding box for the given link trough the theLinkBndBox parameter.
- Standard_Boolean checkIntersection (const BRepMesh_Edge& theLink,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- const Standard_Boolean isConsiderEndPointTouch,
- const Standard_Boolean isConsiderPointOnEdge,
- const Standard_Boolean isSkipLastEdge,
- Bnd_B2d& theLinkBndBox) const;
+ Standard_Boolean checkIntersection (const BRepMesh_Edge& theLink,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ const Standard_Boolean isConsiderEndPointTouch,
+ const Standard_Boolean isConsiderPointOnEdge,
+ const Standard_Boolean isSkipLastEdge,
+ Bnd_B2d& theLinkBndBox) const;
//! Triangulatiion of a closed polygon described by the list
//! of indexes of its edges in the structure.
//! (negative index means reversed edge)
- void meshPolygon (BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::HMapOfInteger theSkipped = NULL);
+ void meshPolygon (IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ Handle(IMeshData::MapOfInteger) theSkipped = NULL);
//! Decomposes the given closed simple polygon (polygon without glued edges
//! and loops) on two simpler ones by adding new link at the most thin part
//! @param thePolygonCut product of decomposition of source polygon (second part of decomposition).
//! @param thePolyBoxesCut bounding boxes corresponded to resulting polygon's links.
void decomposeSimplePolygon (
- BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::SequenceOfInteger& thePolygonCut,
- BRepMesh::SequenceOfBndB2d& thePolyBoxesCut);
+ IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::SequenceOfInteger& thePolygonCut,
+ IMeshData::SequenceOfBndB2d& thePolyBoxesCut);
//! Triangulation of closed polygon containing only three edges.
- inline Standard_Boolean meshElementaryPolygon (const BRepMesh::SequenceOfInteger& thePolygon);
+ inline Standard_Boolean meshElementaryPolygon (const IMeshData::SequenceOfInteger& thePolygon);
//! Creates the triangles beetween the given node and the given polyline.
void createTriangles (const Standard_Integer theVertexIndex,
- BRepMesh::MapOfIntegerInteger& thePoly);
+ IMeshData::MapOfIntegerInteger& thePoly);
//! Add a triangle based on the given oriented edges into mesh
- void addTriangle (const Standard_Integer (&theEdgesId)[3],
- const Standard_Boolean (&theEdgesOri)[3],
- const Standard_Integer (&theNodesId)[3]);
+ inline 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.
void deleteTriangle (const Standard_Integer theIndex,
- BRepMesh::MapOfIntegerInteger& theLoopEdges);
+ IMeshData::MapOfIntegerInteger& theLoopEdges);
//! Returns start and end nodes of the given edge in respect to its orientation.
void getOrientedNodes (const BRepMesh_Edge& theEdge,
//! Processes loop within the given polygon formed by range of its
//! links specified by start and end link indices.
- void processLoop (const Standard_Integer theLinkFrom,
- const Standard_Integer theLinkTo,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes);
+ void processLoop (const Standard_Integer theLinkFrom,
+ const Standard_Integer theLinkTo,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes);
//! Creates new link based on the given nodes and updates the given polygon.
- Standard_Integer createAndReplacePolygonLink (const Standard_Integer theNodes[],
- const gp_Pnt2d thePnts [],
- const Standard_Integer theRootIndex,
- const ReplaceFlag theReplaceFlag,
- BRepMesh::SequenceOfInteger& thePolygon,
- BRepMesh::SequenceOfBndB2d& thePolyBoxes);
+ Standard_Integer createAndReplacePolygonLink (const Standard_Integer theNodes[],
+ const gp_Pnt2d thePnts [],
+ const Standard_Integer theRootIndex,
+ const ReplaceFlag theReplaceFlag,
+ IMeshData::SequenceOfInteger& thePolygon,
+ IMeshData::SequenceOfBndB2d& thePolyBoxes);
//! Creates the triangles on new nodes.
- void createTrianglesOnNewVertices (BRepMesh::Array1OfInteger& theVertexIndices);
+ void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices);
//! Cleanup mesh from the free triangles.
void cleanupMesh();
const Standard_Integer thePrevElementId);
//! Remove internal triangles from the given polygon.
- void cleanupPolygon (const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes);
+ void cleanupPolygon (const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes);
//! Checks is the given vertex lies inside the polygon.
- Standard_Boolean isVertexInsidePolygon (const Standard_Integer& theVertexId,
- const BRepMesh::VectorOfInteger& thePolygonVertices) const;
+ Standard_Boolean isVertexInsidePolygon (const Standard_Integer& theVertexId,
+ const IMeshData::VectorOfInteger& thePolygonVertices) const;
//! Remove all triangles and edges that are placed inside the polygon or crossed it.
- void killTrianglesAroundVertex (const Standard_Integer theZombieNodeId,
- const BRepMesh::VectorOfInteger& thePolyVertices,
- const BRepMesh::MapOfInteger& thePolyVerticesFindMap,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::MapOfInteger& theSurvivedLinks,
- BRepMesh::MapOfIntegerInteger& theLoopEdges);
+ void killTrianglesAroundVertex (const Standard_Integer theZombieNodeId,
+ const IMeshData::VectorOfInteger& thePolyVertices,
+ const IMeshData::MapOfInteger& thePolyVerticesFindMap,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::MapOfInteger& theSurvivedLinks,
+ IMeshData::MapOfIntegerInteger& theLoopEdges);
//! Checks is the given link crosses the polygon boundary.
//! If yes, kills its triangles and checks neighbor links on boundary intersection. Does nothing elsewhere.
- void killTrianglesOnIntersectingLinks (const Standard_Integer& theLinkToCheckId,
- const BRepMesh_Edge& theLinkToCheck,
- const Standard_Integer& theEndPoint,
- const BRepMesh::SequenceOfInteger& thePolygon,
- const BRepMesh::SequenceOfBndB2d& thePolyBoxes,
- BRepMesh::MapOfInteger& theSurvivedLinks,
- BRepMesh::MapOfIntegerInteger& theLoopEdges);
+ void killTrianglesOnIntersectingLinks (const Standard_Integer& theLinkToCheckId,
+ const BRepMesh_Edge& theLinkToCheck,
+ const Standard_Integer& theEndPoint,
+ const IMeshData::SequenceOfInteger& thePolygon,
+ const IMeshData::SequenceOfBndB2d& thePolyBoxes,
+ IMeshData::MapOfInteger& theSurvivedLinks,
+ IMeshData::MapOfIntegerInteger& theLoopEdges);
//! Kill triangles bound to the given link.
- void killLinkTriangles (const Standard_Integer& theLinkId,
- BRepMesh::MapOfIntegerInteger& theLoopEdges);
+ void killLinkTriangles (const Standard_Integer& theLinkId,
+ IMeshData::MapOfIntegerInteger& theLoopEdges);
//! Calculates distances between the given point and edges of triangle.
Standard_Real calculateDist (const gp_XY theVEdges[3],
gp_Pnt2d& theIntPnt) const;
//! Returns area of the loop of the given polygon defined by indices of its start and end links.
- Standard_Real polyArea (const BRepMesh::SequenceOfInteger& thePolygon,
- const Standard_Integer theStartIndex,
- const Standard_Integer theEndIndex) const;
+ Standard_Real polyArea (const IMeshData::SequenceOfInteger& thePolygon,
+ const Standard_Integer theStartIndex,
+ const Standard_Integer theEndIndex) const;
//! Performs insertion of internal edges into mesh.
void insertInternalEdges();
}
//! Alias for IsEqual.
- Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
+ inline Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
{
return IsEqual(Other);
}
#ifndef _BRepMesh_EdgeParameterProvider_HeaderFile
#define _BRepMesh_EdgeParameterProvider_HeaderFile
+#include <IMeshData_Types.hxx>
+#include <IMeshData_Edge.hxx>
+#include <IMeshData_Face.hxx>
+#include <TopoDS.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include <Adaptor3d_CurveOnSurface.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <Geom2dAdaptor_HCurve.hxx>
+#include <GeomAdaptor_HSurface.hxx>
class gp_Pnt;
class TopoDS_Edge;
class TopoDS_Face;
-#include <TColStd_HArray1OfReal.hxx>
//! Auxiliary class provides correct parameters
//! on curve regarding SameParameter flag.
-class BRepMesh_EdgeParameterProvider
+template<class ParametersCollection>
+class BRepMesh_EdgeParameterProvider : public Standard_Transient
{
public:
DEFINE_STANDARD_ALLOC
+ //! Constructor. Initializes empty provider.
+ BRepMesh_EdgeParameterProvider()
+ {
+ }
+
//! Constructor.
//! @param theEdge edge which parameters should be processed.
//! @param theFace face the parametric values are defined for.
//! @param theParameters parameters corresponded to discretization points.
BRepMesh_EdgeParameterProvider(
- const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace,
- const Handle(TColStd_HArray1OfReal)& theParameters);
+ const IMeshData::IEdgeHandle& theEdge,
+ const TopAbs_Orientation theOrientation,
+ const IMeshData::IFaceHandle& theFace,
+ const ParametersCollection& theParameters)
+ {
+ Init(theEdge, theOrientation, theFace, theParameters);
+ }
+
+ //! Initialized provider by the given data.
+ void Init (
+ const IMeshData::IEdgeHandle& theEdge,
+ const TopAbs_Orientation theOrientation,
+ const IMeshData::IFaceHandle& theFace,
+ const ParametersCollection& theParameters)
+ {
+ myParameters = theParameters;
+ myIsSameParam = theEdge->GetSameParam();
+ myScale = 1.;
+
+ // Extract actual parametric values
+ const TopoDS_Edge aEdge = TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation));
+
+ myCurveAdaptor.Initialize(aEdge, theFace->GetFace());
+ if (myIsSameParam)
+ {
+ return;
+ }
+
+ myFirstParam = myCurveAdaptor.FirstParameter();
+ const Standard_Real aLastParam = myCurveAdaptor.LastParameter();
+
+ myFoundParam = myCurParam = myFirstParam;
+
+ // Extract parameters stored in polygon
+ myOldFirstParam = myParameters->Value(myParameters->Lower());
+ const Standard_Real aOldLastParam = myParameters->Value(myParameters->Upper());
+
+ // Calculate scale factor between actual and stored parameters
+ if ((myOldFirstParam != myFirstParam || aOldLastParam != aLastParam) &&
+ myOldFirstParam != aOldLastParam)
+ {
+ myScale = (aLastParam - myFirstParam) / (aOldLastParam - myOldFirstParam);
+ }
+
+ myProjector.Initialize(myCurveAdaptor, myCurveAdaptor.FirstParameter(),
+ myCurveAdaptor.LastParameter(),Precision::PConfusion());
+ }
//! Returns parameter according to SameParameter flag of the edge.
//! If SameParameter is TRUE returns value from parameters w/o changes,
//! elsewhere scales initial parameter and tries to determine resulting
//! value using projection of the corresponded 3D point on PCurve.
Standard_Real Parameter(const Standard_Integer theIndex,
- const gp_Pnt& thePoint3d);
+ const gp_Pnt& thePoint3d) const
+ {
+ if (myIsSameParam)
+ {
+ return myParameters->Value(theIndex);
+ }
+
+ // Use scaled
+ const Standard_Real aParam = myParameters->Value(theIndex);
+
+ const Standard_Real aPrevParam = myCurParam;
+ myCurParam = myFirstParam + myScale * (aParam - myOldFirstParam);
+
+ const Standard_Real aPrevFoundParam = myFoundParam;
+ myFoundParam += (myCurParam - aPrevParam);
+
+ myProjector.Perform(thePoint3d, myFoundParam);
+ if (myProjector.IsDone())
+ {
+ const Standard_Real aFoundParam = myProjector.Point().Parameter();
+ if ((aPrevFoundParam < myFoundParam && aPrevFoundParam < aFoundParam) ||
+ (aPrevFoundParam > myFoundParam && aPrevFoundParam > aFoundParam))
+ {
+ // Rude protection against case when amplified parameter goes before
+ // previous one due to period or other reason occurred in projector.
+ // Using parameter returned by projector as is can produce self-intersections.
+ myFoundParam = aFoundParam;
+ }
+ }
+
+ return myFoundParam;
+ }
+
+ //! Returns pcurve used to compute parameters.
+ const Handle(Adaptor2d_HCurve2d)& GetPCurve() const
+ {
+ return myCurveAdaptor.CurveOnSurface().GetCurve();
+ }
private:
- Handle(TColStd_HArray1OfReal) myParameters;
+ ParametersCollection myParameters;
Standard_Boolean myIsSameParam;
Standard_Real myFirstParam;
Standard_Real myOldFirstParam;
Standard_Real myScale;
- Standard_Real myCurParam;
- Standard_Real myFoundParam;
+ mutable Standard_Real myCurParam;
+ mutable Standard_Real myFoundParam;
BRepAdaptor_Curve myCurveAdaptor;
- Extrema_LocateExtPC myProjector;
+
+ mutable Extrema_LocateExtPC myProjector;
};
#endif
-// Created on: 2014-08-13
+// Created on: 2016-04-19
+// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
-// Copyright (c) 2011-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// commercial license or contractual agreement.
#include <BRepMesh_EdgeTessellationExtractor.hxx>
-#include <Geom2dAdaptor_HCurve.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
-#include <Poly_Triangulation.hxx>
#include <BRepMesh_ShapeTool.hxx>
+#include <gp_Pnt.hxx>
+#include <BRep_Tool.hxx>
+#include <IMeshData_Face.hxx>
+#include <IMeshData_Edge.hxx>
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+BRepMesh_EdgeTessellationExtractor::BRepMesh_EdgeTessellationExtractor (
+ const IMeshData::IEdgeHandle& theEdge,
+ const IMeshData::IFaceHandle& theFace)
+{
+ Handle (Poly_Triangulation) aTriangulation =
+ BRep_Tool::Triangulation (theFace->GetFace(), myLoc);
+
+ Handle (Poly_PolygonOnTriangulation) aPolygon =
+ BRep_Tool::PolygonOnTriangulation (theEdge->GetEdge(), aTriangulation, myLoc);
-IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor,BRepMesh_IEdgeTool)
+ myNodes = &aTriangulation->Nodes ();
+ myIndices = &aPolygon->Nodes ();
+ myProvider.Init (theEdge, TopAbs_FORWARD, theFace, aPolygon->Parameters ());
+}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
-BRepMesh_EdgeTessellationExtractor::BRepMesh_EdgeTessellationExtractor(
- const TopoDS_Edge& theEdge,
- const Handle(Geom2dAdaptor_HCurve)& thePCurve,
- const TopoDS_Face& theFace,
- const Handle(Poly_Triangulation)& theTriangulation,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon,
- const TopLoc_Location& theLocation)
- : myProvider(theEdge, theFace, thePolygon->Parameters()),
- myPCurve(thePCurve),
- myNodes(theTriangulation->Nodes()),
- myIndices(thePolygon->Nodes()),
- myLoc(theLocation)
+BRepMesh_EdgeTessellationExtractor::~BRepMesh_EdgeTessellationExtractor ()
{
}
+//=======================================================================
+//function : NbPoints
+//purpose :
+//=======================================================================
+Standard_Integer BRepMesh_EdgeTessellationExtractor::PointsNb () const
+{
+ return myIndices->Size ();
+}
+
//=======================================================================
//function : Value
//purpose :
//=======================================================================
-Standard_Boolean BRepMesh_EdgeTessellationExtractor::Value(
+Standard_Boolean BRepMesh_EdgeTessellationExtractor::Value (
const Standard_Integer theIndex,
- Standard_Real& theParameter,
gp_Pnt& thePoint,
- gp_Pnt2d& theUV)
+ Standard_Real& theParameter) const
{
- const gp_Pnt& theRefPnt = myNodes(myIndices(theIndex));
- thePoint = BRepMesh_ShapeTool::UseLocation(theRefPnt, myLoc);
-
- theParameter = myProvider.Parameter(theIndex, thePoint);
- theUV = myPCurve->Value(theParameter);
+ const gp_Pnt& theRefPnt = (*myNodes) ((*myIndices) (theIndex));
+ thePoint = BRepMesh_ShapeTool::UseLocation (theRefPnt, myLoc);
+ theParameter = myProvider.Parameter (theIndex, thePoint);
return Standard_True;
}
-// Created on: 2014-08-13
+// Created on: 2016-04-19
+// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
-// Copyright (c) 2011-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
#ifndef _BRepMesh_EdgeTessellationExtractor_HeaderFile
#define _BRepMesh_EdgeTessellationExtractor_HeaderFile
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <BRepMesh_IEdgeTool.hxx>
+#include <IMeshTools_CurveTessellator.hxx>
+#include <IMeshData_Types.hxx>
#include <BRepMesh_EdgeParameterProvider.hxx>
-#include <TopLoc_Location.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfInteger.hxx>
-
-class Poly_Triangulation;
-class Poly_PolygonOnTriangulation;
-class TopoDS_Edge;
-class TopoDS_Face;
-class Geom2dAdaptor_HCurve;
+#include <TopLoc_Location.hxx>
//! Auxiliary class implements functionality retrieving tessellated
//! representation of an edge stored in polygon.
-class BRepMesh_EdgeTessellationExtractor : public BRepMesh_IEdgeTool
+class BRepMesh_EdgeTessellationExtractor : public IMeshTools_CurveTessellator
{
public:
//! Constructor.
- //! Initializes extractor.
- BRepMesh_EdgeTessellationExtractor(
- const TopoDS_Edge& theEdge,
- const Handle(Geom2dAdaptor_HCurve)& thePCurve,
- const TopoDS_Face& theFace,
- const Handle(Poly_Triangulation)& theTriangulation,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon,
- const TopLoc_Location& theLocation);
+ Standard_EXPORT BRepMesh_EdgeTessellationExtractor (
+ const IMeshData::IEdgeHandle& theEdge,
+ const IMeshData::IFaceHandle& theFace);
+
+ //! Destructor.
+ Standard_EXPORT virtual ~BRepMesh_EdgeTessellationExtractor ();
- //! Returns number of dicretization points.
- virtual Standard_Integer NbPoints() const Standard_OVERRIDE
- {
- return myIndices.Length();
- }
+ //! Returns number of tessellation points.
+ Standard_EXPORT virtual Standard_Integer PointsNb () const Standard_OVERRIDE;
//! Returns parameters of solution with the given index.
//! @param theIndex index of tessellation point.
//! @param theParameter parameters on PCurve corresponded to the solution.
//! @param thePoint tessellation point.
- //! @param theUV coordinates of tessellation point in parametric space of face.
//! @return True in case of valid result, false elewhere.
- virtual Standard_Boolean Value(
+ Standard_EXPORT virtual Standard_Boolean Value (
const Standard_Integer theIndex,
- Standard_Real& theParameter,
gp_Pnt& thePoint,
- gp_Pnt2d& theUV) Standard_OVERRIDE;
+ Standard_Real& theParameter) const Standard_OVERRIDE;
- DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeTessellationExtractor,BRepMesh_IEdgeTool)
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_EdgeTessellationExtractor, IMeshTools_CurveTessellator)
private:
- //! Assignment operator.
- void operator =(const BRepMesh_EdgeTessellationExtractor& /*theOther*/)
- {
- }
-
-private:
-
- BRepMesh_EdgeParameterProvider myProvider;
- Handle(Geom2dAdaptor_HCurve) myPCurve;
- const TColgp_Array1OfPnt& myNodes;
- const TColStd_Array1OfInteger& myIndices;
- const TopLoc_Location myLoc;
+ BRepMesh_EdgeParameterProvider<Handle(TColStd_HArray1OfReal)> myProvider;
+ const TColgp_Array1OfPnt* myNodes;
+ const TColStd_Array1OfInteger* myIndices;
+ TopLoc_Location myLoc;
};
-DEFINE_STANDARD_HANDLE(BRepMesh_EdgeTessellationExtractor, BRepMesh_IEdgeTool)
-
-#endif
+#endif
\ No newline at end of file
//=======================================================================
Standard_Boolean BRepMesh_GeomTool::Value(
const Standard_Integer theIndex,
+ const Handle(BRepAdaptor_HSurface)& theSurface,
Standard_Real& theParam,
- gp_Pnt& thePoint) const
+ gp_Pnt& thePoint,
+ gp_Pnt2d& theUV) const
{
if (theIndex < 1 || theIndex > NbPoints())
return Standard_False;
thePoint = myDiscretTool.Value(theIndex);
theParam = myDiscretTool.Parameter(theIndex);
+ const TopoDS_Face& aFace = ((BRepAdaptor_Surface*)&(theSurface->Surface()))->Face();
+
+ Standard_Real aFirst, aLast;
+ Handle(Geom2d_Curve) aCurve =
+ BRep_Tool::CurveOnSurface(*myEdge, aFace, aFirst, aLast);
+
+ aCurve->D0(theParam, theUV);
+
return Standard_True;
}
//function : Value
//purpose :
//=======================================================================
-Standard_Boolean BRepMesh_GeomTool::Value(const Standard_Integer theIndex,
- const Standard_Real theIsoParam,
- Standard_Real& theParam,
- gp_Pnt& thePoint,
- gp_Pnt2d& theUV) const
+Standard_Boolean BRepMesh_GeomTool::Value(
+ const Standard_Integer theIndex,
+ const Standard_Real theIsoParam,
+ Standard_Real& theParam,
+ gp_Pnt& thePoint,
+ gp_Pnt2d& theUV) const
{
if (theIndex < 1 || theIndex > NbPoints())
return Standard_False;
const Standard_Real aEndPrec = 1 - aPrec;
for (Standard_Integer i = 0; i < 2; ++i)
{
- if( aParam[i] < aPrec || aParam[i] > aEndPrec )
+ if(aParam[i] < aPrec || aParam[i] > aEndPrec )
return BRepMesh_GeomTool::NoIntersection;
}
//! @param theLinDeflection linear deflection.
//! @param theAngDeflection angular deflection.
//! @param theMinPointsNb minimum nuber of points to be produced.
- Standard_EXPORT BRepMesh_GeomTool(const BRepAdaptor_Curve& theCurve,
- const Standard_Real theFirstParam,
- const Standard_Real theLastParam,
- const Standard_Real theLinDeflection,
- const Standard_Real theAngDeflection,
- const Standard_Integer theMinPointsNb = 2,
- const Standard_Real theMinSize = Precision::Confusion());
+ Standard_EXPORT BRepMesh_GeomTool(
+ const BRepAdaptor_Curve& theCurve,
+ const Standard_Real theFirstParam,
+ const Standard_Real theLastParam,
+ const Standard_Real theLinDeflection,
+ const Standard_Real theAngDeflection,
+ const Standard_Integer theMinPointsNb = 2,
+ const Standard_Real theMinSize = Precision::Confusion());
//! Constructor.
//! Initiates discretization of geometric curve corresponding
//! @param theLinDeflection linear deflection.
//! @param theAngDeflection angular deflection.
//! @param theMinPointsNb minimum nuber of points to be produced.
- Standard_EXPORT BRepMesh_GeomTool(const Handle(BRepAdaptor_HSurface)& theSurface,
- const GeomAbs_IsoType theIsoType,
- const Standard_Real theParamIso,
- const Standard_Real theFirstParam,
- const Standard_Real theLastParam,
- const Standard_Real theLinDeflection,
- const Standard_Real theAngDeflection,
- const Standard_Integer theMinPointsNb = 2,
- const Standard_Real theMinSize = Precision::Confusion());
+ Standard_EXPORT BRepMesh_GeomTool(
+ const Handle(BRepAdaptor_HSurface)& theSurface,
+ const GeomAbs_IsoType theIsoType,
+ const Standard_Real theParamIso,
+ const Standard_Real theFirstParam,
+ const Standard_Real theLastParam,
+ const Standard_Real theLinDeflection,
+ const Standard_Real theAngDeflection,
+ const Standard_Integer theMinPointsNb = 2,
+ const Standard_Real theMinSize = Precision::Confusion());
//! Adds point to already calculated points (or replaces existing).
//! @param thePoint point to be added.
//! Gets parameters of discretization point with the given index.
//! @param theIndex index of discretization point.
+ //! @param theSurface surface the curve is lying onto.
//! @param theParam[out] parameter of the point on the curve.
//! @param thePoint[out] discretization point.
+ //! @param theUV[out] discretization point in parametric space of the surface.
//! @return TRUE on success, FALSE elsewhere.
Standard_EXPORT Standard_Boolean Value(const Standard_Integer theIndex,
+ const Handle(BRepAdaptor_HSurface)& theSurface,
Standard_Real& theParam,
- gp_Pnt& thePoint) const;
+ gp_Pnt& thePoint,
+ gp_Pnt2d& theUV) const;
public: //! @name static API
const Standard_Boolean isConsiderPointOnSegment,
gp_Pnt2d& theIntPnt);
+ //! Compute deflection of the given segment.
+ Standard_EXPORT static Standard_Real SquareDeflectionOfSegment(
+ const gp_Pnt& theFirstPoint,
+ const gp_Pnt& theLastPoint,
+ const gp_Pnt& theMidPoint)
+ {
+ // 23.03.2010 skl for OCC21645 - change precision for comparison
+ if (theFirstPoint.SquareDistance(theLastPoint) > Precision::SquareConfusion())
+ {
+ gp_Lin aLin(theFirstPoint, gp_Dir(gp_Vec(theFirstPoint, theLastPoint)));
+ return aLin.SquareDistance(theMidPoint);
+ }
+
+ return theFirstPoint.SquareDistance(theMidPoint);
+ }
+
private:
//! Classifies the point in case of coincidence of two vectors.
// commercial license or contractual agreement.
#include <BRepMesh_IncrementalMesh.hxx>
-
-#include <OSD_Parallel.hxx>
-#include <Precision.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-#include <BRepMesh_ShapeTool.hxx>
-#include <BRepMesh_Edge.hxx>
+#include <BRepMesh_Context.hxx>
+#include <BRepMesh_MeshBuilder.hxx>
#include <BRepMesh_PluginMacro.hxx>
-
-#include <Bnd_Box.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
-#include <BRepLib.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepAdaptor_Curve.hxx>
-
-#include <Poly_Triangulation.hxx>
-#include <Poly_Polygon3D.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopAbs.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <TopTools_HArray1OfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-
-#include <GCPnts_TangentialDeflection.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
+#include <IMeshData_Status.hxx>
+#include <IMeshData_Face.hxx>
+#include <IMeshData_Wire.hxx>
namespace
{
static Standard_Boolean IS_IN_PARALLEL = Standard_False;
}
-
//=======================================================================
//function : Default constructor
//purpose :
//=======================================================================
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
-: myMaxShapeSize(0.),
- myModified(Standard_False),
- myStatus(0)
+: myModified(Standard_False),
+ myStatus(IMeshData_NoError)
{
}
const Standard_Real theLinDeflection,
const Standard_Boolean isRelative,
const Standard_Real theAngDeflection,
- const Standard_Boolean isInParallel,
- const Standard_Boolean adaptiveMin)
-: myMaxShapeSize(0.),
- myModified(Standard_False),
- myStatus(0)
+ const Standard_Boolean isInParallel)
+: myModified(Standard_False),
+ myStatus(IMeshData_NoError)
{
myParameters.Deflection = theLinDeflection;
myParameters.Relative = isRelative;
myParameters.Angle = theAngDeflection;
myParameters.InParallel = isInParallel;
- myParameters.AdaptiveMin = adaptiveMin;
myShape = theShape;
Perform();
//function : Constructor
//purpose :
//=======================================================================
-BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
- const BRepMesh_FastDiscret::Parameters& theParameters)
+BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
+ const TopoDS_Shape& theShape,
+ const IMeshTools_Parameters& theParameters)
: myParameters(theParameters)
{
- myShape = theShape;
-
+ myShape = theShape;
Perform();
}
{
}
-//=======================================================================
-//function : clear
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::clear()
-{
- // the allocator will be alive while the structures are alive
- Handle(NCollection_BaseAllocator) anAlloc =
- new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
- myEdges.Clear(anAlloc);
- myEdgeDeflection.Clear(anAlloc);
- myFaces.Clear();
- myMesh.Nullify();
-}
-
-//=======================================================================
-//function : init
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::init()
-{
- myStatus = 0;
- myModified = Standard_False;
-
- setDone();
- clear();
-
- collectFaces();
-
- Bnd_Box aBox;
- if ( myParameters.Relative )
- {
- BRepBndLib::Add(myShape, aBox, Standard_False);
-
- if (aBox.IsVoid())
- {
- // Nothing to mesh.
- return;
- }
-
- BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
- }
-
- myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
-
- myMesh->InitSharedFaces(myShape);
-}
-
-//=======================================================================
-//function : collectFaces
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::collectFaces()
-{
- Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
- TopTools_ListOfShape aFaceList(anAlloc);
- BRepLib::ReverseSortFaces(myShape, aFaceList);
- TColStd_MapOfTransient aTFaceMap(1, anAlloc);
-
- // make array of faces suitable for processing (excluding faces without surface)
- TopLoc_Location aDummyLoc;
- TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
- for (; aFaceIter.More(); aFaceIter.Next())
- {
- const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
- const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
- if (!aTFaceMap.Add (aTFace))
- continue; // already processed
-
- const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
- if (aSurf.IsNull())
- continue;
-
- myFaces.Append(aFace);
- }
-}
-
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform()
{
- init();
-
- if (myMesh.IsNull())
- return;
-
- update();
-}
-
-//=======================================================================
-//function : update()
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::update()
-{
- // Update edges data
- TopExp_Explorer aExplorer(myShape, TopAbs_EDGE);
- for (; aExplorer.More(); aExplorer.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
- if(!BRep_Tool::IsGeometric(aEdge))
- continue;
-
- update(aEdge);
- }
-
- // Update faces data
- NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
- for (; aFaceIt.More(); aFaceIt.Next())
- update(aFaceIt.Value());
-
- // Mesh faces
- OSD_Parallel::ForEach(myFaces.begin(), myFaces.end(), *myMesh, !myParameters.InParallel);
-
- commit();
- clear();
-}
-
-//=======================================================================
-//function : discretizeFreeEdges
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::discretizeFreeEdges()
-{
- TopExp_Explorer aExplorer(myShape ,TopAbs_EDGE, TopAbs_FACE);
- for (; aExplorer.More(); aExplorer.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aExplorer.Current());
- if(!BRep_Tool::IsGeometric(aEdge))
- continue;
-
- TopLoc_Location aLoc;
- Standard_Real aEdgeDeflection = edgeDeflection(aEdge);
- Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(aEdge, aLoc);
- if (!aPoly3D.IsNull() && aPoly3D->Deflection() < 1.1 * aEdgeDeflection)
- continue;
-
- BRepAdaptor_Curve aCurve(aEdge);
- GCPnts_TangentialDeflection aDiscret(aCurve, aCurve.FirstParameter(),
- aCurve.LastParameter(), myParameters.Angle, aEdgeDeflection, 2,
- Precision::PConfusion(), myParameters.MinSize);
-
- Standard_Integer aNodesNb = aDiscret.NbPoints();
- TColgp_Array1OfPnt aNodes (1, aNodesNb);
- TColStd_Array1OfReal aUVNodes(1, aNodesNb);
- for (Standard_Integer i = 1; i <= aNodesNb; ++i)
- {
- aNodes (i) = aDiscret.Value(i);
- aUVNodes(i) = aDiscret.Parameter(i);
- }
-
- aPoly3D = new Poly_Polygon3D(aNodes, aUVNodes);
- aPoly3D->Deflection(myParameters.Deflection);
-
- BRep_Builder aBuilder;
- aBuilder.UpdateEdge(aEdge, aPoly3D);
- }
-}
-
-//=======================================================================
-//function : edgeDeflection
-//purpose :
-//=======================================================================
-Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
- const TopoDS_Edge& theEdge)
-{
- const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
- if (pDef)
- return *pDef;
-
- Standard_Real aEdgeDeflection;
- if ( myParameters.Relative )
- {
- Standard_Real aScale;
- aEdgeDeflection = BRepMesh_ShapeTool::RelativeEdgeDeflection(theEdge,
- myParameters.Deflection, myMaxShapeSize, aScale);
- }
- else
- aEdgeDeflection = myParameters.Deflection;
-
- myEdgeDeflection.Bind(theEdge, aEdgeDeflection);
- return aEdgeDeflection;
-}
-
-//=======================================================================
-//function : faceDeflection
-//purpose :
-//=======================================================================
-Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
- const TopoDS_Face& theFace)
-{
- if ( !myParameters.Relative )
- return myParameters.Deflection;
+ Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
+ aContext->SetShape(Shape());
+ aContext->ChangeParameters() = myParameters;
+ aContext->ChangeParameters().CleanModel = Standard_False;
- Standard_Integer aEdgesNb = 0;
- Standard_Real aFaceDeflection = 0.;
+ BRepMesh_MeshBuilder aIncMesh(aContext);
+ aIncMesh.Perform();
- TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
- for (; aEdgeIt.More(); aEdgeIt.Next(), ++aEdgesNb)
+ myStatus = IMeshData_NoError;
+ const Handle(IMeshData_Model)& aModel = aContext->GetModel();
+ for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
{
- const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
- aFaceDeflection += edgeDeflection(aEdge);
- }
-
- return (aEdgesNb == 0) ? myParameters.Deflection : (aFaceDeflection / aEdgesNb);
-}
-
-//=======================================================================
-//function : update(edge)
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
-{
- if (!myEdges.IsBound(theEdge))
- myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
-
- Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
- // Check that triangulation relies to face of the given shape.
- const TopTools_IndexedDataMapOfShapeListOfShape& aMapOfSharedFaces =
- myMesh->SharedFaces();
-
- const TopTools_ListOfShape& aSharedFaces =
- aMapOfSharedFaces.FindFromKey(theEdge);
-
- TopTools_ListIteratorOfListOfShape aSharedFaceIt(aSharedFaces);
- for (; aSharedFaceIt.More(); aSharedFaceIt.Next())
- {
- TopLoc_Location aLoc;
- const TopoDS_Face& aFace = TopoDS::Face(aSharedFaceIt.Value());
- const Handle(Poly_Triangulation)& aFaceTriangulation =
- BRep_Tool::Triangulation(aFace, aLoc);
-
- if (aFaceTriangulation.IsNull())
- continue;
-
- Standard_Boolean isConsistent = Standard_False;
- const Handle(Poly_PolygonOnTriangulation)& aPolygon =
- BRep_Tool::PolygonOnTriangulation(theEdge, aFaceTriangulation, aLoc);
-
- if (!aPolygon.IsNull())
- {
- isConsistent = aPolygon->Deflection() < 1.1 * aEdgeDeflection &&
- aPolygon->HasParameters();
-
- if (!isConsistent)
- {
- myModified = Standard_True;
- BRepMesh_ShapeTool::NullifyEdge(theEdge, aFaceTriangulation, aLoc);
- }
- }
+ const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
+ myStatus |= aDFace->GetStatusMask();
- myEdges(theEdge).Bind(aFaceTriangulation, isConsistent);
- }
-}
-
-//=======================================================================
-//function : isToBeMeshed
-//purpose :
-//=======================================================================
-Standard_Boolean BRepMesh_IncrementalMesh::toBeMeshed(
- const TopoDS_Face& theFace,
- const Standard_Boolean isWithCheck)
-{
- TopLoc_Location aLoc;
- const Handle(Poly_Triangulation)& aTriangulation =
- BRep_Tool::Triangulation(theFace, aLoc);
-
- if (aTriangulation.IsNull())
- return Standard_True;
-
- if (isWithCheck)
- {
- Standard_Real aFaceDeflection = faceDeflection(theFace);
- if (aTriangulation->Deflection() < 1.1 * aFaceDeflection)
+ for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
{
- Standard_Boolean isEdgesConsistent = Standard_True;
- TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
- for (; aEdgeIt.More() && isEdgesConsistent; aEdgeIt.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
- if (!myEdges.IsBound(aEdge))
- continue;
-
- BRepMesh::DMapOfTriangulationBool& aTriMap = myEdges(aEdge);
- isEdgesConsistent &= aTriMap.IsBound(aTriangulation) &&
- aTriMap(aTriangulation);
- }
-
- if (isEdgesConsistent)
- {
- // #25080: check that indices of links forming triangles are in range.
- Standard_Boolean isTriangulationConsistent = Standard_True;
- const Standard_Integer aNodesNb = aTriangulation->NbNodes();
- const Poly_Array1OfTriangle& aTriangles = aTriangulation->Triangles();
- Standard_Integer i = aTriangles.Lower();
- for (; i <= aTriangles.Upper() && isTriangulationConsistent; ++i)
- {
- const Poly_Triangle& aTriangle = aTriangles(i);
- Standard_Integer n[3];
- aTriangle.Get(n[0], n[1], n[2]);
- for (Standard_Integer j = 0; j < 3 && isTriangulationConsistent; ++j)
- isTriangulationConsistent = (n[j] >= 1 && n[j] <= aNodesNb);
- }
-
- if (isTriangulationConsistent)
- return Standard_False;
- }
+ const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
+ myStatus |= aDWire->GetStatusMask();
}
}
-
- // Nullify edges
- TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
- for (; aEdgeIt.More(); aEdgeIt.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
- BRepMesh_ShapeTool::NullifyEdge(aEdge, aTriangulation, aLoc);
- }
-
- BRepMesh_ShapeTool::NullifyFace(theFace);
- return Standard_True;
-}
-
-//=======================================================================
-//function : update(face)
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::update(const TopoDS_Face& theFace)
-{
- if (!toBeMeshed(theFace, Standard_True))
- return;
-
- myModified = Standard_True;
- Standard_Integer aStatus = myMesh->Add(theFace);
-
- myStatus |= aStatus;
- if (aStatus != BRepMesh_ReMesh)
- return;
-
- BRepMesh::MapOfShape aUsedFaces;
- aUsedFaces.Add(theFace);
-
- const TopTools_IndexedDataMapOfShapeListOfShape& aMapOfSharedFaces =
- myMesh->SharedFaces();
-
- TopExp_Explorer aEdgeIt(theFace, TopAbs_EDGE);
- for (; aEdgeIt.More(); aEdgeIt.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
- if (aMapOfSharedFaces.FindIndex(aEdge) == 0)
- continue;
-
- const TopTools_ListOfShape& aSharedFaces = aMapOfSharedFaces.FindFromKey(aEdge);
- TopTools_ListIteratorOfListOfShape aSharedFaceIt(aSharedFaces);
- for (; aSharedFaceIt.More(); aSharedFaceIt.Next())
- {
- const TopoDS_Face& aFace = TopoDS::Face(aSharedFaceIt.Value());
- if (aUsedFaces.Contains(aFace))
- continue;
-
- aUsedFaces.Add(aFace);
- toBeMeshed(aFace, Standard_False);
-
- myStatus |= myMesh->Add(aFace);
- }
- }
-}
-
-//=======================================================================
-//function : commit
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::commit()
-{
- NCollection_Vector<TopoDS_Face>::Iterator aFaceIt(myFaces);
- for (; aFaceIt.More(); aFaceIt.Next())
- commitEdges(aFaceIt.Value());
-
- discretizeFreeEdges();
-}
-
-//=======================================================================
-//function : commitEdges
-//purpose :
-//=======================================================================
-void BRepMesh_IncrementalMesh::commitEdges(const TopoDS_Face& theFace)
-{
- TopoDS_Face aFace = theFace;
- aFace.Orientation(TopAbs_FORWARD);
-
- Handle(BRepMesh_FaceAttribute) aFaceAttribute;
- if (!myMesh->GetFaceAttribute(aFace, aFaceAttribute))
- return;
-
- if (!aFaceAttribute->IsValid())
- {
- myStatus |= aFaceAttribute->GetStatus();
- return;
- }
-
- TopLoc_Location aLoc;
- Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
-
- if (aTriangulation.IsNull())
- return;
-
- try
- {
- OCC_CATCH_SIGNALS
-
- // Store discretization of edges
- BRepMesh::HDMapOfShapePairOfPolygon& aInternalEdges = aFaceAttribute->ChangeInternalEdges();
- BRepMesh::DMapOfShapePairOfPolygon::Iterator aEdgeIt(*aInternalEdges);
- for (; aEdgeIt.More(); aEdgeIt.Next())
- {
- const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Key());
- const BRepMesh_PairOfPolygon& aPolyPair = aEdgeIt.Value();
- const Handle(Poly_PolygonOnTriangulation)& aPolygon1 = aPolyPair.First();
- const Handle(Poly_PolygonOnTriangulation)& aPolygon2 = aPolyPair.Last();
-
- if (aPolygon1 == aPolygon2)
- BRepMesh_ShapeTool::UpdateEdge(aEdge, aPolygon1, aTriangulation, aLoc);
- else
- BRepMesh_ShapeTool::UpdateEdge(aEdge, aPolygon1, aPolygon2, aTriangulation, aLoc);
- }
- }
- catch (Standard_Failure)
- {
- myStatus |= BRepMesh_Failure;
- }
}
//=======================================================================
anAlgo->ChangeParameters().Deflection = theDeflection;
anAlgo->ChangeParameters().Angle = theAngle;
anAlgo->ChangeParameters().InParallel = IS_IN_PARALLEL;
- anAlgo->SetShape (theShape);
+ anAlgo->SetShape (theShape);
theAlgo = anAlgo;
return 0; // no error
}
#ifndef _BRepMesh_IncrementalMesh_HeaderFile
#define _BRepMesh_IncrementalMesh_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <BRepMesh_FastDiscret.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_DataMapOfShapeReal.hxx>
#include <BRepMesh_DiscretRoot.hxx>
-#include <BRepMesh.hxx>
-
-#include <vector>
-
-class Poly_Triangulation;
-class TopoDS_Shape;
-class TopoDS_Edge;
-class TopoDS_Face;
+#include <IMeshTools_Parameters.hxx>
//! Builds the mesh of a shape with respect of their
//! correctly triangulated parts
const Standard_Real theLinDeflection,
const Standard_Boolean isRelative = Standard_False,
const Standard_Real theAngDeflection = 0.5,
- const Standard_Boolean isInParallel = Standard_False,
- const Standard_Boolean adaptiveMin = Standard_False);
+ const Standard_Boolean isInParallel = Standard_False);
//! Constructor.
//! Automatically calls method Perform.
//! @param theShape shape to be meshed.
//! @param theParameters - parameters of meshing
- Standard_EXPORT BRepMesh_IncrementalMesh (const TopoDS_Shape& theShape,
- const BRepMesh_FastDiscret::Parameters& theParameters);
+ Standard_EXPORT BRepMesh_IncrementalMesh (const TopoDS_Shape& theShape,
+ const IMeshTools_Parameters& theParameters);
//! Performs meshing ot the shape.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
public: //! @name accessing to parameters.
//! Returns meshing parameters
- inline const BRepMesh_FastDiscret::Parameters& Parameters() const
+ inline const IMeshTools_Parameters& Parameters() const
{
return myParameters;
}
//! Returns modifiable meshing parameters
- inline BRepMesh_FastDiscret::Parameters& ChangeParameters()
+ inline IMeshTools_Parameters& ChangeParameters()
{
return myParameters;
}
//! Discret() static method (thus applied only to Mesh Factories).
Standard_EXPORT static void SetParallelDefault(const Standard_Boolean isInParallel);
- DEFINE_STANDARD_RTTIEXT(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncrementalMesh, BRepMesh_DiscretRoot)
protected:
- Standard_EXPORT virtual void init() Standard_OVERRIDE;
-
-private:
-
- //! Builds the incremental mesh for the shape.
- void update();
-
- //! Checks triangulation of the given face for consistency
- //! with the chosen tolerance. If some edge of face has no
- //! discrete representation triangulation will be calculated.
- //! @param theFace face to be checked.
- void update(const TopoDS_Face& theFace);
-
- //! Checks discretization of the given edge for consistency
- //! with the chosen tolerance.
- //! @param theEdge edge to be checked.
- void update(const TopoDS_Edge& theEdge);
-
- //! Collects faces suitable for meshing.
- void collectFaces();
-
- //! Discretizes edges that have no associations with faces.
- void discretizeFreeEdges();
-
- //! Returns deflection of the given edge.
- //! @param theEdge edge which tolerance should be taken.
- Standard_Real edgeDeflection(const TopoDS_Edge& theEdge);
-
- //! Returns deflection of the given face.
- //! If relative flag is set, calculates relative deflection of the face
- //! as an average value of relative deflection regarding face's edges.
- //! Returns value of deflection set by user elsewhere.
- Standard_Real faceDeflection(const TopoDS_Face& theFace);
-
- //! Prepares the given face for meshing.
- //! Nullifies triangulation of face and polygons of face's edges.
- //! @param theFace face to be checked.
- //! @param isWithCheck if TRUE, checks parameters of triangulation
- //! existing in face. If its deflection satisfies the given value and
- //! each edge of face has polygon corresponded to this triangulation,
- //! method return FALSE.
- //! @return TRUE in case if the given face should be meshed.
- Standard_Boolean toBeMeshed(const TopoDS_Face& theFace,
- const Standard_Boolean isWithCheck);
-
- //! Stores mesh to the shape.
- void commit();
-
- //! Stores mesh of internal edges to the face.
- void commitEdges(const TopoDS_Face& theFace);
-
- //! Clears internal data structures.
- void clear();
-
-protected:
-
- BRepMesh::DMapOfEdgeListOfTriangulationBool myEdges;
- Handle(BRepMesh_FastDiscret) myMesh;
- TopTools_DataMapOfShapeReal myEdgeDeflection;
- NCollection_Vector<TopoDS_Face> myFaces;
-
- BRepMesh_FastDiscret::Parameters myParameters;
-
- Standard_Real myMaxShapeSize;
- Standard_Boolean myModified;
- Standard_Integer myStatus;
+ IMeshTools_Parameters myParameters;
+ Standard_Boolean myModified;
+ Standard_Integer myStatus;
};
-DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)
-
#endif
//! Constructs a link between two vertices.
BRepMesh_OrientedEdge(
- const Standard_Integer theFirstNode,
- const Standard_Integer theLastNode)
+ const Standard_Integer theFirstNode,
+ const Standard_Integer theLastNode)
: myFirstNode(theFirstNode),
myLastNode(theLastNode)
{
//! Returns hash code for this edge.
//! @param theUpper upper index in the container.
//! @return hash code.
- Standard_Integer HashCode(const Standard_Integer theUpper) const
+ inline Standard_Integer HashCode(const Standard_Integer theUpper) const
{
return ::HashCode(myFirstNode + myLastNode, theUpper);
}
}
//! Alias for IsEqual.
- Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
+ inline Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
{
return IsEqual(Other);
}
#include <BRepMesh_SelectorOfDataStructureOfDelaun.hxx>
#include <BRepMesh_PairOfIndex.hxx>
+#include <BRepMesh_Edge.hxx>
//=======================================================================
//function : Default constructor
//purpose :
//=======================================================================
BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun()
-: myAllocator(new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE)),
- myNodes (10, myAllocator),
- myLinks (10, myAllocator),
- myElements(10, myAllocator),
- myFrontier(10, myAllocator)
{
}
//=======================================================================
BRepMesh_SelectorOfDataStructureOfDelaun::BRepMesh_SelectorOfDataStructureOfDelaun(
const Handle(BRepMesh_DataStructureOfDelaun)& theMesh)
-: myAllocator(new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE)),
- myMesh (theMesh),
- myNodes (10, myAllocator),
- myLinks (10, myAllocator),
- myElements(10, myAllocator),
- myFrontier(10, myAllocator)
+ : myMesh(theMesh)
{
}
void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursOfNode(
const Standard_Integer theNodeIndex)
{
- BRepMesh::ListOfInteger::Iterator aLinkIt(
+ IMeshData::ListOfInteger::Iterator aLinkIt(
myMesh->LinksConnectedTo(theNodeIndex));
for (; aLinkIt.More(); aLinkIt.Next())
void BRepMesh_SelectorOfDataStructureOfDelaun::NeighboursByEdgeOf(
const BRepMesh_Triangle& theElement)
{
- Standard_Integer e[3];
- Standard_Boolean o[3];
- theElement.Edges(e, o);
-
+ const Standard_Integer(&e)[3] = theElement.myEdges;
for (Standard_Integer i = 0; i < 3; ++i)
elementsOfLink(e[i]);
}
#ifndef _BRepMesh_SelectorOfDataStructureOfDelaun_HeaderFile
#define _BRepMesh_SelectorOfDataStructureOfDelaun_HeaderFile
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Macro.hxx>
+#include <Standard_Transient.hxx>
#include <BRepMesh_DataStructureOfDelaun.hxx>
-#include <BRepMesh.hxx>
-#include <Standard_Integer.hxx>
#include <BRepMesh_Triangle.hxx>
+#include <IMeshData_Types.hxx>
class BRepMesh_Vertex;
class BRepMesh_Edge;
//! Describes a selector and an iterator on a
//! selector of components of a mesh.
-class BRepMesh_SelectorOfDataStructureOfDelaun
+class BRepMesh_SelectorOfDataStructureOfDelaun : public Standard_Transient
{
public:
- DEFINE_STANDARD_ALLOC
-
//! Default constructor.
Standard_EXPORT BRepMesh_SelectorOfDataStructureOfDelaun();
}
//! Returns selected nodes.
- inline const BRepMesh::MapOfInteger& Nodes() const
+ inline const IMeshData::MapOfInteger& Nodes() const
{
return myNodes;
}
//! Returns selected links.
- inline const BRepMesh::MapOfInteger& Links() const
+ inline const IMeshData::MapOfInteger& Links() const
{
return myLinks;
}
//! Returns selected elements.
- inline const BRepMesh::MapOfInteger& Elements() const
+ inline const IMeshData::MapOfInteger& Elements() const
{
return myElements;
}
//! Gives the list of incices of frontier links.
- inline const BRepMesh::MapOfInteger& FrontierLinks() const
+ inline const IMeshData::MapOfInteger& FrontierLinks() const
{
return myFrontier;
}
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_SelectorOfDataStructureOfDelaun, Standard_Transient)
+
private:
//! Collects elements connected to link with the given index.
void elementsOfLink(const Standard_Integer theIndex);
private:
- Handle(NCollection_IncAllocator) myAllocator;
Handle(BRepMesh_DataStructureOfDelaun) myMesh;
- BRepMesh::MapOfInteger myNodes;
- BRepMesh::MapOfInteger myLinks;
- BRepMesh::MapOfInteger myElements;
- BRepMesh::MapOfInteger myFrontier;
+ IMeshData::MapOfInteger myNodes;
+ IMeshData::MapOfInteger myLinks;
+ IMeshData::MapOfInteger myElements;
+ IMeshData::MapOfInteger myFrontier;
};
#endif
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
+// Created on: 2016-04-19
+// Copyright (c) 2016 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// commercial license or contractual agreement.
#include <BRepMesh_ShapeTool.hxx>
-
-#include <Bnd_Box.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRepBndLib.hxx>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
+#include <IMeshData_Edge.hxx>
+#include <IMeshData_PCurve.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
-#include <BRepAdaptor_HSurface.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <Poly_Triangulation.hxx>
+#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
-#include <TopExp.hxx>
+#include <ShapeAnalysis_Edge.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include <Precision.hxx>
+#include <Bnd_Box.hxx>
-namespace {
+namespace
+{
//! Auxilary struct to take a tolerance of edge.
struct EdgeTolerance
{
}
//=======================================================================
-//function : BoxMaxDimension
+//function : MaxFaceTolerance
//purpose :
//=======================================================================
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);
void BRepMesh_ShapeTool::BoxMaxDimension(const Bnd_Box& theBox,
Standard_Real& theMaxDimension)
{
- if(theBox.IsVoid())
+ if (theBox.IsVoid())
return;
Standard_Real aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ;
}
//=======================================================================
-//function : RelativeEdgeDeflection
+//function : CheckAndUpdateFlags
//purpose :
//=======================================================================
-Standard_Real BRepMesh_ShapeTool::RelativeEdgeDeflection(
- const TopoDS_Edge& theEdge,
- const Standard_Real theDeflection,
- const Standard_Real theMaxShapeSize,
- Standard_Real& theAdjustmentCoefficient)
+void BRepMesh_ShapeTool::CheckAndUpdateFlags (
+ const IMeshData::IEdgeHandle& theEdge,
+ const IMeshData::IPCurveHandle& thePCurve)
{
- theAdjustmentCoefficient = 1.;
- Standard_Real aDefEdge = theDeflection;
- if(theEdge.IsNull())
- return aDefEdge;
-
- Bnd_Box aBox;
- BRepBndLib::Add(theEdge, aBox, Standard_False);
- BoxMaxDimension(aBox, aDefEdge);
-
- // Adjust resulting value in relation to the total size
- theAdjustmentCoefficient = theMaxShapeSize / (2 * aDefEdge);
- if (theAdjustmentCoefficient < 0.5)
- theAdjustmentCoefficient = 0.5;
- else if (theAdjustmentCoefficient > 2.)
- theAdjustmentCoefficient = 2.;
-
- return (theAdjustmentCoefficient * aDefEdge * theDeflection);
-}
-
-//=======================================================================
-//function : FindUV
-//purpose :
-//=======================================================================
-gp_XY BRepMesh_ShapeTool::FindUV(
- const Standard_Integer theIndexOfPnt3d,
- const gp_Pnt2d& thePnt2d,
- const Standard_Real theMinDistance,
- const Handle(BRepMesh_FaceAttribute)& theFaceAttribute)
-{
- const gp_XY& aPnt2d = thePnt2d.Coord();
- BRepMesh::HDMapOfIntegerListOfXY& aLocation2D =
- theFaceAttribute->ChangeLocation2D();
-
- if (!aLocation2D->IsBound(theIndexOfPnt3d))
+ if (!theEdge->GetSameParam () &&
+ !theEdge->GetSameRange () &&
+ theEdge->GetDegenerated ())
{
- BRepMesh::ListOfXY aPoints2d;
- aPoints2d.Append(aPnt2d);
- aLocation2D->Bind(theIndexOfPnt3d, aPoints2d);
- return aPnt2d;
+ // Nothing to do worse.
+ return;
}
- BRepMesh::ListOfXY& aPoints2d = aLocation2D->ChangeFind(theIndexOfPnt3d);
+ const TopoDS_Edge& aEdge = theEdge->GetEdge ();
+ const TopoDS_Face& aFace = thePCurve->GetFace ().lock ()->GetFace ();
- // Find the most closest 2d point to the given one.
- gp_XY aUV;
- Standard_Real aMinDist = RealLast();
- BRepMesh::ListOfXY::Iterator aPoint2dIt(aPoints2d);
- for (; aPoint2dIt.More(); aPoint2dIt.Next())
+ Handle (Geom_Curve) aCurve;
+ Standard_Real aFirstParam, aLastParam;
+ Range (aEdge, aCurve, aFirstParam, aLastParam);
+ if (aCurve.IsNull())
{
- const gp_XY& aCurPnt2d = aPoint2dIt.Value();
+ theEdge->SetDegenerated(Standard_True);
+ return;
+ }
- Standard_Real aDist = (aPnt2d - aCurPnt2d).Modulus();
- if (aDist < aMinDist)
+ BRepAdaptor_Curve aCurveOnSurf(aEdge, aFace);
+ if (theEdge->GetSameParam () || theEdge->GetSameRange ())
+ {
+ if (theEdge->GetSameRange ())
{
- aUV = aCurPnt2d;
- aMinDist = aDist;
+ const Standard_Real aDiffFirst = aCurveOnSurf.FirstParameter () - aFirstParam;
+ const Standard_Real aDiffLast = aCurveOnSurf.LastParameter () - aLastParam;
+ theEdge->SetSameRange (
+ Abs (aDiffFirst) < Precision::PConfusion () &&
+ Abs (aDiffLast ) < Precision::PConfusion ());
+
+ if (!theEdge->GetSameRange())
+ {
+ theEdge->SetSameParam(Standard_False);
+ }
}
}
- const Standard_Real aTolerance = theMinDistance;
-
- // Get face limits
- Standard_Real aDiffU = theFaceAttribute->GetUMax() - theFaceAttribute->GetUMin();
- Standard_Real aDiffV = theFaceAttribute->GetVMax() - theFaceAttribute->GetVMin();
-
- const Standard_Real Utol2d = .5 * aDiffU;
- const Standard_Real Vtol2d = .5 * aDiffV;
-
- const Handle(BRepAdaptor_HSurface)& aSurface = theFaceAttribute->Surface();
- const gp_Pnt aPnt1 = aSurface->Value(aUV.X(), aUV.Y());
- const gp_Pnt aPnt2 = aSurface->Value(aPnt2d.X(), aPnt2d.Y());
-
- //! If selected point is too far from the given one in parametric space
- //! or their positions in 3d are different, add the given point as unique.
- if (Abs(aUV.X() - aPnt2d.X()) > Utol2d ||
- Abs(aUV.Y() - aPnt2d.Y()) > Vtol2d ||
- !aPnt1.IsEqual(aPnt2, aTolerance))
+ if (!theEdge->GetDegenerated ()/* || theEdge->GetSameParam ()*/)
{
- aUV = aPnt2d;
- aPoints2d.Append(aUV);
- }
+ TopoDS_Vertex aStartVertex, aEndVertex;
+ TopExp::Vertices (aEdge, aStartVertex, aEndVertex);
+ if (aStartVertex.IsNull() || aEndVertex.IsNull())
+ {
+ theEdge->SetDegenerated(Standard_True);
+ return;
+ }
- return aUV;
+ if (aStartVertex.IsSame(aEndVertex))
+ {
+ const Standard_Integer aPointsNb = 20;
+ const Standard_Real aVertexTolerance = BRep_Tool::Tolerance (aStartVertex);
+ const Standard_Real aDu = (aLastParam - aFirstParam) / aPointsNb;
+ //const Standard_Real aEdgeTolerance = BRep_Tool::Tolerance (aEdge);
+ //const Standard_Real aSqEdgeTolerance = aEdgeTolerance * aEdgeTolerance;
+
+ gp_Pnt aPrevPnt;
+ aCurve->D0 (aFirstParam, aPrevPnt);
+
+ Standard_Real aLength = 0.0;
+ for (Standard_Integer i = 1; i <= aPointsNb; ++i)
+ {
+ const Standard_Real aParameter = aFirstParam + i * aDu;
+ // Calculation of the length of the edge in 3D
+ // in order to check degenerativity
+ gp_Pnt aPnt;
+ aCurve->D0 (aParameter, aPnt);
+ aLength += aPrevPnt.Distance (aPnt);
+
+ //if (theEdge->GetSameParam ())
+ //{
+ // // Check that points taken at the 3d and pcurve using
+ // // same parameter are within tolerance of an edge.
+ // gp_Pnt aPntOnSurf;
+ // aCurveOnSurf.D0 (aParameter, aPntOnSurf);
+ // theEdge->SetSameParam (aPnt.SquareDistance (aPntOnSurf) < aSqEdgeTolerance);
+ //}
+
+ if (aLength > aVertexTolerance /*&& !theEdge->GetSameParam()*/)
+ {
+ break;
+ }
+
+ aPrevPnt = aPnt;
+ }
+
+ theEdge->SetDegenerated (aLength < aVertexTolerance);
+ }
+ }
}
//=======================================================================
aTrsf.Invert();
TColgp_Array1OfPnt& aNodes = theTriangulation->ChangeNodes();
- for (Standard_Integer i = aNodes.Lower(); i <= aNodes.Upper(); ++i)
+ for (Standard_Integer i = aNodes.Lower(); i <= aNodes.Upper(); ++i)
aNodes(i).Transform(aTrsf);
}
aBuilder.UpdateFace(theFace, theTriangulation);
}
+
//=======================================================================
//function : NullifyFace
//purpose :
//=======================================================================
-void BRepMesh_ShapeTool::NullifyFace(const TopoDS_Face& theFace)
+void BRepMesh_ShapeTool::NullifyFace (const TopoDS_Face& theFace)
{
BRep_Builder aBuilder;
- aBuilder.UpdateFace(theFace, Handle(Poly_Triangulation)());
+ aBuilder.UpdateFace (theFace, Handle (Poly_Triangulation)());
}
//=======================================================================
//function : NullifyEdge
//purpose :
//=======================================================================
-void BRepMesh_ShapeTool::NullifyEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation)
+void BRepMesh_ShapeTool::NullifyEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation)
{
- UpdateEdge(theEdge, Handle(Poly_PolygonOnTriangulation)(),
+ UpdateEdge (theEdge, Handle (Poly_PolygonOnTriangulation)(),
theTriangulation, theLocation);
}
+//=======================================================================
+//function : NullifyEdge
+//purpose :
+//=======================================================================
+void BRepMesh_ShapeTool::NullifyEdge (
+ const TopoDS_Edge& theEdge,
+ const TopLoc_Location& theLocation)
+{
+ BRep_Builder aBuilder;
+ aBuilder.UpdateEdge (theEdge, Handle (Poly_Polygon3D)(), theLocation);
+}
+
//=======================================================================
//function : UpdateEdge
//purpose :
//=======================================================================
-void BRepMesh_ShapeTool::UpdateEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation)
+void BRepMesh_ShapeTool::UpdateEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation)
{
BRep_Builder aBuilder;
- aBuilder.UpdateEdge(theEdge, thePolygon, theTriangulation, theLocation);
+ aBuilder.UpdateEdge (theEdge, thePolygon, theTriangulation, theLocation);
}
//=======================================================================
//function : UpdateEdge
//purpose :
//=======================================================================
-void BRepMesh_ShapeTool::UpdateEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon1,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon2,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation)
+void BRepMesh_ShapeTool::UpdateEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon1,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon2,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation)
{
BRep_Builder aBuilder;
- aBuilder.UpdateEdge(theEdge, thePolygon1, thePolygon2,
+ aBuilder.UpdateEdge (theEdge, thePolygon1, thePolygon2,
theTriangulation, theLocation);
}
+//=======================================================================
+//function : UpdateEdge
+//purpose :
+//=======================================================================
+void BRepMesh_ShapeTool::UpdateEdge(
+ const TopoDS_Edge& theEdge,
+ const Handle(Poly_Polygon3D)& thePolygon)
+{
+ BRep_Builder aBuilder;
+ aBuilder.UpdateEdge(theEdge, thePolygon);
+}
+
//=======================================================================
//function : UseLocation
//purpose :
//=======================================================================
-gp_Pnt BRepMesh_ShapeTool::UseLocation(const gp_Pnt& thePnt,
- const TopLoc_Location& theLoc)
+gp_Pnt BRepMesh_ShapeTool::UseLocation (
+ const gp_Pnt& thePnt,
+ const TopLoc_Location& theLoc)
{
if (theLoc.IsIdentity())
+ {
return thePnt;
+ }
- return thePnt.Transformed(theLoc.Transformation());
+ return thePnt.Transformed (theLoc.Transformation ());
}
//=======================================================================
-//function : IsDegenerated
+//function : UVPoints
//purpose :
//=======================================================================
-Standard_Boolean BRepMesh_ShapeTool::IsDegenerated(
- const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace)
+Standard_Boolean BRepMesh_ShapeTool::UVPoints (
+ const TopoDS_Edge& theEdge,
+ const TopoDS_Face& theFace,
+ gp_Pnt2d& theFirstPoint2d,
+ gp_Pnt2d& theLastPoint2d,
+ const Standard_Boolean isConsiderOrientation)
{
- // Get vertices
- TopoDS_Vertex pBegin, pEnd;
- TopExp::Vertices(theEdge, pBegin, pEnd);
- if (pBegin.IsNull() || pEnd.IsNull())
- return Standard_True;
-
- if (BRep_Tool::Degenerated(theEdge))
- return Standard_True;
- if (!pBegin.IsSame(pEnd))
+ Handle (Geom2d_Curve) aCurve2d;
+ Standard_Real aFirstParam, aLastParam;
+ if (!Range(theEdge, theFace, aCurve2d, aFirstParam, aLastParam, isConsiderOrientation))
+ {
return Standard_False;
+ }
- Standard_Real wFirst, wLast;
- BRep_Tool::Range(theEdge, theFace, wFirst, wLast);
-
- // calculation of the length of the edge in 3D
- Standard_Real longueur = 0.0;
- Standard_Real du = (wLast - wFirst) * 0.05;
- gp_Pnt P1, P2;
- BRepAdaptor_Curve BC(theEdge);
- BC.D0(wFirst, P1);
- Standard_Real tolV = BRep_Tool::Tolerance(pBegin);
- Standard_Real tolV2 = 1.2 * tolV;
-
- for (Standard_Integer l = 1; l <= 20; ++l)
- {
- BC.D0(wFirst + l * du, P2);
- longueur += P1.Distance(P2);
+ aCurve2d->D0 (aFirstParam, theFirstPoint2d);
+ aCurve2d->D0 (aLastParam, theLastPoint2d);
+ return Standard_True;
+}
- if (longueur > tolV2)
- break;
+//=======================================================================
+//function : Range
+//purpose :
+//=======================================================================
+Standard_Boolean BRepMesh_ShapeTool::Range (
+ const TopoDS_Edge& theEdge,
+ const TopoDS_Face& theFace,
+ Handle (Geom2d_Curve)& thePCurve,
+ Standard_Real& theFirstParam,
+ Standard_Real& theLastParam,
+ const Standard_Boolean isConsiderOrientation)
+{
- P1 = P2;
- }
+ ShapeAnalysis_Edge aEdge;
+ return aEdge.PCurve (theEdge, theFace, thePCurve,
+ theFirstParam, theLastParam,
+ isConsiderOrientation);
+}
- if (longueur < tolV2)
- return Standard_True;
+//=======================================================================
+//function : Range
+//purpose :
+//=======================================================================
+Standard_Boolean BRepMesh_ShapeTool::Range (
+ const TopoDS_Edge& theEdge,
+ Handle (Geom_Curve)& theCurve,
+ Standard_Real& theFirstParam,
+ Standard_Real& theLastParam,
+ const Standard_Boolean isConsiderOrientation)
+{
- return Standard_False;
+ ShapeAnalysis_Edge aEdge;
+ return aEdge.Curve3d (theEdge, theCurve,
+ theFirstParam, theLastParam,
+ isConsiderOrientation);
}
-// Copyright (c) 2013 OPEN CASCADE SAS
+// Created on: 2016-04-19
+// Copyright (c) 2016 OPEN CASCADE SAS
+// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-
#ifndef _BRepMesh_ShapeTool_HeaderFile
#define _BRepMesh_ShapeTool_HeaderFile
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Macro.hxx>
-#include <BRepAdaptor_HSurface.hxx>
-#include <BRepMesh_FaceAttribute.hxx>
-#include <BRepMesh.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Type.hxx>
+#include <IMeshData_Types.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Poly_PolygonOnTriangulation.hxx>
-class Poly_Triangulation;
+class Geom_Curve;
+class Geom2d_Curve;
+class Poly_Polygon3D;
class TopoDS_Face;
class TopoDS_Edge;
class Bnd_Box;
-class TopoDS_Vertex;
-class gp_XY;
-class gp_Pnt2d;
-class BRepMesh_ShapeTool
+//! Auxiliary class providing functionality to compute,
+//! retrieve and store data to TopoDS and model shape.
+class BRepMesh_ShapeTool : public Standard_Transient
{
public:
- DEFINE_STANDARD_ALLOC
-
//! Returns maximum tolerance of the given face.
//! Considers tolerances of edges and vertices contained in the given face.
Standard_EXPORT static Standard_Real MaxFaceTolerance(
Standard_EXPORT static void BoxMaxDimension(const Bnd_Box& theBox,
Standard_Real& theMaxDimension);
- //! Returns relative deflection for edge with respect to shape size.
- //! @param theEdge edge for which relative deflection should be computed.
- //! @param theDeflection absolute deflection.
- //! @param theMaxShapeSize maximum size of a shape.
- //! @param theAdjustmentCoefficient coefficient of adjustment between maximum
- //! size of shape and calculated relative deflection.
- //! @return relative deflection for the edge.
- Standard_EXPORT static Standard_Real RelativeEdgeDeflection(
- const TopoDS_Edge& theEdge,
- const Standard_Real theDeflection,
- const Standard_Real theMaxShapeSize,
- Standard_Real& theAdjustmentCoefficient);
-
- //! Checks 2d representations of 3d point with the
- //! given index for equality to avoid duplications.
- //! @param theIndexOfPnt3d index of 3d point with which 2d
- //! representation should be associated.
- //! @param thePnt2d 2d representation of the point with the
- //! given index.
- //! @param theMinDistance minimum distance between vertices
- //! regarding which they could be treated as distinct ones.
- //! @param theFaceAttribute attributes contining data calculated
- //! according to face geomtry and define limits of face in parametric
- //! space. If defined, will be used instead of surface parameter.
- //! @param theLocation2dMap map of 2d representations of 3d points.
- //! @return given 2d point in case if 3d poind does not alredy have
- //! the similar representation, otherwice 2d point corresponding to
- //! existing representation will be returned.
- Standard_EXPORT static gp_XY FindUV(
- const Standard_Integer theIndexOfPnt3d,
- const gp_Pnt2d& thePnt2d,
- const Standard_Real theMinDistance,
- const Handle(BRepMesh_FaceAttribute)& theFaceAttribute);
+ //! Checks same parameter, same range and degenerativity attributes
+ //! using geometrical data of the given edge and updates edge model
+ //! by computed parameters in case of worst case - it can drop flags
+ //! same parameter and same range to False but never to True if it is
+ //! already set to False. In contrary, it can also drop degenerated
+ //! flag to True, but never to False if it is already set to True.
+ Standard_EXPORT static void CheckAndUpdateFlags (
+ const IMeshData::IEdgeHandle& theEdge,
+ const IMeshData::IPCurveHandle& thePCurve);
//! Stores the given triangulation into the given face.
//! @param theFace face to be updated by triangulation.
//! Nullifies triangulation stored in the face.
//! @param theFace face to be updated by null triangulation.
- Standard_EXPORT static void NullifyFace(const TopoDS_Face& theFace);
+ Standard_EXPORT static void NullifyFace (const TopoDS_Face& theFace);
//! Nullifies polygon on triangulation stored in the edge.
//! @param theEdge edge to be updated by null polygon.
//! @param theTriangulation triangulation the given edge is associated to.
//! @param theLocation face location.
- Standard_EXPORT static void NullifyEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation);
+ Standard_EXPORT static void NullifyEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation);
+
+ //! Nullifies 3d polygon stored in the edge.
+ //! @param theEdge edge to be updated by null polygon.
+ //! @param theLocation face location.
+ Standard_EXPORT static void NullifyEdge (
+ const TopoDS_Edge& theEdge,
+ const TopLoc_Location& theLocation);
//! Updates the given edge by the given tessellated representation.
//! @param theEdge edge to be updated.
//! @param thePolygon tessellated representation of the edge to be stored.
//! @param theTriangulation triangulation the given edge is associated to.
//! @param theLocation face location.
+ Standard_EXPORT static void UpdateEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation);
+
+ //! Updates the given edge by the given tessellated representation.
+ //! @param theEdge edge to be updated.
+ //! @param thePolygon tessellated representation of the edge to be stored.
Standard_EXPORT static void UpdateEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation);
+ const TopoDS_Edge& theEdge,
+ const Handle(Poly_Polygon3D)& thePolygon);
//! Updates the given seam edge by the given tessellated representations.
//! @param theEdge edge to be updated.
//! reversed direction of the seam edge.
//! @param theTriangulation triangulation the given edge is associated to.
//! @param theLocation face location.
- Standard_EXPORT static void UpdateEdge(
- const TopoDS_Edge& theEdge,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon1,
- const Handle(Poly_PolygonOnTriangulation)& thePolygon2,
- const Handle(Poly_Triangulation)& theTriangulation,
- const TopLoc_Location& theLocation);
+ Standard_EXPORT static void UpdateEdge (
+ const TopoDS_Edge& theEdge,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon1,
+ const Handle (Poly_PolygonOnTriangulation)& thePolygon2,
+ const Handle (Poly_Triangulation)& theTriangulation,
+ const TopLoc_Location& theLocation);
//! Applies location to the given point and return result.
//! @param thePnt point to be transformed.
//! @param theLoc location to be applied.
- Standard_EXPORT static gp_Pnt UseLocation(const gp_Pnt& thePnt,
- const TopLoc_Location& theLoc);
-
- //! Checks is the given edge degenerated.
- //! Checks geometrical parameters in case if IsDegenerated flag is not set.
- //! @param theEdge edge to be checked.
- //! @param theFace face within which parametric space edge will be checked
- //! for geometrical degenerativity.
- Standard_EXPORT static Standard_Boolean IsDegenerated(
- const TopoDS_Edge& theEdge,
- const TopoDS_Face& theFace);
+ Standard_EXPORT static gp_Pnt UseLocation (
+ const gp_Pnt& thePnt,
+ const TopLoc_Location& theLoc);
+
+ //! Gets the strict UV locations of the extremities of the edge using pcurve.
+ Standard_EXPORT static Standard_Boolean UVPoints (
+ const TopoDS_Edge& theEdge,
+ const TopoDS_Face& theFace,
+ gp_Pnt2d& theFirstPoint2d,
+ gp_Pnt2d& theLastPoint2d,
+ const Standard_Boolean isConsiderOrientation = Standard_False);
+
+ //! Gets the parametric range of the given edge on the given face.
+ Standard_EXPORT static Standard_Boolean Range (
+ const TopoDS_Edge& theEdge,
+ const TopoDS_Face& theFace,
+ Handle (Geom2d_Curve)& thePCurve,
+ Standard_Real& theFirstParam,
+ Standard_Real& theLastParam,
+ const Standard_Boolean isConsiderOrientation = Standard_False);
+
+ //! Gets the 3d range of the given edge.
+ Standard_EXPORT static Standard_Boolean Range (
+ const TopoDS_Edge& theEdge,
+ Handle (Geom_Curve)& theCurve,
+ Standard_Real& theFirstParam,
+ Standard_Real& theLastParam,
+ const Standard_Boolean isConsiderOrientation = Standard_False);
+
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_ShapeTool, Standard_Transient)
};
-#endif
+#endif
\ No newline at end of file
//! Default constructor.
BRepMesh_Triangle()
- : myEdge1(0),
- myEdge2(0),
- myEdge3(0),
- myOrientation1(Standard_False),
- myOrientation2(Standard_False),
- myOrientation3(Standard_False),
- myMovability (BRepMesh_Free)
+ : myMovability (BRepMesh_Free)
{
+ myEdges[0] = 0;
+ myEdges[1] = 0;
+ myEdges[2] = 0;
+ myOrientations[0] = Standard_False;
+ myOrientations[1] = Standard_False;
+ myOrientations[2] = Standard_False;
}
//! Constructor.
const Standard_Boolean (&theOrientations)[3],
const BRepMesh_DegreeOfFreedom theMovability)
{
- myEdge1 = theEdges[0];
- myEdge2 = theEdges[1];
- myEdge3 = theEdges[2];
- myOrientation1 = theOrientations[0];
- myOrientation2 = theOrientations[1];
- myOrientation3 = theOrientations[2];
+ memcpy(myEdges, theEdges, sizeof(theEdges));
+ memcpy(myOrientations, theOrientations, sizeof(theOrientations));
myMovability = theMovability;
}
inline void Edges(Standard_Integer (&theEdges)[3],
Standard_Boolean (&theOrientations)[3]) const
{
- theEdges[0] = myEdge1;
- theEdges[1] = myEdge2;
- theEdges[2] = myEdge3;
- theOrientations[0] = myOrientation1;
- theOrientations[1] = myOrientation2;
- theOrientations[2] = myOrientation3;
+ memcpy(theEdges, myEdges, sizeof(myEdges));
+ memcpy(theOrientations, myOrientations, sizeof(myOrientations));
}
//! Returns movability of the triangle.
//! Returns hash code for this triangle.
//! @param theUpper upper index in the container.
//! @return hash code.
- Standard_Integer HashCode(const Standard_Integer theUpper) const
+ inline Standard_Integer HashCode(const Standard_Integer theUpper) const
{
- return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper);
+ return ::HashCode(myEdges[0] + myEdges[1] + myEdges[2], theUpper);
}
//! Checks for equality with another triangle.
//! @param theOther triangle to be checked against this one.
//! @return TRUE if equal, FALSE if not.
- Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
+ inline Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
{
if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
return Standard_False;
- if (myEdge1 == theOther.myEdge1 &&
- myEdge2 == theOther.myEdge2 &&
- myEdge3 == theOther.myEdge3)
+ if (myEdges[0] == theOther.myEdges[0] &&
+ myEdges[1] == theOther.myEdges[1] &&
+ myEdges[2] == theOther.myEdges[2])
{
return Standard_True;
}
- if (myEdge1 == theOther.myEdge2 &&
- myEdge2 == theOther.myEdge3 &&
- myEdge3 == theOther.myEdge1)
+ if (myEdges[0] == theOther.myEdges[1] &&
+ myEdges[1] == theOther.myEdges[2] &&
+ myEdges[2] == theOther.myEdges[0])
{
return Standard_True;
}
- if (myEdge1 == theOther.myEdge3 &&
- myEdge2 == theOther.myEdge1 &&
- myEdge3 == theOther.myEdge2)
+ if (myEdges[0] == theOther.myEdges[2] &&
+ myEdges[1] == theOther.myEdges[0] &&
+ myEdges[2] == theOther.myEdges[1])
{
return Standard_True;
}
}
//! Alias for IsEqual.
- Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
+ inline Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
{
return IsEqual(theOther);
}
-private:
-
- Standard_Integer myEdge1;
- Standard_Integer myEdge2;
- Standard_Integer myEdge3;
- Standard_Boolean myOrientation1;
- Standard_Boolean myOrientation2;
- Standard_Boolean myOrientation3;
+ Standard_Integer myEdges[3];
+ Standard_Boolean myOrientations[3];
BRepMesh_DegreeOfFreedom myMovability;
};
#include <Standard_Macro.hxx>
#include <gp_XY.hxx>
#include <BRepMesh_DegreeOfFreedom.hxx>
+#include <Precision.hxx>
//! Light weighted structure representing vertex
//! of the mesh in parametric space. Vertex could be
//! Returns hash code for this vertex.
//! @param theUpper upper index in the container.
//! @return hash code.
- Standard_Integer HashCode(const Standard_Integer Upper) const
+ inline Standard_Integer HashCode(const Standard_Integer Upper) const
{
return ::HashCode(Floor(1e5 * myUV.X()) * Floor(1e5 * myUV.Y()), Upper);
}
//! Checks for equality with another vertex.
//! @param theOther vertex to be checked against this one.
//! @return TRUE if equal, FALSE if not.
- Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
+ inline Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
{
if (myMovability == BRepMesh_Deleted ||
theOther.myMovability == BRepMesh_Deleted)
}
//! Alias for IsEqual.
- Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
+ inline Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
{
return IsEqual(Other);
}
#include <Precision.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
-#include <BRepMesh.hxx>
+#include <IMeshData_Types.hxx>
#include <NCollection_CellFilter.hxx>
#include <BRepMesh_Vertex.hxx>
//! Constructor.
//! @param theAllocator memory allocator to be used by internal collections.
- BRepMesh_VertexInspector (
+ BRepMesh_VertexInspector(
const Handle(NCollection_IncAllocator)& theAllocator)
- : myResIndices(theAllocator),
- myVertices (new BRepMesh::VectorOfVertex),
- myDelNodes (theAllocator)
+ : myIndex(0),
+ myMinSqDist(RealLast()),
+ myVertices(new IMeshData::VectorOfVertex),
+ myDelNodes(theAllocator)
{
- SetTolerance( Precision::Confusion() );
+ SetTolerance(Precision::Confusion());
}
//! Registers the given vertex.
//! Set reference point to be checked.
inline void SetPoint(const gp_XY& thePoint)
{
- myResIndices.Clear();
- myPoint = thePoint;
+ myIndex = 0;
+ myMinSqDist = RealLast();
+ myPoint = thePoint;
}
//! Returns index of point coinciding with regerence one.
inline Standard_Integer GetCoincidentPoint() const
{
- if ( myResIndices.Size() > 0 )
- {
- return myResIndices.First();
- }
- return 0;
+ 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 BRepMesh::ListOfInteger& GetListOfDelPoints() const
+ inline const IMeshData::ListOfInteger& GetListOfDelPoints() const
{
return myDelNodes;
}
//! Returns set of mesh vertices.
- inline const BRepMesh::HVectorOfVertex& Vertices() const
+ inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
{
return myVertices;
}
//! Returns set of mesh vertices for modification.
- inline BRepMesh::HVectorOfVertex& ChangeVertices()
+ inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
{
return myVertices;
}
private:
- Standard_Real myTolerance[2];
- BRepMesh::ListOfInteger myResIndices;
- BRepMesh::HVectorOfVertex myVertices;
- BRepMesh::ListOfInteger myDelNodes;
- gp_XY myPoint;
+ Standard_Integer myIndex;
+ Standard_Real myMinSqDist;
+ Standard_Real myTolerance[2];
+ Handle(IMeshData::VectorOfVertex) myVertices;
+ IMeshData::ListOfInteger myDelNodes;
+ gp_XY myPoint;
};
#endif
// commercial license or contractual agreement.
#include <BRepMesh_VertexTool.hxx>
-#include <gp_XY.hxx>
-#include <gp_XYZ.hxx>
#include <Precision.hxx>
-#include <BRepMesh_Vertex.hxx>
-#include <BRepMesh_VertexInspector.hxx>
//=======================================================================
//function : Inspect
inTol = ((aVec.X() * aVec.X()) < myTolerance[0]) &&
((aVec.Y() * aVec.Y()) < myTolerance[1]);
}
+
if (inTol)
- myResIndices.Append(theTarget);
+ {
+ const Standard_Real aSqDist = aVec.SquareModulus();
+ if (aSqDist < myMinSqDist)
+ {
+ myMinSqDist = aSqDist;
+ myIndex = theTarget;
+ }
+ }
return CellFilter_Keep;
}
#define _BRepMesh_VertexTool_HeaderFile
#include <NCollection_Array1.hxx>
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Macro.hxx>
+#include <Standard_Transient.hxx>
#include <BRepMesh_VertexInspector.hxx>
-#include <BRepMesh.hxx>
#include <Standard_OStream.hxx>
-#include <gp_XYZ.hxx>
#include <gp_XY.hxx>
+#include <IMeshData_Types.hxx>
class BRepMesh_Vertex;
//! Describes data structure intended to keep mesh nodes
//! defined in UV space and implements functionality
-//! providing their uniqueness regarding thir position.
-class BRepMesh_VertexTool
+//! providing their uniqueness regarding their position.
+class BRepMesh_VertexTool : public Standard_Transient
{
public:
- DEFINE_STANDARD_ALLOC
-
//! Constructor.
//! @param theAllocator memory allocator to be used by internal collections.
Standard_EXPORT BRepMesh_VertexTool(
Standard_EXPORT void Delete(const Standard_Integer theIndex);
//! Returns set of mesh vertices.
- inline const BRepMesh::HVectorOfVertex& Vertices() const
+ inline const Handle(IMeshData::VectorOfVertex)& Vertices() const
{
return mySelector.Vertices();
}
//! Returns set of mesh vertices.
- inline BRepMesh::HVectorOfVertex& ChangeVertices()
+ inline Handle(IMeshData::VectorOfVertex)& ChangeVertices()
{
return mySelector.ChangeVertices();
}
//! Returns the list with indexes of vertices that have movability attribute
//! equal to BRepMesh_Deleted and can be replaced with another node.
- inline const BRepMesh::ListOfInteger& GetListOfDelNodes() const
+ inline const IMeshData::ListOfInteger& GetListOfDelNodes() const
{
return mySelector.GetListOfDelPoints();
}
//! Prints statistics.
Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
+ DEFINE_STANDARD_RTTI_INLINE(BRepMesh_VertexTool, Standard_Transient)
+
private:
//! Expands the given point according to specified tolerance.
private:
- Handle(NCollection_IncAllocator) myAllocator;
- BRepMesh::VertexCellFilter myCellFilter;
- BRepMesh_VertexInspector mySelector;
- Standard_Real myTolerance[2];
+ Handle(NCollection_IncAllocator) myAllocator;
+ IMeshData::VertexCellFilter myCellFilter;
+ BRepMesh_VertexInspector mySelector;
+ Standard_Real myTolerance[2];
};
#endif
-BRepMesh.hxx
+BRepMesh_BaseMeshAlgo.cxx
+BRepMesh_BaseMeshAlgo.hxx
+BRepMesh_BoundaryParamsRangeSplitter.hxx
BRepMesh_Circle.hxx
BRepMesh_CircleInspector.hxx
BRepMesh_CircleTool.cxx
BRepMesh_CircleTool.hxx
BRepMesh_Classifier.cxx
BRepMesh_Classifier.hxx
+BRepMesh_ConeRangeSplitter.hxx
+BRepMesh_Context.cxx
+BRepMesh_Context.hxx
+BRepMesh_CurveTessellator.cxx
+BRepMesh_CurveTessellator.hxx
+BRepMesh_CylinderRangeSplitter.hxx
BRepMesh_DataStructureOfDelaun.cxx
BRepMesh_DataStructureOfDelaun.hxx
+BRepMesh_DefaultRangeSplitter.hxx
+BRepMesh_Deflection.cxx
+BRepMesh_Deflection.hxx
BRepMesh_DegreeOfFreedom.hxx
BRepMesh_Delaun.cxx
BRepMesh_Delaun.hxx
-BRepMesh_DiscretFactory.cxx
+BRepMesh_DelaunayBaseMeshAlgo.cxx
+BRepMesh_DelaunayBaseMeshAlgo.hxx
+BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx
+BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx
BRepMesh_DiscretFactory.hxx
-BRepMesh_DiscretRoot.cxx
+BRepMesh_DiscretFactory.cxx
BRepMesh_DiscretRoot.hxx
+BRepMesh_DiscretRoot.cxx
BRepMesh_Edge.hxx
-BRepMesh_EdgeParameterProvider.cxx
+BRepMesh_EdgeDiscret.cxx
+BRepMesh_EdgeDiscret.hxx
BRepMesh_EdgeParameterProvider.hxx
BRepMesh_EdgeTessellationExtractor.cxx
BRepMesh_EdgeTessellationExtractor.hxx
-BRepMesh_EdgeTessellator.cxx
-BRepMesh_EdgeTessellator.hxx
-BRepMesh_FaceAttribute.cxx
-BRepMesh_FaceAttribute.hxx
+BRepMesh_FaceChecker.cxx
+BRepMesh_FaceChecker.hxx
+BRepMesh_FaceDiscret.cxx
+BRepMesh_FaceDiscret.hxx
BRepMesh_FactoryError.hxx
-BRepMesh_FastDiscret.cxx
-BRepMesh_FastDiscret.hxx
-BRepMesh_FastDiscretFace.cxx
-BRepMesh_FastDiscretFace.hxx
BRepMesh_GeomTool.cxx
BRepMesh_GeomTool.hxx
-BRepMesh_IEdgeTool.cxx
-BRepMesh_IEdgeTool.hxx
+BRepMesh_IncAllocator.hxx
BRepMesh_IncrementalMesh.cxx
BRepMesh_IncrementalMesh.hxx
+BRepMesh_MeshAlgoFactory.cxx
+BRepMesh_MeshAlgoFactory.hxx
+BRepMesh_MeshBuilder.cxx
+BRepMesh_MeshBuilder.hxx
+BRepMesh_MeshTool.cxx
+BRepMesh_MeshTool.hxx
+BRepMesh_ModelBuilder.cxx
+BRepMesh_ModelBuilder.hxx
+BRepMesh_ModelHealer.cxx
+BRepMesh_ModelHealer.hxx
+BRepMesh_ModelPostProcessor.cxx
+BRepMesh_ModelPostProcessor.hxx
+BRepMesh_ModelPreProcessor.cxx
+BRepMesh_ModelPreProcessor.hxx
+BRepMesh_NodeInsertionMeshAlgo.hxx
+BRepMesh_NURBSRangeSplitter.cxx
+BRepMesh_NURBSRangeSplitter.hxx
BRepMesh_OrientedEdge.hxx
BRepMesh_PairOfIndex.hxx
-BRepMesh_PairOfPolygon.hxx
BRepMesh_PluginEntryType.hxx
BRepMesh_PluginMacro.hxx
BRepMesh_SelectorOfDataStructureOfDelaun.cxx
BRepMesh_SelectorOfDataStructureOfDelaun.hxx
+BRepMesh_ShapeExplorer.cxx
+BRepMesh_ShapeExplorer.hxx
BRepMesh_ShapeTool.cxx
BRepMesh_ShapeTool.hxx
-BRepMesh_Status.hxx
-BRepMesh_Triangle.hxx
+BRepMesh_ShapeVisitor.cxx
+BRepMesh_ShapeVisitor.hxx
+BRepMesh_SphereRangeSplitter.hxx
+BRepMesh_TorusRangeSplitter.hxx
+BRepMesh_UVParamRangeSplitter.hxx
BRepMesh_Vertex.hxx
BRepMesh_VertexInspector.hxx
BRepMesh_VertexTool.cxx
BRepMesh_VertexTool.hxx
-BRepMesh_WireChecker.cxx
-BRepMesh_WireChecker.hxx
-BRepMesh_WireInterferenceChecker.cxx
-BRepMesh_WireInterferenceChecker.hxx
+BRepMesh_Triangle.hxx
if (!strcmp(dout.GetType(id),"PERS")) focal = dout.Focal(id);
Standard_Real Ang,Def;
HLRBRep::PolyHLRAngleAndDeflection(myAng,Ang,Def);
- BRepMesh_FastDiscret::Parameters aMeshParams;
+ IMeshTools_Parameters aMeshParams;
aMeshParams.Relative = Standard_True;
aMeshParams.Deflection = Def;
aMeshParams.Angle = Ang;
#include <BRepMesh_DataStructureOfDelaun.hxx>
#include <BRepMesh_Delaun.hxx>
#include <BRepMesh_Edge.hxx>
-#include <BRepMesh_FastDiscret.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
+#include <IMeshTools_Parameters.hxx>
#include <BRepMesh_Triangle.hxx>
#include <BRepMesh_Vertex.hxx>
#include <BRepTest.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <OSD_Timer.hxx>
+#include <IMeshData_Status.hxx>
#include <stdio.h>
//epa Memory leaks test
Standard_Boolean isInParallel = Standard_False;
Standard_Boolean isIntVertices = Standard_True;
Standard_Boolean isControlSurDef = Standard_True;
- Standard_Boolean isAdaptiveMin = Standard_False;
if (nbarg > 3)
{
isIntVertices = Standard_False;
else if (aOpt == "-surf_def_off")
isControlSurDef = Standard_False;
- else if (aOpt == "-adaptive")
- isAdaptiveMin = Standard_True;
else if (i < nbarg)
{
Standard_Real aVal = Draw::Atof(argv[i++]);
di << "Incremental Mesh, multi-threading "
<< (isInParallel ? "ON" : "OFF") << "\n";
- BRepMesh_FastDiscret::Parameters aMeshParams;
+ IMeshTools_Parameters aMeshParams;
aMeshParams.Deflection = aLinDeflection;
aMeshParams.Angle = aAngDeflection;
aMeshParams.Relative = isRelative;
aMeshParams.MinSize = aMinSize;
aMeshParams.InternalVerticesMode = isIntVertices;
aMeshParams.ControlSurfaceDeflection = isControlSurDef;
- aMeshParams.AdaptiveMin = isAdaptiveMin;
+ OSD_Timer aTimer;
+ aTimer.Start();
BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
+ aTimer.Stop();
+ aTimer.Show();
di << "Meshing statuses: ";
- Standard_Integer statusFlags = aMesher.GetStatusFlags();
- if( !statusFlags )
+ const Standard_Integer aStatus = aMesher.GetStatusFlags();
+ if (!aStatus)
{
di << "NoError";
}
else
{
Standard_Integer i;
- for( i = 0; i < 4; i++ )
+ for (i = 0; i < 8; i++)
{
- if( (statusFlags >> i) & (Standard_Integer)1 )
+ Standard_Integer aFlag = aStatus & (1 << i);
+ if (aFlag)
{
- switch(i+1)
+ switch ((IMeshData_Status) aFlag)
{
- case 1:
- di << "OpenWire ";
- break;
- case 2:
- di << "SelfIntersectingWire ";
- break;
- case 3:
- di << "Failure ";
- break;
- case 4:
- di << "ReMesh ";
- break;
+ case IMeshData_OpenWire:
+ di << "OpenWire ";
+ break;
+ case IMeshData_SelfIntersectingWire:
+ di << "SelfIntersectingWire ";
+ break;
+ case IMeshData_Failure:
+ di << "Failure ";
+ break;
+ case IMeshData_ReMesh:
+ di << "ReMesh ";
+ break;
+ case IMeshData_UnorientedWire:
+ di << "UnorientedWire ";
+ break;
+ case IMeshData_TooFewPoints:
+ di << "TooFewPoints ";
+ break;
+ case IMeshData_Outdated:
+ di << "Outdated ";
+ break;
+ case IMeshData_Reused:
+ di << "Reused ";
+ break;
+ case IMeshData_NoError:
+ default:
+ break;
}
}
}
const Standard_Real d = Draw::Atof(argv[2]);
- Bnd_Box B;
- BRepBndLib::Add(S,B);
- BRepMesh_FastDiscret::Parameters aParams;
+ IMeshTools_Parameters aParams;
aParams.Deflection = d;
aParams.Angle = 0.5;
- BRepMesh_FastDiscret MESH(B,aParams);
+ BRepMesh_IncrementalMesh MESH(S,aParams);
//Standard_Integer NbIterations = MESH.NbIterations();
//if (nbarg > 4) NbIterations = Draw::Atoi(argv[4]);
for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next())
aBuilder.UpdateFace(TopoDS::Face(ex.Current()),T);
- MESH.Perform(S);
+ MESH.Perform();
TopoDS_Compound aCompGood, aCompFailed, aCompViolating;
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BRepMesh_FaceAttribute.hxx>
#include <Draw_Segment3D.hxx>
#include <DrawTrSurf_Polygon3D.hxx>
#include <Draw.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Poly_Polygon3D.hxx>
+#include <BRepMesh_Edge.hxx>
+#include <BRepMesh_Vertex.hxx>
+#include <BRepMesh_Triangle.hxx>
+#include <BRepMesh_DataStructureOfDelaun.hxx>
// This file defines global functions not declared in any public header,
// intended for use from debugger prompt (Command Window in Visual Studio)
//function : MeshTest_DrawLinks
//purpose : Draw links from mesh data structure of type BRepMesh_FaceAttribute
//=======================================================================
-Standard_EXPORT const char* MeshTest_DrawLinks(const char* theNameStr, void* theFaceAttr)
+Standard_EXPORT const char* MeshTest_DrawLinks(const char* theNameStr, void* theDataStruct)
{
- if (theNameStr == 0 || theFaceAttr == 0)
+ if (theNameStr == 0 || theDataStruct == 0)
{
return "Error: name or face attribute is null";
}
try {
- const Handle(BRepMesh_FaceAttribute)& aFaceAttr = *(Handle(BRepMesh_FaceAttribute)*)theFaceAttr;
- const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData = aFaceAttr->ChangeStructure();
+ const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData = *(Handle(BRepMesh_DataStructureOfDelaun)*)theDataStruct;
if (aMeshData.IsNull())
return "Null mesh data structure";
Standard_Integer nbLinks = aMeshData->NbLinks();
Standard_Integer n2 = aLink.LastNode();
const BRepMesh_Vertex& aV1 = aMeshData->GetNode(n1);
const BRepMesh_Vertex& aV2 = aMeshData->GetNode(n2);
- const gp_Pnt& aP1 = aFaceAttr->GetPoint(aV1);
- const gp_Pnt& aP2 = aFaceAttr->GetPoint(aV2);
- Handle(Draw_Segment3D) aSeg = new Draw_Segment3D(aP1, aP2, Draw_bleu);
+ Handle(Draw_Segment3D) aSeg = new Draw_Segment3D(gp_Pnt(aV1.Coord().X(), aV1.Coord().Y(), 0),
+ gp_Pnt(aV2.Coord().X(), aV2.Coord().Y(), 0),
+ Draw_bleu);
Draw::Set((aName + "_" + i).ToCString(), aSeg);
}
return theNameStr;
//function : MeshTest_DrawTriangles
//purpose : Draw triangles from mesh data structure of type BRepMesh_FaceAttribute
//=======================================================================
-Standard_EXPORT const char* MeshTest_DrawTriangles(const char* theNameStr, void* theFaceAttr)
+Standard_EXPORT const char* MeshTest_DrawTriangles(const char* theNameStr, void* theDataStruct)
{
- if (theNameStr == 0 || theFaceAttr == 0)
+ if (theNameStr == 0 || theDataStruct == 0)
{
return "Error: name or face attribute is null";
}
try {
- const Handle(BRepMesh_FaceAttribute)& aFaceAttr =
- *(Handle(BRepMesh_FaceAttribute)*)theFaceAttr;
- const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData = aFaceAttr->ChangeStructure();
+ const Handle(BRepMesh_DataStructureOfDelaun)& aMeshData =
+ *(Handle(BRepMesh_DataStructureOfDelaun)*)theDataStruct;
+
if (aMeshData.IsNull())
return "Null mesh data structure";
Standard_Integer nbElem = aMeshData->NbElements();
const BRepMesh_Vertex& aV1 = aMeshData->GetNode(n[0]);
const BRepMesh_Vertex& aV2 = aMeshData->GetNode(n[1]);
const BRepMesh_Vertex& aV3 = aMeshData->GetNode(n[2]);
- gp_Pnt aP[4] = { aFaceAttr->GetPoint(aV1), aFaceAttr->GetPoint(aV2),
- aFaceAttr->GetPoint(aV3), aFaceAttr->GetPoint(aV1) };
+ gp_Pnt aP[4] = { gp_Pnt(aV1.Coord().X(), aV1.Coord().Y(), 0),
+ gp_Pnt(aV2.Coord().X(), aV2.Coord().Y(), 0),
+ gp_Pnt(aV3.Coord().X(), aV3.Coord().Y(), 0),
+ gp_Pnt(aV1.Coord().X(), aV1.Coord().Y(), 0) };
TColgp_Array1OfPnt aPnts(aP[0], 1, 4);
Handle(Poly_Polygon3D) aPoly = new Poly_Polygon3D(aPnts);
Handle(DrawTrSurf_Polygon3D) aDPoly = new DrawTrSurf_Polygon3D(aPoly);
#include <BRepMesh_Triangle.hxx>
#include <BRepMesh_DataStructureOfDelaun.hxx>
#include <TopExp_Explorer.hxx>
-
+#include <BRep_Tool.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MeshTest_DrawableMesh,Draw_Drawable3D)
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
+#include <IMeshTools_Parameters.hxx>
//=======================================================================
//function : OCC24
if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
// 3. Build mesh
- BRepMesh_FastDiscret::Parameters aMeshParams;
+ IMeshTools_Parameters aMeshParams;
aMeshParams.Relative = Standard_True;
aMeshParams.Deflection = 0.2;
aMeshParams.Angle = M_PI / 6;
Handle(BRepMesh_DataStructureOfDelaun) aMeshStructure = new BRepMesh_DataStructureOfDelaun(anAllocator);
Standard_Integer aPtsLower = thePoints.Lower();
Standard_Integer aPtsUpper = thePoints.Upper();
- BRepMesh::Array1OfInteger anIndexes (0, thePoints.Length() - 1);
+ IMeshData::VectorOfInteger anIndexes(aPtsUpper - aPtsLower, anAllocator);
for (Standard_Integer aPtIdx = aPtsLower; aPtIdx <= aPtsUpper; ++aPtIdx)
{
- BRepMesh_Vertex aVertex (thePoints.Value (aPtIdx).XY(), aPtIdx, BRepMesh_Frontier);
- anIndexes.ChangeValue (aPtIdx - aPtsLower) = aMeshStructure->AddNode (aVertex);
+ BRepMesh_Vertex aVertex(thePoints.Value(aPtIdx).XY(), aPtIdx, BRepMesh_Frontier);
+ anIndexes.Append(aMeshStructure->AddNode(aVertex));
}
Standard_Real aPtSum = 0;
}
BRepMesh_Delaun aTriangulation (aMeshStructure, anIndexes);
- const BRepMesh::MapOfInteger& aTriangles = aMeshStructure->ElementsOfDomain();
+ const IMeshData::MapOfInteger& aTriangles = aMeshStructure->ElementsOfDomain();
if (aTriangles.Extent() < 1)
return;
- BRepMesh::MapOfInteger::Iterator aTriangleIt (aTriangles);
+ IMeshData::IteratorOfMapOfInteger aTriangleIt (aTriangles);
for (; aTriangleIt.More(); aTriangleIt.Next())
{
const Standard_Integer aTriangleId = aTriangleIt.Key();
{
const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
- BRepMesh_FastDiscret::Parameters aMeshParams;
+ IMeshTools_Parameters aMeshParams;
aMeshParams.Relative = aRel;
aMeshParams.Angle = aDrawer->HLRAngle();
aMeshParams.Deflection = aDef;
-TKBRep
-TKMath
TKernel
-TKG2d
-TKG3d
-TKGeomBase
+TKMath
+TKBRep
TKTopAlgo
-TKGeomAlgo
-CSF_TBB
+TKShHealing
+TKGeomBase
+TKG3d
+TKG2d
+IMeshData
+IMeshTools
+BRepMeshData
BRepMesh