-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector.h
More file actions
32 lines (27 loc) · 797 Bytes
/
Copy pathvector.h
File metadata and controls
32 lines (27 loc) · 797 Bytes
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
#ifndef vector_h
#define vector_h
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#import <JavaScriptCore/JavaScriptCore.h>
@class jsVector;
@protocol VectorJSExport <JSExport, NSCopying>
@property (nonatomic) float x;
@property (nonatomic) float y;
@property (nonatomic, readonly) float length;
@property (nonatomic, readonly) float angle;
+(id) vectorWithX: (float) x Y:(float) y;
+(id) vectorWithMag: (float) mag angle:(float) ang;
-(jsVector *) add: (jsVector*) b;
-(jsVector *) sub: (jsVector*) b;
-(jsVector *) unit;
-(jsVector *) dotProduct: (jsVector*) b;
-(jsVector *) crossProduct: (jsVector*) b;
@end
@interface jsVector: NSObject <VectorJSExport>{
float _x,_y;
}
- (id) initWithX: (float) x Y: (float) y;
- (id) copyWithZone: (NSZone *) zone;
@end
#endif