-
Notifications
You must be signed in to change notification settings - Fork 2
/
Path.h
76 lines (52 loc) · 1.64 KB
/
Path.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// Path.h
// An Objective-C wrapper for the Path object from the Clipper library
// (http://sourceforge.net/projects/polyclipping/)
//
// Created by John Swensen on 3/18/14.
// Copyright (c) 2014 John Swensen. All rights reserved.
//
// License:
// Use, modification & distribution is subject to Boost Software License Ver 1.
// http://www.boost.org/LICENSE_1_0.txt
//
#import <Foundation/Foundation.h>
#import "clipper.hpp"
//
//#define kClipperScale 100000.0f
//#define kClipperScale 10000000.0f
#define kClipperScale 1000000000.0f
#define kDefaultCleanDistance 1.415
@class Paths;
@interface Path : NSObject
{
ClipperLib::Path _path;
}
@property (atomic,assign) ClipperLib::Path path;
- (Path*) initWithPath:(ClipperLib::Path)path;
- (ClipperLib::Path*) pathPtr;
- (Path*) initWithPolygon:(NSMutableArray*)poly;
- (unsigned long) count;
- (CGPoint) pointAtIndex:(unsigned long)idx;
- (CGPoint) lastPoint;
- (void) addPoint:(CGPoint)pnt;
- (void) addIntPoint:(ClipperLib::IntPoint)pnt;
- (void) insertPoint:(CGPoint)pnt atIndex:(int)idx;
- (float) area;
- (Paths*) simplifyPolygon;
- (Paths*) simplifyPolygonWithFillType:(ClipperLib::PolyFillType)type;
- (void) reversePath;
- (int) pointInPolygon:(CGPoint)pt;
- (int) intPointInPolygon:(ClipperLib::IntPoint)pt;
- (BOOL) orientation;
- (Paths*) minkowskiSumWithPattern:(Path*)pattern pathIsClosed:(BOOL)pathIsClosed;
- (Paths*) minkowskiDiffWithPoly:(Path*)poly2;
- (Path*) cleanPolygon;
- (void) cleanSelf;
- (Path*) cleanPolygonWithDistance:(double)distance;
- (void) cleanSelfWithDistance:(double)distance;
#ifdef HAVE_POLY2TRI
- (Paths*) triangulate;
#endif
- (void) print;
@end