スレ立てるまでもない質問はここで 102匹目
■ このスレッドは過去ログ倉庫に格納されています
0653デフォルトの名無しさん
2009/12/17(木) 23:38:31を求めようとしているのですが、うまく行きません・・。処理にどこか間違いがあるのでしょうか?言語はJavaです。
class Matrix3x2
{
private static final double DegToRad = Math.PI / 180.0f;
double[][] m = new double[3][3];
public void setTransform(Vector2DF translation, Vector2DF anchorPoint, float rotation,
Vector2DF scale) {
double cosTheta = Math.cos(rotation * DegToRad);
double sinTheta = Math.sin(rotation * DegToRad);
m[0][0] = cosTheta * scale.X;
m[0][1] = sinTheta * scale.X;
m[1][0] = -sinTheta * scale.Y;
m[1][1] = cosTheta * scale.Y;
m[2][0] = cosTheta * -anchorPoint.X * scale.X
-sinTheta* -anchorPoint.Y * scale.Y + translation.X;
m[2][1] = sinTheta * -anchorPoint.X * scale.X
+cosTheta* -anchorPoint.Y * scale.Y + translation.Y;
}
public void transformVect(Vector2DF vect) {
double x = vect.X;
double y = vect.Y;
vect.X = (float) (x * m[0][0] + y * m[1][0] + 1 * m[2][0]);
vect.Y = (float) (x * m[0][1] + y * m[1][1] + 1 * m[2][1]);
}
}
■ このスレッドは過去ログ倉庫に格納されています