Added rotate to Vector APIs.

This commit is contained in:
Nick Winter 2014-07-13 17:25:17 -07:00
parent 2a5a366c12
commit f92b29a4a3

View file

@ -2,13 +2,13 @@
class Vector
@className: 'Vector'
# Class methods for nondestructively operating
for name in ['add', 'subtract', 'multiply', 'divide', 'limit', 'normalize']
for name in ['add', 'subtract', 'multiply', 'divide', 'limit', 'normalize', 'rotate']
do (name) ->
Vector[name] = (a, b, useZ) ->
a.copy()[name](b, useZ)
isVector: true
apiProperties: ['x', 'y', 'z', 'magnitude', 'heading', 'distance', 'dot', 'equals', 'copy', 'distanceSquared']
apiProperties: ['x', 'y', 'z', 'magnitude', 'heading', 'distance', 'dot', 'equals', 'copy', 'distanceSquared', 'rotate']
constructor: (@x=0, @y=0, @z=0) ->