forked from sethpatum/iBOCA
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from DAI-Lab/sprint-3-trailsB
Sprint 3 trailsB
- Loading branch information
Showing
66 changed files
with
2,917 additions
and
270 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
I believe the original .h and .cpp files were from open source InkScape project | ||
|
||
much of it came originally from: http://sourceforge.net/projects/lib2geom/ | ||
|
||
including the clipping algorithm from: | ||
https://github.com/inkscape/inkscape/blob/master/inkscape-launchpad/src/2geom/bezier-clipping.cpp | ||
|
||
with code from http://lib2geom.sourceforge.net which is Mozilla Public License Version 1.1 | ||
|
||
|
||
|
||
bezier-utils.h Mozilla Public License Version 1.1 | ||
coord.h Mozilla Public License Version 1.1 | ||
math-utils.h Mozilla Public License Version 1.1 | ||
macros.h public domain | ||
matrix.h public domain | ||
|
||
point.h unknown | ||
rotate.h unknown | ||
transform.h unknown | ||
isnan.h GPL ?! | ||
scale.h unknown | ||
translate.h unknown | ||
|
||
|
||
|
||
bezier clipping licensed in Mozilla Public License Version 1.1 |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// ClippingBezier.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 2/12/15. | ||
// | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "DKIntersectionOfPaths.h" | ||
#import "DKUIBezierPathShape.h" | ||
#import "DKUIBezierPathClippedSegment.h" | ||
#import "UIBezierPath+Clipping.h" | ||
#import "UIBezierPath+Intersections.h" | ||
#import "UIBezierPath+GeometryExtras.h" | ||
#import "UIBezierPath+DKOSX.h" | ||
#import "UIBezierPath+Trimming.h" | ||
#import "UIBezierPath+Ahmed.h" | ||
#import "DKUIBezierPathClippedSegment.h" | ||
#import "DKUIBezierPathClippingResult.h" | ||
#import "DKUIBezierPathIntersectionPoint.h" | ||
#import "DKUIBezierUnmatchedPathIntersectionPoint.h" | ||
#import "DKUIBezierPathShape.h" | ||
#import "DKTangentAtPoint.h" | ||
#import "JRSwizzle.h" | ||
#import "DKVector.h" | ||
#import "MMBackwardCompatible.h" | ||
//#include "bezierclip.hxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// DKIntersectionOfPaths.h | ||
// BezierClip | ||
// | ||
// Created by Adam Wulf on 2/9/15. | ||
// | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface DKIntersectionOfPaths : NSObject | ||
|
||
@property (assign) BOOL doesIntersect; | ||
@property (assign) int elementNumberOfIntersection; | ||
@property (assign) float tValueOfIntersection; | ||
@property (assign) __unsafe_unretained UIBezierPath* start; | ||
@property (assign) __unsafe_unretained UIBezierPath* end; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// DKTangentAtPoint.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 11/25/13. | ||
// Copyright (c) 2013 Adam Wulf. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "DKVector.h" | ||
|
||
@interface DKTangentAtPoint : NSObject | ||
|
||
@property (nonatomic, readonly) DKVector* tangent; | ||
@property (nonatomic, readonly) CGPoint point; | ||
|
||
+(DKTangentAtPoint*) tangent:(DKVector*)tangent atPoint:(CGPoint)point; | ||
|
||
@end |
54 changes: 54 additions & 0 deletions
54
ClippingBezier.framework/Headers/DKUIBezierPathClippedSegment.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// DKUIBezierPathClippedSegment.h | ||
// LooseLeaf | ||
// | ||
// Created by Adam Wulf on 10/7/13. | ||
// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "DKUIBezierPathIntersectionPoint.h" | ||
#import "DKVector.h" | ||
|
||
/** | ||
* when chopping an unclosed path to a closed path, this | ||
* represents the segment of the original unclosed path | ||
* that is included in the output path | ||
* | ||
* one of these segments represents a segment from one | ||
* moveTo to the next | ||
*/ | ||
@interface DKUIBezierPathClippedSegment : NSObject | ||
|
||
@property (nonatomic, readonly) DKUIBezierPathIntersectionPoint* startIntersection; | ||
@property (nonatomic, readonly) DKUIBezierPathIntersectionPoint* endIntersection; | ||
@property (nonatomic, readonly) UIBezierPath* pathSegment; | ||
@property (nonatomic, readonly) UIBezierPath* fullPath; | ||
@property (nonatomic, readonly) BOOL isReversed; | ||
@property (nonatomic, readonly) DKUIBezierPathClippedSegment* reversedSegment; | ||
|
||
+(DKUIBezierPathClippedSegment*) clippedPairWithStart:(DKUIBezierPathIntersectionPoint *)_tStart | ||
andEnd:(DKUIBezierPathIntersectionPoint *)_tEnd | ||
andPathSegment:(UIBezierPath *)segment | ||
fromFullPath:(UIBezierPath*)_fullPath; | ||
|
||
// | ||
// returns YES if the input segment could connect to the | ||
// end of this segment | ||
-(BOOL) canBePrependedTo:(DKUIBezierPathClippedSegment*)otherPath; | ||
|
||
-(DKUIBezierPathClippedSegment*) prependTo:(DKUIBezierPathClippedSegment*)otherSegment; | ||
|
||
-(DKUIBezierPathClippedSegment*) reversedSegment; | ||
|
||
-(DKUIBezierPathClippedSegment*) flippedRedBlueSegment; | ||
|
||
-(CGFloat) angleBetween:(DKUIBezierPathClippedSegment*)otherInter; | ||
|
||
-(DKVector*) endVector; | ||
|
||
-(DKVector*) startVector; | ||
|
||
-(BOOL) isEqualToSegment:(DKUIBezierPathClippedSegment*)otherSegment; | ||
|
||
@end |
37 changes: 37 additions & 0 deletions
37
ClippingBezier.framework/Headers/DKUIBezierPathClippingResult.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// DKUIBezierPathClippingResult.h | ||
// LooseLeaf | ||
// | ||
// Created by Adam Wulf on 10/7/13. | ||
// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
/** | ||
* when clipping an unclosed path to a closed path, | ||
* this object will hold the output of the intersection | ||
* and difference path, as well as the segment information | ||
* for the original path. | ||
* | ||
* the segment information will say exactly where and when | ||
* each original segment was chopped | ||
*/ | ||
@interface DKUIBezierPathClippingResult : NSObject | ||
|
||
@property (nonatomic, readonly) UIBezierPath* entireIntersectionPath; | ||
@property (nonatomic, readonly) UIBezierPath* entireDifferencePath; | ||
@property (nonatomic, readonly) NSArray* intersectionSegments; | ||
@property (nonatomic, readonly) NSArray* differenceSegments; | ||
@property (nonatomic, readonly) NSUInteger numberOfShellIntersectionSegments; | ||
@property (nonatomic, readonly) NSUInteger numberOfShellDifferenceSegments; | ||
|
||
-(id) initWithIntersection:(UIBezierPath*)_intersection | ||
andSegments:(NSArray*)_intersectionSegments | ||
andDifference:(UIBezierPath*)_difference | ||
andSegments:(NSArray*)_differenceSegments | ||
andShellIntSegments:(NSUInteger)_numberOfShellIntersectionSegments | ||
andShellDiffSegments:(NSUInteger)_numberOfShellDifferenceSegments; | ||
|
||
@end |
53 changes: 53 additions & 0 deletions
53
ClippingBezier.framework/Headers/DKUIBezierPathIntersectionPoint.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// DKUIBezierPathIntersectionPoint.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 9/11/13. | ||
// Copyright (c) 2013 Milestone Made LLC. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface DKUIBezierPathIntersectionPoint : NSObject | ||
|
||
@property (readonly) NSInteger elementIndex1; | ||
@property (readonly) NSInteger elementCount1; | ||
@property (readonly) CGFloat tValue1; | ||
@property (readonly) NSInteger elementIndex2; | ||
@property (readonly) NSInteger elementCount2; | ||
@property (readonly) CGFloat tValue2; | ||
@property (readonly) CGPoint* bez1; | ||
@property (readonly) CGPoint* bez2; | ||
// the distance from the start of path1 that we find this intersection | ||
@property (readonly) CGFloat lenAtInter1; | ||
// the distance from the start of path2 that we find this intersection | ||
@property (readonly) CGFloat lenAtInter2; | ||
// the length of the entire path1, along which this intersection lies | ||
@property (assign) CGFloat pathLength1; | ||
// the length of the entire path2, along which this intersection lies | ||
@property (assign) CGFloat pathLength2; | ||
// | ||
// this signals that a segment with this intersection as the boundary | ||
// might cross from outside to inside the closed shape | ||
// this is only a hint, and should be verified by the segment | ||
@property (readonly) BOOL mayCrossBoundary; | ||
|
||
+(id) intersectionAtElementIndex:(NSInteger)index1 andTValue:(CGFloat)tValue1 withElementIndex:(NSInteger)index2 andTValue:(CGFloat)tValue2 andElementCount1:(NSInteger)elementCount1 andElementCount2:(NSInteger)elementCount2 andLengthUntilPath1Loc:(CGFloat)len1 andLengthUntilPath2Loc:(CGFloat)len2; | ||
|
||
-(DKUIBezierPathIntersectionPoint*) flipped; | ||
|
||
-(CGPoint) location1; | ||
-(CGPoint) location2; | ||
|
||
-(BOOL) matchesElementEndpointWithIntersection:(DKUIBezierPathIntersectionPoint*)obj; | ||
|
||
// will return YES if the input intersection's tvalue2 matches | ||
// my tvalue 1, or vice versa | ||
-(BOOL) crossMatchesIntersection:(DKUIBezierPathIntersectionPoint*)otherInter; | ||
|
||
-(BOOL) isEqualToIntersection:(id)object; | ||
|
||
-(BOOL) isCloseToIntersection:(DKUIBezierPathIntersectionPoint*)otherIntersection withPrecision:(CGFloat)precision; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// DKUIBezierPathShape.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 11/18/13. | ||
// Copyright (c) 2013 Adam Wulf. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "DKUIBezierPathIntersectionPoint.h" | ||
|
||
@class DKUIBezierPathClippedSegment, DKUIBezierPathShape; | ||
|
||
@interface DKUIBezierPathShape : NSObject{ | ||
NSMutableArray* segments; | ||
NSMutableArray* holes; | ||
} | ||
|
||
@property (nonatomic, readonly) NSMutableArray<DKUIBezierPathClippedSegment*>* segments; | ||
@property (nonatomic, readonly) NSMutableArray<DKUIBezierPathShape*>* holes; | ||
|
||
-(DKUIBezierPathIntersectionPoint*) startingPoint; | ||
-(DKUIBezierPathIntersectionPoint*) endingPoint; | ||
-(BOOL) isClosed; | ||
-(UIBezierPath*) fullPath; | ||
|
||
-(BOOL) isSameShapeAs:(DKUIBezierPathShape*)otherShape; | ||
|
||
-(BOOL) sharesSegmentWith:(DKUIBezierPathShape*)otherShape; | ||
|
||
@end |
15 changes: 15 additions & 0 deletions
15
ClippingBezier.framework/Headers/DKUIBezierUnmatchedPathIntersectionPoint.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// DKUIBezierUnmatchedPathIntersectionPoint.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 12/30/13. | ||
// Copyright (c) 2013 Adam Wulf. All rights reserved. | ||
// | ||
|
||
#import "DKUIBezierPathIntersectionPoint.h" | ||
|
||
@interface DKUIBezierUnmatchedPathIntersectionPoint : DKUIBezierPathIntersectionPoint | ||
|
||
@property (readonly) NSUInteger uniqueUnmatchedIntersectionId; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// MMVector.h | ||
// ClippingBezier | ||
// | ||
// Created by Adam Wulf on 7/11/13. | ||
// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface DKVector : NSObject | ||
|
||
@property (nonatomic) CGFloat x; | ||
@property (nonatomic) CGFloat y; | ||
|
||
+(instancetype) vectorWithPoint:(CGPoint)p1 andPoint:(CGPoint)p2; | ||
|
||
+(instancetype) vectorWithX:(CGFloat)x andY:(CGFloat)y; | ||
|
||
+(instancetype) vectorWithAngle:(CGFloat)angle; | ||
|
||
-(instancetype) initWithPoint:(CGPoint)p1 andPoint:(CGPoint)p2; | ||
|
||
-(instancetype) initWithX:(CGFloat)x andY:(CGFloat)y; | ||
|
||
-(DKVector*) normal; | ||
|
||
-(DKVector*) perpendicular; | ||
|
||
-(DKVector*) flip; | ||
|
||
-(CGFloat) magnitude; | ||
|
||
-(CGFloat) angle; | ||
|
||
-(CGPoint) pointFromPoint:(CGPoint)point distance:(CGFloat)distance; | ||
|
||
-(DKVector*) averageWith:(DKVector*)vector; | ||
|
||
-(DKVector*) rotateBy:(CGFloat)angle; | ||
|
||
-(DKVector*) mirrorAround:(DKVector*)normal; | ||
|
||
-(CGPoint) mirrorPoint:(CGPoint)point aroundPoint:(CGPoint)startPoint; | ||
|
||
-(CGFloat) angleBetween:(DKVector*)otherVector; | ||
|
||
-(CGPoint) asCGPoint; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// JRSwizzle.h semver:1.0 | ||
// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com | ||
// Some rights reserved: http://opensource.org/licenses/MIT | ||
// https://github.com/rentzsch/jrswizzle | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSObject (JRSwizzle) | ||
|
||
+ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; | ||
+ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// MMBackwardCompatible.h | ||
// LooseLeaf | ||
// | ||
// Created by Adam Wulf on 8/7/13. | ||
// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSObject (MMBackwardCompatible) | ||
|
||
+ (BOOL)mm_defineMethod:(SEL)origSel withMethod:(SEL)altSel error:(NSError**)error; | ||
|
||
+ (BOOL)mm_defineOrSwizzleMethod:(SEL)origSel withMethod:(SEL)altSel error:(NSError**)error; | ||
|
||
@end |
Oops, something went wrong.