How can I transform a Point2f with a matrix on Android?

Posted by Vivendi on Game Development See other posts from Game Development or by Vivendi
Published on 2014-06-09T11:14:49Z Indexed on 2014/06/09 15:43 UTC
Read the original article Hit count: 309

Filed under:
|
|

I'm developing for Android and I'm using the android.renderscript.Matrix3f class to do some calculations.

What I need to do now is to now is to do something like mat.tranform(pointIn, pointOut);

So I need to transform a matrix by a given Point class. In awt I would simply do this:

AffineTransform t = new AffineTransform();
Point2D.Float p = new Point2D.Float();
t.transform( p, p );

But in Android I now have this:

Matrix3f t = new Matrix3f();
PointF p = new PointF();
// Now I need to tranform it somehow..

But the Matrix3f class in Android doesn't have a Matrix.transform(Point2D ptSrc, Point2D ptDst) method.

So I guess I have to do the transformation manually. But I'm not really sure how that works. From what I've seen it's something like a translate and then a rotate?

Could anyone please tell me how to do this in code?

© Game Development or respective owner

Related posts about android

Related posts about matrix