SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
Vec3D.h
1 //
2 // Vec3D.h
3 // SFS2X
4 //
5 // Created by Lapo on 28/11/13.
6 // Copyright (c) 2013 A51 Integrated | http://a51integrated.com. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 /** The Vec3D object represents a position in a 2D or 3D space.
12 
13  This class is used to express a position inside a virtual environment with no specific unit of measure (could be pixels, feet, meters, etc).
14 
15  Positions along the X,Y,Z axes can be expressed as ints or floats. Although Objective-C can handle both ints and floats under the NSNumber class, SmartFoxServer 2X needs to recognize the specific types. For this reason we recommend to initialize the object with the proper literals to declare which type you are using.
16 
17  For instance (x:@10, y:@10, z:@10) will use integers while (x:@10F, y:@10F, z:@10F) will use the same coordinates but with a floating point type.
18 
19  Long and Doubles are not supported for this type of coordinate values.
20 
21  @see SetUserPositionRequest
22  @see MMORoom
23  @see MMOItem
24 
25  */
26 @interface Vec3D : NSObject
27 
28 /**
29  The X coordinate as Integer
30  */
31 @property (readonly) NSInteger intX;
32 
33 /**
34  The Y coordinate as Integer
35  */
36 @property (readonly) NSInteger intY;
37 
38 /**
39  The Z coordinate as Integer
40  */
41 @property (readonly) NSInteger intZ;
42 
43 /**
44  The X coordinate as Float
45  */
46 @property (readonly) NSNumber* floatX;
47 
48 /**
49  The Y coordinate as Float
50  */
51 @property (readonly) NSNumber* floatY;
52 
53 /**
54  The Z coordinate as Float
55  */
56 @property (readonly) NSNumber* floatZ;
57 
58 // Constructors
59 - (id)initWithX:(NSNumber *)x Y:(NSNumber *)y Z:(NSNumber *)z;
60 - (id)initWithX:(NSNumber *)x Y:(NSNumber *)y;
61 
62 // Static Constructors
63 
64 /** 3D Constructor
65 
66  @param x the x coordinate
67  @param y the y coordinate
68  @param z the z coordinate
69  */
70 + (id) vectorWithX:(NSNumber *)x Y:(NSNumber *)y Z:(NSNumber *)z;
71 
72 /** 2D Constructor
73 
74  @param x the x coordinate
75  @param y the y coordinate
76  */
77 + (id) vectorWithX:(NSNumber *)x Y:(NSNumber *)y;
78 
79 /** Checks if the object uses Floating point or Integer values
80  @return YES if the floats are used.
81  */
82 - (BOOL) isFloat;
83 
84 
85 // Private
86 - (NSArray *) toArray;
87 + (Vec3D *) fromArray:(NSArray*) array;
88 
89 @end
Vec3D::floatX
NSNumber * floatX
Definition: Vec3D.h:46
Vec3D::intX
NSInteger intX
Definition: Vec3D.h:31
Vec3D
Definition: Vec3D.h:26
Vec3D::intZ
NSInteger intZ
Definition: Vec3D.h:41
Vec3D::floatY
NSNumber * floatY
Definition: Vec3D.h:51
Vec3D::intY
NSInteger intY
Definition: Vec3D.h:36
Vec3D::floatZ
NSNumber * floatZ
Definition: Vec3D.h:56
-[Vec3D isFloat]
BOOL isFloat()
Definition: Vec3D.m:66