-
-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathIntersectNode.cpp
More file actions
58 lines (49 loc) · 3.17 KB
/
IntersectNode.cpp
File metadata and controls
58 lines (49 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
* *
* Author : Angus Johnson *
* Version : 5.1.6 *
* Date : 23 May 2013 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2013 *
* *
* License: *
* Use, modification & distribution is subject to Boost Software License Ver 1.*
* http://www.boost.org/LICENSE_1_0.txt *
* *
* Attributions: *
* The code in this library is an extension of Bala Vatti's clipping algorithm:*
* "A generic solution to polygon clipping" *
* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *
* http://portal.acm.org/citation.cfm?id=129906 *
* *
* Computer graphics and geometric modeling: implementation and algorithms *
* By Max K. Agoston *
* Springer; 1 edition (January 4, 2005) *
* http://books.google.com/books?q=vatti+clipping+agoston *
* *
* See also: *
* "Polygon Offsetting by Computing Winding Numbers" *
* Paper no. DETC2005-85513 pp. 565-575 *
* ASME 2005 International Design Engineering Technical Conferences *
* and Computers and Information in Engineering Conference (IDETC/CIE2005) *
* September 24-28, 2005, Long Beach, California, USA *
* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *
* *
* This is a translation of the Delphi Clipper library and the naming style *
* used has retained a Delphi flavour. *
******************************************************************************/
#include "IntersectNode.h"
using namespace ClipperLib;
void IntersectNode::Swap(IntersectNode &int2) {
// just swap the contents (because fIntersectNodes is a single-linked-list)
IntersectNode inode = *this; // gets a copy of Int1
edge1 = int2.edge1;
edge2 = int2.edge2;
pt = int2.pt;
int2.edge1 = inode.edge1;
int2.edge2 = inode.edge2;
int2.pt = inode.pt;
}
bool IntersectNode::EdgesAdjacent() const {
return edge1->nextInSEL == edge2 || edge1->prevInSEL == edge2;
}