Created
July 29, 2014 05:56
-
-
Save tbrosman/9e683161ed00b6fba5aa to your computer and use it in GitHub Desktop.
scalar functors for math structures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static function genericApply<T>(shape:T, count:Int, getter:T->Int->Float, setter:T->Int->Float->Float, f:Float->Float) | |
{ | |
for (i in 0...count) | |
{ | |
setter(shape, i, f(getter(shape, i))); | |
} | |
} | |
genericApply(v, 2, Vector2.getArrayElement, Vector2.setArrayElement, Math.floor); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
T->Int->(T->Int->Float)->(T->Int->Float->Float)->(Float->Float)->Void