Looking for an explanation of post/pre/set Translate (in Matrix object) and how to use them

折月煮酒 提交于 2019-11-29 19:49:14

The set-methods will replace the current Matrix with new values, disregarding whatever the Matrix contained before. The pre and post method will apply a new transformation before or after whatever the current Matrix contains.

In this example, the rotation will be ignored since we are using the set method and the m will only contain a translation:

Matrix m = new Matrix();

m.setRotate(90);

m.setTranslate(100, 100);

In this example, the final matrix will be a translation followed by a rotation:

Matrix m = new Matrix();

m.setTranslate(100, 100);

m.postRotate(90);

In the final example, the final matrix will be a rotation followed by a translation:

Matrix m = new Matrix();

m.setTranslate(100, 100);

m.preRotate(90);

There is some more information in this (rather lengthy) post:

http://www.satyakomatineni.com/akc/display?url=displaynoteimpurl&ownerUserId=satya&reportId=2898

Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!