-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//-------------------------------------------------------------------------------------
// type of Branch end point
enum BranchEndType { BE_UNDEF,
- BE_ON_VERTEX, // branch ends at a convex VRTEX
+ BE_ON_VERTEX, // branch ends at a convex VERTEX
BE_BRANCH_POINT, // branch meats 2 or more other branches
BE_END // branch end equidistant from several adjacent segments
};
std::size_t _iEdge; // MA edge index within the branch
double _edgeParam; // normalized param within the MA edge
- BranchPoint(): _branch(0), _iEdge(0), _edgeParam(-1) {}
+ BranchPoint( const Branch* b = 0, std::size_t e = 0, double u = -1 ):
+ _branch(b), _iEdge(e), _edgeParam(u) {}
};
//-------------------------------------------------------------------------------------
/*!
* \brief Branch is a set of MA edges enclosed between branch points and/or MA ends.
* It's main feature is to return two BoundaryPoint's per a point on it.
+ * Points on a Branch are defined by [0,1] parameter
*/
class SMESHUtils_EXPORT Branch
{
std::vector< std::size_t >& edgeIDs2,
std::vector< BranchPoint >& divPoints) const;
- // construction
- void init( std::vector<const TVDEdge*>& maEdges,
- const Boundary* boundary,
- std::map< const TVDVertex*, BranchEndType > endType);
+ bool isRemoved() const { return _proxyPoint._branch; }
+
+ public: // internal: construction
+
+ void init( std::vector<const TVDEdge*>& maEdges,
+ const Boundary* boundary,
+ std::map< const TVDVertex*, BranchEndType >& endType);
void setBranchesToEnds( const std::vector< Branch >& branches);
+ BranchPoint getPoint( const TVDVertex* vertex ) const;
+ void setRemoved( const BranchPoint& proxyPoint );
- static void setGeomEdge( std::size_t geomIndex, const TVDEdge* maEdge );
- static std::size_t getGeomEdge( const TVDEdge* maEdge );
- static void setBndSegment( std::size_t segIndex, const TVDEdge* maEdge );
+ static void setGeomEdge ( std::size_t geomIndex, const TVDEdge* maEdge );
+ static std::size_t getGeomEdge ( const TVDEdge* maEdge );
+ static void setBndSegment( std::size_t segIndex, const TVDEdge* maEdge );
static std::size_t getBndSegment( const TVDEdge* maEdge );
private:
std::vector< BranchPoint >& divPoints,
const std::vector<const TVDEdge*>& maEdges,
const std::vector<const TVDEdge*>& maEdgesTwin,
- size_t & i) const;
+ int & i) const;
// association of _maEdges with boundary segments is stored in this way:
// index of an EDGE: TVDEdge->cell()->color()
const Boundary* _boundary; // face boundary
BranchEnd _endPoint1;
BranchEnd _endPoint2;
+ BranchPoint _proxyPoint;
};
//-------------------------------------------------------------------------------------
bool getBranchPoint( const std::size_t iEdge, double u, BranchPoint& p ) const;
- bool IsConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
+ bool getBranchPoint( const BoundaryPoint& bp, BranchPoint& p ) const;
+
+ bool isConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
+
+ bool moveToClosestEdgeEnd( BoundaryPoint& bp ) const;
private:
std::vector< BndPoints > _pointsPerEdge;
const std::vector< TopoDS_Edge >& edges,
const double minSegLen,
const bool ignoreCorners = false );
- const Boundary& getBoundary() const { return _boundary; }
- const std::vector< Branch >& getBranches() const { return _branch; }
+ std::size_t nbBranches() const { return _nbBranches; }
+ const Branch* getBranch(size_t i) const;
const std::vector< const BranchEnd* >& getBranchPoints() const { return _branchPnt; }
+ const Boundary& getBoundary() const { return _boundary; }
- void getPoints( const Branch& branch, std::vector< gp_XY >& points) const;
+ void getPoints( const Branch* branch, std::vector< gp_XY >& points) const;
Adaptor3d_Curve* make3DCurve(const Branch& branch) const;
private:
TopoDS_Face _face;
TVD _vd;
std::vector< Branch > _branch;
+ std::size_t _nbBranches; // removed branches ignored
std::vector< const BranchEnd* > _branchPnt;
Boundary _boundary;
double _scale[2];