diff options
Diffstat (limited to 'sly/math/vector.scm')
-rw-r--r-- | sly/math/vector.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sly/math/vector.scm b/sly/math/vector.scm index bd556ea..cc03e4e 100644 --- a/sly/math/vector.scm +++ b/sly/math/vector.scm @@ -31,6 +31,7 @@ <vector4> vector2 vector3 vector4 vector2? vector3? vector4? + polar2 vx vy vz vw vmap v+ v- v* vdot vcross magnitude normalize vlerp) @@ -79,6 +80,12 @@ (define vw vector4-w) +(define (polar2 r theta) + "Create a new 2D vector from the polar coordinate (R, THETA) where R +is the radius and THETA is the angle." + (vector2 (* r (cos theta)) + (* r (sin theta)))) + (define (vmap proc v) "Return a new vector that is the result of applying PROC to each element of the 2D/3D/4D vector V." |