-
Notifications
You must be signed in to change notification settings - Fork 37
/
PLVector3.h
executable file
·90 lines (71 loc) · 2.31 KB
/
PLVector3.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
/*
* PanoramaGL library
* Version 0.1
* Copyright (c) 2010 Javier Baez <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This class is a port from C++ to Objective-C of CVec3 class in
* "Demonstration of a line mesh intersection test (Sample1-Mesh_Line_Intersection.zip)"
* example by Jonathan Kreuzer http://www.3dkingdoms.com/weekly.
* See vec3.h.
*/
#import "PLStructs.h"
@interface PLVector3 : NSObject
{
#pragma mark -
#pragma mark member variables
@private
float x, y, z;
}
#pragma mark -
#pragma mark properties
@property(nonatomic, assign) float x,y,z;
@property(nonatomic, readonly, getter=getPosition) PLPosition position;
#pragma mark -
#pragma mark init methods
-(id)initWithVertex:(PLVertex)vertex;
-(id)initWithPosition:(PLPosition)position;
-(id)initWithX:(float)x y:(float)y z:(float)z;
-(id)initWithVector3:(PLVector3 *)vector3;
+(id)vector3;
+(id)vector3WithX:(float)x y:(float)y z:(float)z;
+(id)vector3WithVertex:(PLVertex)vertex;
+(id)vector3WithPosition:(PLPosition)position;
+(id)vector3WithVector3:(PLVector3 *)vector3;
#pragma mark -
#pragma mark property methods
-(PLPosition)getPosition;
-(void)setValuesWithX:(float)x y:(float)y z:(float)z;
-(void)setValuesWithPosition:(PLPosition)position;
-(void)setValues:(float *)values;
#pragma mark -
#pragma mark vector methods
-(BOOL)equals:(PLVector3 *)value;
-(PLVector3 *)add:(PLVector3 *)value;
-(PLVector3 *)sub:(PLVector3 *)value;
-(PLVector3 *)minus;
-(PLVector3 *)div:(PLVector3 *)value;
-(PLVector3 *)divf:(float)value;
-(PLVector3 *)mult:(PLVector3 *)value;
-(PLVector3 *)multf:(float)value;
-(float)dot:(PLVector3 *)value;
-(PLVector3 *)crossProduct:(PLVector3 *)value;
-(float)magnitude;
-(float)distance:(PLVector3 *)value;
-(void)normalize;
#pragma mark -
#pragma mark clone methods
-(PLVector3 *)clone;
@end