Convenience function to make a vector out of two points.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@415 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Robert Zubeck
2008-02-14 20:49:31 +00:00
parent 05f6e9755a
commit d543a0574d
+8
View File
@@ -44,6 +44,14 @@ public class Vector2
return new Vector2(p.x, p.y);
}
/**
* Creates a new Vector2 pointing from s to t.
*/
public static function fromPoints (s :Point, t :Point) :Vector2
{
return new Vector2(t.x - s.x, t.y - s.y);
}
/**
* Creates a Vector2 of magnitude 'len' that has been rotated about the origin by 'radians'.
*/