forked from natikgadzhi/XNMaths
-
Notifications
You must be signed in to change notification settings - Fork 1
/
XNSurfaceData.h
96 lines (70 loc) · 2.46 KB
/
XNSurfaceData.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
//
// XNSurfaceData.h
// XNMaths
//
// Created by Нат Гаджибалаев on 01.12.09.
// Copyright 2009 Нат Гаджибалаев. All rights reserved.
//
#pragma mark -
#pragma mark Imports
//
// Use Cocoa framework
#import <Cocoa/Cocoa.h>
//
// Use our point structures
#import "XN2DPoint.h"
#import "XN3DPoint.h"
//
// Consider these classes
@class XNFloatRange;
@class XNFunctionOf2D;
#pragma mark -
#pragma mark XNSurfaceData class inteface
@interface XNSurfaceData : NSObject {
// Store line datapoints to render it really fast.
CGFloat *xData, *yData, **zData;
// Value ranges
XNFloatRange *xRange, *yRange, *zRange;
// quality is an recalculation points count per one real unit. quality is used when surfacing from function.
// count is how many points are actually crated and should be used in other operations.
NSUInteger quality, xPointsCount, yPointsCount;
BOOL isDirty;
}
@property(readonly) CGFloat *xData, *yData;
@property(readonly) CGFloat **zData;
@property(readonly) XNFloatRange *xRange, *yRange, *zRange;
@property(readonly) NSUInteger xPointsCount, yPointsCount;
@property(readonly) BOOL isDirty;
#pragma mark -
#pragma mark Class init methods
//
// Build surface with function in rect
// TODO: Write tests
+ (XNSurfaceData *) surfaceWithFunction: (XNFunctionOf2D*) aFunction
xRange: (XNFloatRange*) aXRange
yRange: (XNFloatRange*) aYRange
withQuality: (NSUInteger) lineQuality;
+ (XNSurfaceData *) surfaceWithCapacityX: (NSInteger) newXCapacity Y: (NSInteger) newYCapacity;
#pragma mark -
#pragma mark Instance init methods
// TODO: write tests
- (XNSurfaceData *) initWithFunction: (XNFunctionOf2D*) aFunction
xRange: (XNFloatRange*) aXRange
yRange: (XNFloatRange*) aYRange
withQuality: (NSUInteger) lineQuality;
- (XNSurfaceData *) initWithCapacityX: (NSInteger) newXCapacity Y: (NSInteger) newYCapacity;
#pragma mark -
#pragma mark Instance logic methods
//
// Setters
- (void) set3DPoint: (XN3DPoint) point atI: (NSUInteger) i J: (NSUInteger) j dirty: (BOOL) dirty;
- (void) setValue: (CGFloat) value atI: (NSUInteger) i J: (NSUInteger) j dirty: (BOOL) dirty;
- (void) setArguments2DPoint: (XN2DPoint) point atI: (NSUInteger) i J: (NSUInteger) j dirty: (BOOL) dirty;
//
// Getters
- (CGFloat) valueAtI: (NSUInteger) i J: (NSUInteger) j;
- (XN3DPoint) pointAtI: (NSUInteger) i J: (NSUInteger) j;
//
// Cleanup after set method calls with dirty = YES
- (void) cleanupRanges;
@end