Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
i'm having trouble working out the returned values of the below code pMeasure = PathMeasure, m = Matrix, distCount is the distance along the path
pMeasure.getMatrix(distCount, m, 0x01 | 0x02);
m.getValues(float[] values)
float[2] & float[5] are position x & y respectively but i can't figure out the rest
any help once again appreciated.
–
–
a,b,c,d encode scale & rotation at the same time. tx/ty encode translation. If you do m.getValues(vals); then vals[2] == tx, vals[5] == ty, and the rest is straight forward. The best way to extract translation is to make a vector
float[] point = {0, 0};
Then map it and see where it ends up and that's your translation (which is exactly (tx, ty). Under rare circumstances its not
to get scale map a second point
float[] point2 = {1, 0};
Now take the difference rel = (point - point2) and get the length of that vector and that's your scale. To extract rotation, normalize rel and it's simple to get it's standard angle.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.