24 #ifndef AECSLICERBASEIMPL_H_INCLUDED
25 #define AECSLICERBASEIMPL_H_INCLUDED
47 template<
typename _Tv>
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"));
250 double mergeLineParam;
253 SegmentPoint(): mergeLineParam(0.0), ownerSegmentId(0)
259 ownerSegmentId = segmentId;
262 inline bool operator < (
const SegmentPoint& segPoint )
const
264 return mergeLineParam < segPoint.mergeLineParam;
269 struct SegmentPointLess
271 inline bool operator() (
const SegmentPoint& pt1,
const SegmentPoint& pt2 )
const
273 return pt1.mergeLineParam < pt2.mergeLineParam;
289 m_segmentsIdBase = 0;
294 OdUInt32 segmentId = MakeSegmentId();
296 m_segmentPoints.
push_back(SegmentPoint(ptStart, segmentId));
297 m_segmentPoints.
push_back(SegmentPoint(ptEnd, segmentId));
302 if(m_segmentPoints.
empty())
306 CheckIsAllSegmentsOnMergeLine(mergeLine,
tol);
309 CalculatePointsParamAlongMergeLine(mergeLine,
tol);
311 MergeSegments(pGraph,
tol);
316 m_segmentPoints.
clear();
317 m_segmentsIdBase = 0;
318 m_inSegments.
clear();
319 m_segmentTags.
clear();
325 return (m_segmentsIdBase++);
331 for(
OdUInt32 iPoint = 0; iPoint < m_segmentPoints.
size(); iPoint++)
333 const SegmentPoint& point = m_segmentPoints[iPoint];
344 for(
OdUInt32 iPoint = 0; iPoint < pointsCount; iPoint++)
346 SegmentPoint& point = m_segmentPoints[iPoint];
347 point.mergeLineParam = mergeLine.
paramOf(point.pt,
tol);
351 void SortSegmentPointsAlongMergeLine()
353 std::sort( m_segmentPoints.
begin(), m_segmentPoints.
end(), SegmentPointLess() );
358 bool IsOnSegment()
const
360 return (!m_inSegments.
empty());
374 void UpdateInSegmentsArray(
OdUInt32 currentPtSegmentId)
376 if(!m_inSegments.
contains(currentPtSegmentId))
378 m_inSegments.
append(currentPtSegmentId);
382 m_inSegments.
remove(currentPtSegmentId);
477 bool bUseReverseEdgeAtMerge,
546 void DebugDrawIntersections()
const;
#define ODA_ASSERT_ONCE(exp)
bool operator<(const OdString &s1, const OdString &s2)
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)
void AddFaceEdgesAsSegmentsToEdgeGraph()
cycled_list< VertexInPlanePosition > VtxInPlanePosCycledList
IntersectionArray m_intersections
Intersection * m_pEndIntPt
void collect_segments(const Face *pFace)
void initPointExtraction()
bool IsIntersectionOnVertex(VtxInPlanePosCycledList::iterator &itVtx)
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
void CollectEdgeForEdgeGraph(const OdGePoint3d &ptStart, const OdGePoint3d &ptEnd, const Edge *tag=0)
FaceConstPtrArray m_coinciding
void build_results(Profile2D *pResInclBndry, Profile2D *pResExclCoBndry, Profile2D *pResExclOpBndry, Profile2D *pResExclBndry, FaceConstPtrArray *pCoincidingFaces, FaceConstPtrArray *pOppositeFaces, bool bUseReverseEdgeAtMerge, OdArray< const Edge * > *sourceEdges=0)
SegmentMerger m_segmentsMerger
void FindIntersectionSegmentsWithCutPlane()
IntersResult IntersectCutPlaneToCurrentFacePlane(double tol)
const OdGePlane & cut_plane() const
void AddIntersectionFromVertex(const VertexInPlanePosition &vtxData)
VtxInPlanePosCycledList::iterator FindOnSegmentEndVertex(VtxInPlanePosCycledList::iterator &itBase)
void set_cut_plane(const OdGePlane &cutPlane)
SlicerBaseImpl::Intersection * FindNextDifferentIntersection(SlicerBaseImpl::Intersection *pIntBase)
const OdGeTol & tolerance() const
void ClearFaceIntersectionsData()
const OdGePlane & current_face_plane() const
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 CollectSegmentsOnIntersectionLine()
SlicerBaseImpl::Intersection * FindIntersectionEnterInside()
bool IsIntersectionOnEdge(VtxInPlanePosCycledList::iterator &itVtx)
const Face * m_pCurrentFace
void ClassifyLoopVertices(Edge *pFirstLoopEdge)
void MergePairedIntersections()
OdGeVector3d m_cutPlane_normal
void ExtractSegmentsByIntersections()
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)
const OdGePoint3d & VertexPoint(const VtxInPlanePosCycledList::iterator &itVtx) const
bool extractSegment(const OdGePoint3d *&pStart, const OdGePoint3d *&pEnd, bool &bInside)
SlicerBaseImpl::VertexHalfPlaneSign ClassifyPointAboutIntersectionLine(const OdGePoint3d &ptToClassify)
void AddIntersection(const OdGePoint3d &ptIntersection, const Edge *pEdge, int bOnIntersectionSeg=0)
const OdGePlane * m_pCutPlane
void CollectIntersections()
OdArray< Intersection, OdMemoryAllocator< Intersection > > IntersectionArray
OdGeLine3d m_intersectionLine
void push_back(const T &value)
void reserve(size_type reserveLength)
bool contains(const T &value, size_type start=0) const
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
const _Tv & next_node_data()
bool operator!=(const iterator &it) const
const _Tv & prev_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
bool operator<(const Intersection &intersection2) const
bool operator()(const Intersection &intersection1, const Intersection &intersection2) const
VertexHalfPlaneSign halfPlane