cocos2d-x  2.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCPointExtension.h File Reference

CCPoint extensions based on Chipmunk's cpVect file. More...

#include "cocoa/CCGeometry.h"
#include <math.h>

Namespaces

 cocos2d
 

Macros

#define ccp(__X__, __Y__)   cocos2d::CCPointMake((float)(__X__), (float)(__Y__))
 Helper macro that creates a CCPoint. More...
 

Functions

float CC_DLL  (const CCPoint &v)
 Calculates distance between point an origin. More...
 
var  ( var v)
 Calculates distance between point an origin. More...
 
local  ( local v)
 Calculates distance between point an origin. More...
 
float CC_DLL  (const CCPoint &v1, const CCPoint &v2)
 Calculates the distance between two points. More...
 
var  ( var v1, var v2)
 Calculates the distance between two points. More...
 
local  ( local v1, local v2)
 Calculates the distance between two points. More...
 
CCPoint CC_DLL  (const CCPoint &v)
 Returns point multiplied to a length of 1. More...
 
CCPoint CC_DLL  (const float a)
 Converts radians to a normalized vector. More...
 
var  ( var a)
 Converts radians to a normalized vector. More...
 
local  ( local a)
 Converts radians to a normalized vector. More...
 
float CC_DLL  (const CCPoint &v)
 Converts a vector to radians. More...
 
var  ( var v)
 Converts a vector to radians. More...
 
local  ( local v)
 Converts a vector to radians. More...
 
float CC_DLL  (float value, float min_inclusive, float max_inclusive)
 Clamp a value between from and to. More...
 
local  ( local value, local min_inclusive, local max_inclusive)
 Clamp a value between from and to. More...
 
CCPoint CC_DLL  (const CCPoint &p, const CCPoint &from, const CCPoint &to)
 Clamp a point between from and to. More...
 
var  ( var p, var from, var to)
 Clamp a point between from and to. More...
 
local  ( local p, local from, local to)
 Clamp a point between from and to. More...
 
CCPoint CC_DLL  (const CCSize &s)
 Quickly convert CCSize to a CCPoint. More...
 
var  ( var s)
 Quickly convert CCSize to a CCPoint. More...
 
local  ( local s)
 Quickly convert CCSize to a CCPoint. More...
 
CCPoint CC_DLL  (const CCPoint &p, float(*opFunc)(float))
 Run a math operation function on each point component absf, fllorf, ceilf, roundf any function that has the signature: float func(float); For example: let's try to take the floor of x,y ccpCompOp(p,floorf);. More...
 
var  ( var p)
 Run a math operation function on each point component absf, fllorf, ceilf, roundf any function that has the signature: float func(float); For example: let's try to take the floor of x,y ccpCompOp(p,floorf);. More...
 
local  ( local p)
 Run a math operation function on each point component absf, fllorf, ceilf, roundf any function that has the signature: float func(float); For example: let's try to take the floor of x,y ccpCompOp(p,floorf);. More...
 
CCPoint CC_DLL  (const CCPoint &a, const CCPoint &b, float alpha)
 Linear Interpolation between two points a and b. More...
 
bool CC_DLL  (const CCPoint &a, const CCPoint &b, float variance)
var  ( var a, var b, var variance)
local  ( local a, local b, local variance)
CCPoint CC_DLL  (const CCPoint &a, const CCPoint &b)
 Multiplies a and b components, a.x*b.x, a.y*b.y. More...
 
float CC_DLL  (const CCPoint &a, const CCPoint &b)
float CC_DLL  (const CCPoint &a, const CCPoint &b)
var  ( var a, var b)
local  ( local a, local b)
CCPoint CC_DLL  (const CCPoint &v, const CCPoint &pivot, float angle)
 Rotates a point counter clockwise by the angle around a pivot. More...
 
bool CC_DLL  (const CCPoint &p1, const CCPoint &p2, const CCPoint &p3, const CCPoint &p4, float *s, float *t)
 A general line-line intersection test. More...
 
bool CC_DLL  (const CCPoint &A, const CCPoint &B, const CCPoint &C, const CCPoint &D)
CCPoint CC_DLL  (const CCPoint &A, const CCPoint &B, const CCPoint &C, const CCPoint &D)
var  ( var A, var B, var C, var D)
local  ( local A, local B, local C, local D)

Detailed Description

CCPoint extensions based on Chipmunk's cpVect file.

These extensions work both with CCPoint and cpVect.

The "ccp" prefix means: "CoCos2d Point"

Examples: