#include <CCGeometry.h>
Public Member Functions | |
CCPoint () | |
CCPoint () | |
CCPoint (float x, float y) | |
CCPoint ( local x, local y) | |
CCPoint (const CCPoint &other) | |
CCPoint (const CCSize &size) | |
CCPoint & | operator= (const CCPoint &other) |
CCPoint & | operator= (const CCSize &size) |
CCPoint | operator+ (const CCPoint &right) const |
CCPoint | operator- (const CCPoint &right) const |
CCPoint | operator- () const |
CCPoint | operator* (float a) const |
CCPoint | operator/ (float a) const |
void | setPoint (float x, float y) |
bool | equals (const CCPoint &target) const |
bool | fuzzyEquals (const CCPoint &target, float variance) const |
float | getLength () const |
Calculates distance between point an origin. More... | |
float | getLengthSq () const |
Calculates the square length of a CCPoint (not calling sqrt() ) More... | |
float | getDistanceSq (const CCPoint &other) const |
Calculates the square distance between two points (not calling sqrt() ) More... | |
local | getDistanceSq ( local other) |
Calculates the square distance between two points (not calling sqrt() ) More... | |
float | getDistance (const CCPoint &other) const |
Calculates the distance between two points. More... | |
float | getAngle () const |
float | getAngle (const CCPoint &other) const |
local | getAngle ( local other) |
float | dot (const CCPoint &other) const |
Calculates dot product of two points. More... | |
local | dot ( local other) |
Calculates dot product of two points. More... | |
float | cross (const CCPoint &other) const |
Calculates cross product of two points. More... | |
local | cross ( local other) |
Calculates cross product of two points. More... | |
CCPoint | getPerp () const |
Calculates perpendicular of v, rotated 90 degrees counter-clockwise – cross(v, perp(v)) >= 0. More... | |
CCPoint | getRPerp () const |
Calculates perpendicular of v, rotated 90 degrees clockwise – cross(v, rperp(v)) <= 0. More... | |
CCPoint | project (const CCPoint &other) const |
Calculates the projection of this over other. More... | |
local | project ( local other) |
Calculates the projection of this over other. More... | |
CCPoint | rotate (const CCPoint &other) const |
Complex multiplication of two points ("rotates" two points). More... | |
local | rotate ( local other) |
Complex multiplication of two points ("rotates" two points). More... | |
CCPoint | unrotate (const CCPoint &other) const |
Unrotates two points. More... | |
local | unrotate ( local other) |
Unrotates two points. More... | |
CCPoint | normalize () const |
Returns point multiplied to a length of 1. More... | |
CCPoint | lerp (const CCPoint &other, float alpha) const |
Linear Interpolation between two points a and b. More... | |
local | lerp ( local other, local alpha) |
Linear Interpolation between two points a and b. More... | |
CCPoint | rotateByAngle (const CCPoint &pivot, float angle) const |
Rotates a point counter clockwise by the angle around a pivot. More... | |
Static Public Member Functions | |
static CCPoint | forAngle (const float a) |
Public Attributes | |
float | x |
local | x |
float | y |
local | y |
CCPoint | ( | ) |
local CCPoint | ( | ) |
CCPoint | ( | float | x, |
float | y | ||
) |
local CCPoint | ( | local | x, |
local | y | ||
) |
|
inline |
Calculates cross product of two points.
|
inline |
Calculates cross product of two points.
|
inline |
Calculates dot product of two points.
|
inline |
Calculates dot product of two points.
bool equals | ( | const CCPoint & | target | ) | const |
local equals | ( | local | target | ) |
|
inlinestatic |
|
inlinestatic |
bool fuzzyEquals | ( | const CCPoint & | target, |
float | variance | ||
) | const |
|
inline |
|
inline |
float getAngle | ( | const CCPoint & | other | ) | const |
local getAngle | ( | local | other | ) |
|
inline |
Calculates the distance between two points.
|
inline |
Calculates the distance between two points.
|
inline |
Calculates the square distance between two points (not calling sqrt() )
|
inline |
Calculates the square distance between two points (not calling sqrt() )
|
inline |
Calculates distance between point an origin.
|
inline |
|
inline |
Calculates perpendicular of v, rotated 90 degrees counter-clockwise – cross(v, perp(v)) >= 0.
|
inline |
Calculates perpendicular of v, rotated 90 degrees counter-clockwise – cross(v, perp(v)) >= 0.
|
inline |
Calculates perpendicular of v, rotated 90 degrees clockwise – cross(v, rperp(v)) <= 0.
|
inline |
Calculates perpendicular of v, rotated 90 degrees clockwise – cross(v, rperp(v)) <= 0.
Linear Interpolation between two points a and b.
|
inline |
Linear Interpolation between two points a and b.
|
inline |
Returns point multiplied to a length of 1.
If the point is 0, it returns (1, 0)
|
inline |
Returns point multiplied to a length of 1.
If the point is 0, it returns (1, 0)
CCPoint operator* | ( | float | a | ) | const |
CCPoint operator- | ( | ) | const |
CCPoint operator/ | ( | float | a | ) | const |
|
inline |
Complex multiplication of two points ("rotates" two points).
|
inline |
Complex multiplication of two points ("rotates" two points).
Rotates a point counter clockwise by the angle around a pivot.
pivot | is the pivot, naturally |
angle | is the angle of rotation ccw in radians |
local rotateByAngle | ( | local | pivot, |
local | angle | ||
) |
Rotates a point counter clockwise by the angle around a pivot.
pivot | is the pivot, naturally |
angle | is the angle of rotation ccw in radians |
void setPoint | ( | float | x, |
float | y | ||
) |
Unrotates two points.
|
inline |
Unrotates two points.
float x |
local x |
float y |
local y |