-
Notifications
You must be signed in to change notification settings - Fork 17
/
MPWRealArray.h
108 lines (79 loc) · 2.91 KB
/
MPWRealArray.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//
// MPWRealArray.h
//
// An array optimized for storing C 'float'
// numbers, but with a foundation compatible
// interface (NSArray).
/*
Copyright (c) 2001-2017 by Marcel Weiher. All rights reserved.
R
*/
//--- inheritance chain
#import <MPWFoundation/MPWObject.h>
@interface MPWRealArray : MPWObject
{
NSUInteger capacity;
NSUInteger count;
float *floatStart;
}
//--- NSArray compatible
+arrayWithArray:otherArray;
+arrayWithArray:otherArray count:(NSUInteger)count;
+arrayWithArray:otherArray start:(NSUInteger)start count:(NSUInteger)count;
+arrayWithCapacity:(NSUInteger)capacity;
+arrayWithCount:(NSUInteger)newCount;
+arrayWithString:aPropertyList;
+arrayWithReals:(float*)realNums count:(NSUInteger)newCount;
-initWithArray:otherArray;
-initWithArray:otherArray count:(NSUInteger)count;
-initWithArray:otherArray start:(NSUInteger)start count:(NSUInteger)count;
-initWithRealArray:otherArray start:(NSUInteger)start count:(NSUInteger)newCount;
-initWithCapacity:(NSUInteger)capacity;
-initWithCount:(NSUInteger)newCount;
-initWithReals:(float*)realNums count:(NSUInteger)newCount;
-(id)initWithStart:(float)start end:(float)end step:(float)step;
#if 0
-(id)initWithVecStart:(float)start end:(float)end step:(float)step;
#endif
-(NSUInteger)count;
-(void)clear;
-(void)setCapacity:(long)newCapacity;
-(BOOL)isEqual:otherObject;
-(BOOL)matchesStart:otherObject;
-(void)reverse;
-(void)insertValue:(float)aValue betweenEachElementStartingAt:(int)start;
-(void)insertEven:(float)insertValue;
-(void)insertOdd:(float)insertValue;
-objectAtIndex:(NSUInteger)index;
-(void)replaceObjectAtIndex:(NSUInteger)index withObject:newObject;
-(void)addObject:anObject;
//--- faster access to underlying representation
-(void)getReals:(float*)reals length:(long)max;
-(float*)reals;
-(float)realAtIndex:(NSUInteger)index;
-(void)replaceRealAtIndex:(NSUInteger)index withReal:(float)newValue;
-(void)replaceRealsAtIndex:(NSUInteger)index withReals:(float*)newReals count:(NSUInteger)realCount;
-(void)addReal:(float)newValue;
-(void)addReals:(float*)newReals count:(NSUInteger)realCount;
-(void)appendArray:anArray;
-(float)vec_reduce_sum;
-reduce_operator_plus;
-(float)reduce:(float(*)(float,float))reduceFun;
//--- transforming coordinates
-(NSPoint)transform:(NSPoint)original;
-(NSPoint)transformPoint:(NSPoint)original;
-transformPoints:(NSPoint*)original :(unsigned)count;
-(NSSize)dtransform:(NSSize)original;
-(NSSize)transformSize:(NSSize)original;
-(NSPoint)relativeTransformPoint:(NSPoint)originalPoint;
-dtransformPoints:(NSPoint*)original :(unsigned)pointCount;
-(instancetype)transformByMatrix:(MPWRealArray*)matrix;
//--- some computation
-interpolate:otherVector into:targetVector weight:(float)weight;
-interpolate:otherVector weight:(float)weight;
-interpolate:otherVector steps:(int)numSteps;
//-- coding etc
- (void)encodeWithCoder:(NSCoder *)coder;
- (id)initWithCoder:(NSCoder *)coder;
-(void)appendContents:aByteStream;
@end