24#ifndef AECSLICERBASEIMPL_H_INCLUDED
25#define AECSLICERBASEIMPL_H_INCLUDED
50 template<
typename _Td>
64 typedef _Node<_Tv> Node;
78 m_pCurrentNode = pNode;
84 m_pCurrentNode = it.m_pCurrentNode;
89 m_pCurrentNode = m_pCurrentNode->pNext;
94 m_pCurrentNode = m_pCurrentNode->pPrev;
99 return m_pCurrentNode == it.m_pCurrentNode;
104 return m_pCurrentNode != it.m_pCurrentNode;
109 return m_pCurrentNode->data;
114 return m_pCurrentNode->data;
119 return m_pCurrentNode->pNext->data;
124 return m_pCurrentNode->pPrev->data;
129 return m_pCurrentNode->data;
134 return iterator(m_pCurrentNode->pNext);
152 return m_iNodeCount == 0;
158 if(m_pFirstNode == NULL)
161 Node* pDeleteNode = m_pFirstNode->pNext;
162 while(pDeleteNode != m_pFirstNode)
164 pDeleteNode = pDeleteNode->pNext;
165 delete pDeleteNode->pPrev;
181 Node* pNewNode =
new Node();
182 pNewNode->data =
value;
184 if(m_pFirstNode == NULL)
186 m_pFirstNode = pNewNode;
187 pNewNode->pPrev = m_pFirstNode;
188 pNewNode->pNext = m_pFirstNode;
192 Node* pLastNode = m_pFirstNode->pPrev;
194 pLastNode->pNext = pNewNode;
195 m_pFirstNode->pPrev = pNewNode;
197 pNewNode->pPrev = pLastNode;
198 pNewNode->pNext = m_pFirstNode;
204 throw OdError(
OD_T(
"delete_range() parameters equal"));
206 Node* pBeginNode = beg.m_pCurrentNode;
207 Node* pEndNode = end.m_pCurrentNode;
209 if(pBeginNode->pNext == pEndNode)
214 Node* pCurrentNode = pEndNode->pPrev;
218 if(pCurrentNode == m_pFirstNode)
219 m_pFirstNode = pBeginNode;
221 pCurrentNode = pCurrentNode->pPrev;
222 delete pCurrentNode->pNext;
224 while (pCurrentNode != pBeginNode);
226 pEndNode->pPrev = pBeginNode;
227 pBeginNode->pNext = pEndNode;
233 throw OdError(
OD_T(
"begin() cannot create iterator for empty cycled list"));
269 double mergeLineParam;
272 SegmentPoint(): mergeLineParam(0.0), ownerSegmentId(0)
278 ownerSegmentId = segmentId;
281 inline bool operator < (
const SegmentPoint& segPoint )
const
283 return mergeLineParam < segPoint.mergeLineParam;
289 using SegmentPointsArray = std::vector< SegmentPoint >;
292 struct SegmentPointLess
294 inline bool operator() (
const SegmentPoint& pt1,
const SegmentPoint& pt2 )
const
296 return pt1.mergeLineParam < pt2.mergeLineParam;
301 SegmentPointsArray m_segmentPoints;
317 m_segmentsIdBase = 0;
322 OdUInt32 segmentId = MakeSegmentId();
330 m_segmentPoints.emplace_back( ptStart, segmentId );
331 m_segmentPoints.emplace_back( ptEnd, segmentId );
338 if (m_segmentPoints.empty())
342 CheckIsAllSegmentsOnMergeLine(mergeLine,
tol);
345 CalculatePointsParamAlongMergeLine(mergeLine,
tol);
347 MergeSegments(face_edges,
tol);
353 if(m_segmentPoints.empty())
357 CheckIsAllSegmentsOnMergeLine(mergeLine,
tol);
360 CalculatePointsParamAlongMergeLine(mergeLine,
tol);
362 MergeSegments(pGraph,
tol);
367 m_segmentPoints.clear();
368 m_segmentsIdBase = 0;
369 m_inSegments.
clear();
370 m_segmentTags.
clear();
376 return (m_segmentsIdBase++);
382 for(
OdUInt32 iPoint = 0; iPoint < m_segmentPoints.size(); iPoint++)
384 const SegmentPoint& point = m_segmentPoints[iPoint];
394 const OdUInt32 pointsCount = m_segmentPoints.size();
395 for(
OdUInt32 iPoint = 0; iPoint < pointsCount; iPoint++)
397 SegmentPoint& point = m_segmentPoints[iPoint];
398 point.mergeLineParam = mergeLine.
paramOf(point.pt,
tol);
402 void SortSegmentPointsAlongMergeLine()
404 std::sort( m_segmentPoints.begin(), m_segmentPoints.end(), SegmentPointLess() );
410 bool IsOnSegment()
const
412 return (!m_inSegments.
empty());
426 void UpdateInSegmentsArray(
OdUInt32 currentPtSegmentId)
428 if(!m_inSegments.
contains(currentPtSegmentId))
430 m_inSegments.
append(currentPtSegmentId);
434 m_inSegments.
remove(currentPtSegmentId);
557 bool bUseReverseEdgeAtMerge,
650 void DebugDrawIntersections()
const;
#define ODA_ASSERT_ONCE(exp)
void MergeSegmentsAndCollectGraphEdges(const OdGeLine3d &mergeLine, SlicerBaseImpl *pGraph, const OdGeTol &tol, OdArray< GraphEdgeData > &face_edges)
void PushSegment(const OdGePoint3d &ptStart, const OdGePoint3d &ptEnd, const Edge *tag=0)
void MergeSegmentsAndAddToEdgeGraph(const OdGeLine3d &mergeLine, SlicerBaseImpl *pGraph, const OdGeTol &tol)
FaceConstPtrArray m_opposite
void MergeSegmentsAndAddToEdgeGraph()
Intersection * m_pCurIntPt
VtxInPlanePosCycledList::iterator FindOnSegmentStartVertex(VtxInPlanePosCycledList::iterator &itBase)
void AddIntersectionFromEdge(const VertexInPlanePosition &vtxData)
OdArray< RayFaceIntersection > m_rayFaceInters
const OdGeTol & tolerance() const
void AddFaceEdgesAsSegmentsToEdgeGraph()
cycled_list< VertexInPlanePosition > VtxInPlanePosCycledList
IntersectionArray m_intersections
std::map< const Edge *, VertexInPlanePosition > m_collectedIntersectionFromVertex
Intersection * m_pEndIntPt
const OdGePlane & current_face_plane() const
void initPointExtraction()
bool IsIntersectionOnVertex(VtxInPlanePosCycledList::iterator &itVtx)
SlicerBaseImpl::VertexHalfPlaneSign ClassifyPointAboutIntersectionLine(const OdGePoint3d &ptToClassify, bool exact=false)
void reserveBuffers(size_t nFaces)
void setTolerance(const OdGeTol &tol)
void exclude_opposite_faces(Profile2D &excludedProfile, FaceConstPtrArray &excludeFaces, OdArray< const Edge * > *pSourceEdges=NULL)
VtxInPlanePosCycledList m_classifiedVertices
SlicerBaseImpl::Intersection * FindNextDifferentIntersection(SlicerBaseImpl::Intersection *pIntBase)
SlicerBaseImpl::Intersection * FindIntersectionEnterInside()
void CollectEdgeForEdgeGraph(const OdGePoint3d &ptStart, const OdGePoint3d &ptEnd, const Edge *tag=0)
void AddScaledBoxContour(const OdGeExtents2d &bbox)
FaceConstPtrArray m_coinciding
SegmentMerger m_segmentsMerger
std::map< const Edge *, OdGePoint3d > m_collectedIntersectionPts
void FindIntersectionSegmentsWithCutPlane()
const OdGePlane & cut_plane() const
IntersResult IntersectCutPlaneToCurrentFacePlane(double tol)
void AddIntersectionFromVertex(const VertexInPlanePosition &vtxData)
VtxInPlanePosCycledList::iterator FindOnSegmentEndVertex(VtxInPlanePosCycledList::iterator &itBase)
void MergeSegmentsAndCollectGraphEdges(OdArray< GraphEdgeData > &face_edges)
void set_cut_plane(const OdGePlane &cutPlane)
bool CloseByBox(const OdGeExtents2d &bbox, const OdGeExtents2d &origBBox, bool &checkFaceByRay)
const FaceConstPtrArray & getCoinciding() const
void ClearFaceIntersectionsData()
std::list< const Face * > m_collectedFaces
bool ExtractSegmentFromVertex(VtxInPlanePosCycledList::iterator &itBase)
void exclude_faces(Profile2D &excludedProfile, FaceConstPtrArray &excludeFaces, OdArray< const Edge * > *pSourceEdges=NULL)
bool VertexOnIntersectionLine(const VtxInPlanePosCycledList::iterator &itVtx) const
void checkFaceByRay(const Face *pFace)
void CollectSegmentsOnIntersectionLine()
SegmentMerger * m_pCurSegMerger
void collect_all_segments()
bool IsIntersectionOnEdge(VtxInPlanePosCycledList::iterator &itVtx)
const FaceConstPtrArray & getOpposite() const
const Face * m_pCurrentFace
void ClassifyLoopVertices(Edge *pFirstLoopEdge)
void MergePairedIntersections()
OdGeVector3d m_cutPlane_normal
void ExtractSegmentsByIntersections()
void build_profiles(Profile2D *pResInclBndry, Profile2D *pResExclCoBndry, Profile2D *pResExclOpBndry, Profile2D *pResExclBndry, FaceConstPtrArray *pCoincidingFaces, FaceConstPtrArray *pOppositeFaces, OdArray< const Edge * > *sourceEdges, const OdGeExtents2d *pBox)
IntersResult IntersectCutPlaneToFacePlane(const Face *f) const
bool IntersectionsCoincident(const SlicerBaseImpl::Intersection *pInt1, const SlicerBaseImpl::Intersection *pInt2)
void AddEdgeToGraph(const OdGePoint3d &ptStart, const OdGePoint3d &ptEnd, const Edge *tag=0)
void build_results(Profile2D *pResInclBndry, Profile2D *pResExclCoBndry, Profile2D *pResExclOpBndry, Profile2D *pResExclBndry, FaceConstPtrArray *pCoincidingFaces, FaceConstPtrArray *pOppositeFaces, bool bUseReverseEdgeAtMerge, bool &checkFaceByRay, OdArray< const Edge * > *sourceEdges=0, const OdGeExtents2d *pIncBox=0, const OdGeExtents2d *pOrigBox=0)
bool extractSegment(const OdGePoint3d *&pStart, const OdGePoint3d *&pEnd, bool &bInside)
const OdGePoint3d & VertexPoint(const VtxInPlanePosCycledList::iterator &itVtx) const
void AddIntersection(const OdGePoint3d &ptIntersection, const Edge *pEdge, int bOnIntersectionSeg=0)
const OdGePlane * m_pCutPlane
void CollectIntersections()
void collect_face(const Face *pFace)
OdArray< Intersection, OdMemoryAllocator< Intersection > > IntersectionArray
OdGeLine3d m_intersectionLine
bool contains(const ConstForPtrT &value, size_type start=0) const
void push_back(const T &value)
size_type append(const T &value)
bool remove(const T &value, size_type start=0)
double paramOf(const OdGePoint3d &point, const OdGeTol &tol=OdGeContext::gTol) const
bool isOn(const OdGePlane &plane, const OdGeTol &tol=OdGeContext::gTol) const
bool isEqualTo(const OdGePoint3d &point, const OdGeTol &tol=OdGeContext::gTol) const
iterator(const iterator &it)
bool operator==(const iterator &it) const
bool operator!=(const iterator &it) const
const _Tv & prev_node_data()
const _Tv & next_node_data()
void delete_range(const iterator &beg, const iterator &end)
void push_back(const _Tv &value)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
GLsizei const GLfloat * value
GraphEdgeData(const OdGePoint3d &_st, const OdGePoint3d &_end, const Edge *_pEdge)
bool operator<(const Intersection &intersection2) const
bool operator()(const Intersection &intersection1, const Intersection &intersection2) const
RayFaceIntersection(const OdGePoint3d &intPt, const Face *pFace)
VertexHalfPlaneSign halfPlane