【发布时间】:2015-11-28 07:53:58
【问题描述】:
我正在尝试基于 iOS 代码在 Android 中仿射旋转矩阵
iOS有两个函数CGAffineTransformMakeRotation和CGPointApplyAffineTransform用于计算
Step 1: CGAffineTransformMakeRotation();
Input:
2.2860321998596191
Result:
a = -0.65579550461444569,
b = 0.75493857771840255,
c = -0.75493857771840255,
d = -0.65579550461444569,
tx = 0, ty = 0
Formula:
double A = Math.cos(RadiansRotated);
double B = -Math.sin(RadiansRotated);
double C = Math.sin(RadiansRotated);
double D = Math.cos(RadiansRotated);
我可以使用上面的公式计算第 1 步的 a,b,c,d
Step 2: CGPointApplyAffineTransform()
Input :
x = 612.55191924649432,
y = -391.95960729287646
And Matrix return from Step 1
Result:
x = -105.80336653205421,
y = 719.48442314773808
有人知道 ApplyAffineTransform 中使用的公式吗?
我需要第 2 步的帮助
我尝试过使用 Android 的 Matrix 类 - 不工作
我也尝试过使用 Java 的 AffineTransform - 不工作
【问题讨论】:
标签: ios math quartz-graphics quartz-2d affinetransform