axmol/tools/tolua++/CCGeometry.pkg

64 lines
2.1 KiB
Plaintext
Raw Normal View History

2011-06-14 14:31:25 +08:00
2013-02-25 10:22:03 +08:00
class CCPoint
2011-06-14 14:31:25 +08:00
{
2012-02-02 14:26:38 +08:00
float x;
float y;
CCPoint();
CCPoint(float x, float y);
CCPoint(const CCSize& size);
CCPoint operator-(const CCPoint& right) const;
CCPoint operator+(const CCPoint& right) const;
CCPoint operator*(float a) const;
CCPoint getMidpoint(const CCPoint& other) const;
float dot(const CCPoint& other) const;
float cross(const CCPoint& other) const;
CCPoint getPerp() const;
CCPoint getRPerp() const;
CCPoint project(const CCPoint& other) const;
CCPoint rotate(const CCPoint& other) const;
CCPoint unrotate(const CCPoint& other) const;
float getLengthSq() const;
float getLength() const;
float getDistance(const CCPoint& other) const;
CCPoint normalize() const;
float getAngle() const;
CCPoint getClampPoint(const CCPoint& min_inclusive, const CCPoint& max_inclusive) const;
CCPoint lerp(const CCPoint& other, float alpha) const;
bool fuzzyEquals(const CCPoint& target, float variance) const;
CCPoint rotateByAngle(const CCPoint& pivot, float angle) const;
2012-02-02 14:26:38 +08:00
bool equals(const CCPoint & target) const ;
static bool isLineIntersect(const CCPoint& A, const CCPoint& B,const CCPoint& C, const CCPoint& D,float* S, float* T);
static bool isSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
static CCPoint getIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
static CCPoint forAngle(const float a);
2011-06-14 14:31:25 +08:00
};
2013-02-25 10:22:03 +08:00
class CCSize
2011-06-14 14:31:25 +08:00
{
2012-02-02 14:26:38 +08:00
float width;
float height;
CCSize();
CCSize(float width, float height);
2011-06-14 14:31:25 +08:00
bool equals(const CCSize & target) const;
2011-06-14 14:31:25 +08:00
};
2013-02-25 10:22:03 +08:00
class CCRect
2011-06-14 14:31:25 +08:00
{
2012-02-02 14:26:38 +08:00
CCPoint origin;
CCSize size;
CCRect();
CCRect(float x, float y, float width, float height);
float getMinX();
float getMidX();
float getMaxX();
float getMinY();
float getMidY();
float getMaxY();
bool equals(const CCRect & rect) const;
bool containsPoint(const CCPoint & point) const;
bool intersectsRect(const CCRect & rect) const;
2011-06-14 14:31:25 +08:00
};