diff options
author | Colin Okay <colin@cicadas.surf> | 2022-07-18 08:45:21 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-07-18 08:45:21 -0500 |
commit | a1bfda1b34afffaf3ea757c3720bbc1762c6cd99 (patch) | |
tree | 6562eb4f0b579e941ce9d4cf798399f3f8f78d6d /src/grid-geometry.lisp | |
parent | 9c70ea0c20a61f9192e74ce537a4976e39e663d9 (diff) |
[add] bezier curve surrport
Diffstat (limited to 'src/grid-geometry.lisp')
-rw-r--r-- | src/grid-geometry.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/grid-geometry.lisp b/src/grid-geometry.lisp index 218cdf2..b23b207 100644 --- a/src/grid-geometry.lisp +++ b/src/grid-geometry.lisp @@ -99,3 +99,15 @@ top right corners of the bounding box for POLY " (loop for ,y from (- ,sy ,rad) to (+ ,sy ,rad) do (when (,comparator ,rad (round (euclidean-dist ,x ,y ,sx ,sy))) ,@body))))))) + + +(defmacro with-grid-bezier + ((x y) (control-pts &key (step 0.001)) &body body) + (with-gensyms (fn points a) + `(let* ((,points + ,control-pts) + (,fn + (apply #'bezier-lambda ,points))) + (loop for ,a from 0.0 to 1.0 by ,step + for (,x ,y) = (mapcar #'round (funcall ,fn ,a)) + do ,@body)))) |