johnmccutchan/vector_math — pull request #21 by laszlokorte (2013-07-06 15:13:56+00:00)
Title: method to rotate a Vector2 by 90 degrees (ccw) and scale the result

I have worked on using vector_math in dart-box2d (https://github.com/dart-lang/dart-box2d/pull/17).

Some of the vector and matrix functions box2d uses are not available in this library. One of them is building a vector which is orthogonal to a a given one (and scale it).

This commit adds such a method to Vector2.

I am not quite sure if the scale parameter is really needed because the result could also be scaled afterwards. On the other hand a negative scale can be used to change the rotation to be clockwise.