AffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty)
{
AffineTransform t;
t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty;
return t;
}
Vec2 __CCPointApplyAffineTransform(const Vec2& point, const AffineTransform& t)
{
Vec2 p;
p.x = (float)((double)t.a * point.x + (double)t.c * point.y + t.tx);
p.y = (float)((double)t.b * point.x + (double)t.d * point.y + t.ty);
return p;
}
Vec2 PointApplyTransform(const Vec2& point, const Mat4& transform)
{
Vec3 vec(point.x, point.y, 0);
transform.transformPoint(&vec);
return Vec2(vec.x, vec.y);
}
Size __CCSizeApplyAffineTransform(const Size& size, const AffineTransform& t)
{
Size s;
s.width = (float)((double)t.a * size.width + (double)t.c * size.height);
s.height = (float)((double)t.b * size.width + (double)t.d * size.height);
return s;
}
AffineTransform AffineTransformMakeIdentity()
{
cocos2dx 仿射变换
最新推荐文章于 2020-11-16 16:20:48 发布
AffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty){ AffineTransform t; t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty; return t;}Vec2 _...
摘要由CSDN通过智能技术生成