-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKitBridgeFunctions.h
More file actions
58 lines (39 loc) · 1.7 KB
/
Copy pathKitBridgeFunctions.h
File metadata and controls
58 lines (39 loc) · 1.7 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
#ifndef KitBridgeFunctions_h
#define KitBridgeFunctions_h
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
// MARK: - Math
/// 12 O'Clock position
extern CGFloat const ILZeroAngleRadians;
/// Converts degrees to radians
/// (angleDegrees * M_PI / 180.0)
CGFloat ILDegreesToRadians(CGFloat angleDegrees);
/// Converts radians to degrees
/// (angleRadians * 180.0 / M_PI)
CGFloat ILRadiansToDegrees(CGFloat angleRadians);
/// Convertes percentage to radians
/// (percent * M_PI * 2)
CGFloat ILPercentToRadians(CGFloat percent);
// MARK: - Geometry
/// @return the length of the vector using the Pythagorean theorem
CGFloat ILVectorLength(CGVector delta);
/// @return the angle of the vector in radians
CGFloat ILVectorRadians(CGVector delta);
/// check to see if a point is 'normal' and neither value is NaN or Infinite
BOOL ILIsNormalPoint(CGPoint point);
/// check to see if a size is 'normal' and neither value is NaN or Infinite
BOOL ILIsNormalSize(CGSize size);
/// check to see if a rect has a 'normal' origin and size and neither value is NaN or Infinite
BOOL ILIsNormalRect(CGRect rect);
/// @return the points in vector form
CGVector ILVectorFromPointToPoint(CGPoint from, CGPoint to);
/// @return the largest square centered in the provided rectangle
CGRect ILRectSquareInRect(CGRect rect);
/// @return the center point of the rect
CGPoint ILPointCenteredInRect(CGRect rect);
/// project a point the provided distance along the vector provided
CGPoint ILPointOnLineToPointAtDistance(CGPoint from, CGPoint to, CGFloat distance);
// MARK: - Foundation
/// NSString from rect in the style of NSStringFromCGRect in UIKit
NSString* ILStringFromCGRect(CGRect rect);
#endif /* KitBridgeFunctions_h */