diff options
-rw-r--r-- | chickadee/math/vector.scm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chickadee/math/vector.scm b/chickadee/math/vector.scm index 4206206..e2720c6 100644 --- a/chickadee/math/vector.scm +++ b/chickadee/math/vector.scm @@ -142,10 +142,11 @@ (vec3-set! v 1 y) (vec3-set! v 2 z))) -(define-inlinable (vec2/polar r theta) +(define-inlinable (vec2/polar origin r theta) "Return a new vec2 containing the Cartesian representation of the -polar coordinate (R, THETA)." - (vec2 (* r (cos theta)) (* r (sin theta)))) +polar coordinate (R, THETA) with an arbitrary ORIGIN point." + (vec2 (+ (vec2-x origin) (* r (cos theta))) + (+ (vec2-y origin) (* r (sin theta))))) (define-inlinable (vec2-x v) "Return the x coordinate of the vec2 V." |