SPPoint Class Reference
| Inherits from | SPPoolObject : NSObject |
| Conforms to | NSCopying |
| Declared in | SPPoint.h |
Tasks
Initialization
-
– initWithX:y:Initializes a point with its x and y components. Designated Initializer.
-
– initWithPolarLength:angle:Initializes a point with the distance and angle in respect to the origin.
-
+ pointWithPolarLength:angle:Factory method.
-
+ pointWithX:y:Factory method.
-
+ pointFactory method.
Methods
-
– addPoint:Adds a point to the current point and returns the resulting point.
-
– subtractPoint:Substracts a point from the current point and returns the resulting point.
-
– scaleBy:Scales the point by a certain factor and returns the resulting point.
-
– rotateBy:Rotates the point by the given angle (in radians, CCW) and returns the resulting point.
-
– normalizeReturns a point that has the same direction but a length of one.
-
– invertReturns a point that is the inverse (negation) of this point.
-
– perpendicularReturns a perpendicular vector.
-
– truncateLength:Returns a point truncated to length.
-
– dot:Returns the dot-product of self and the given point.
-
– isEqualToPoint:Compares two points.
-
– copyFromPoint:Copies the values from another point into the current point.
-
– setX:y:Sets the members of the point to the specified values.
-
– convertToGLKVectorCreates a GLKit vector that is equivalent to this instance.
-
+ distanceFromPoint:toPoint:Calculates the distance between two points.
-
+ angleBetweenPoint:andPoint:Calculates the angle between two points.
-
+ interpolateFromPoint:toPoint:ratio:Determines a point between two specified points.
ratio = 0 -> p1, ratio = 1 -> p2
Properties
-
xThe x-Coordinate of the point.
property -
yThe y-Coordinate of the point.
property -
lengthThe distance to the origin (or the length of the vector).
property -
lengthSquaredThe squared distance to the origin (or the squared length of the vector)
property -
angleThe angle between the positive x-axis and the point (in radians, CCW).
property -
isOriginReturns true if this point is in the origin (x and y equal zero).
property
Properties
angle
The angle between the positive x-axis and the point (in radians, CCW).
@property (readonly) float angleDiscussion
The angle between the positive x-axis and the point (in radians, CCW).
Declared In
SPPoint.hisOrigin
Returns true if this point is in the origin (x and y equal zero).
@property (readonly) BOOL isOriginDiscussion
Returns true if this point is in the origin (x and y equal zero).
Declared In
SPPoint.hlength
The distance to the origin (or the length of the vector).
@property (readonly) float lengthDiscussion
The distance to the origin (or the length of the vector).
Declared In
SPPoint.hlengthSquared
The squared distance to the origin (or the squared length of the vector)
@property (readonly) float lengthSquaredDiscussion
The squared distance to the origin (or the squared length of the vector)
Declared In
SPPoint.hClass Methods
angleBetweenPoint:andPoint:
Calculates the angle between two points.
+ (float)angleBetweenPoint:(SPPoint *)p1 andPoint:(SPPoint *)p2Discussion
Calculates the angle between two points.
Declared In
SPPoint.hdistanceFromPoint:toPoint:
Calculates the distance between two points.
+ (float)distanceFromPoint:(SPPoint *)p1 toPoint:(SPPoint *)p2Discussion
Calculates the distance between two points.
Declared In
SPPoint.hinterpolateFromPoint:toPoint:ratio:
Determines a point between two specified points. ratio = 0 -> p1, ratio = 1 -> p2
+ (SPPoint *)interpolateFromPoint:(SPPoint *)p1 toPoint:(SPPoint *)p2 ratio:(float)ratioDiscussion
Determines a point between two specified points. ratio = 0 -> p1, ratio = 1 -> p2
Declared In
SPPoint.hInstance Methods
addPoint:
Adds a point to the current point and returns the resulting point.
- (SPPoint *)addPoint:(SPPoint *)pointDiscussion
Adds a point to the current point and returns the resulting point.
Declared In
SPPoint.hconvertToGLKVector
Creates a GLKit vector that is equivalent to this instance.
- (GLKVector2)convertToGLKVectorDiscussion
Creates a GLKit vector that is equivalent to this instance.
Declared In
SPPoint.hcopyFromPoint:
Copies the values from another point into the current point.
- (void)copyFromPoint:(SPPoint *)pointDiscussion
Copies the values from another point into the current point.
Declared In
SPPoint.hdot:
Returns the dot-product of self and the given point.
- (float)dot:(SPPoint *)otherDiscussion
Returns the dot-product of self and the given point.
Declared In
SPPoint.hinitWithPolarLength:angle:
Initializes a point with the distance and angle in respect to the origin.
- (instancetype)initWithPolarLength:(float)length angle:(float)angleDiscussion
Initializes a point with the distance and angle in respect to the origin.
Declared In
SPPoint.hinitWithX:y:
Initializes a point with its x and y components. Designated Initializer.
- (instancetype)initWithX:(float)x y:(float)yDiscussion
Initializes a point with its x and y components. Designated Initializer.
Declared In
SPPoint.hinvert
Returns a point that is the inverse (negation) of this point.
- (SPPoint *)invertDiscussion
Returns a point that is the inverse (negation) of this point.
Declared In
SPPoint.hisEqualToPoint:
Compares two points.
- (BOOL)isEqualToPoint:(SPPoint *)otherDiscussion
Compares two points.
Declared In
SPPoint.hnormalize
Returns a point that has the same direction but a length of one.
- (SPPoint *)normalizeDiscussion
Returns a point that has the same direction but a length of one.
Declared In
SPPoint.hperpendicular
Returns a perpendicular vector.
- (SPPoint *)perpendicularDiscussion
Returns a perpendicular vector.
Declared In
SPPoint.hrotateBy:
Rotates the point by the given angle (in radians, CCW) and returns the resulting point.
- (SPPoint *)rotateBy:(float)angleDiscussion
Rotates the point by the given angle (in radians, CCW) and returns the resulting point.
Declared In
SPPoint.hscaleBy:
Scales the point by a certain factor and returns the resulting point.
- (SPPoint *)scaleBy:(float)scalarDiscussion
Scales the point by a certain factor and returns the resulting point.
Declared In
SPPoint.hsetX:y:
Sets the members of the point to the specified values.
- (void)setX:(float)x y:(float)yDiscussion
Sets the members of the point to the specified values.
Declared In
SPPoint.h