aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/grid-geometry.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-18 08:45:21 -0500
committerColin Okay <colin@cicadas.surf>2022-07-18 08:45:21 -0500
commita1bfda1b34afffaf3ea757c3720bbc1762c6cd99 (patch)
tree6562eb4f0b579e941ce9d4cf798399f3f8f78d6d /src/grid-geometry.lisp
parent9c70ea0c20a61f9192e74ce537a4976e39e663d9 (diff)
[add] bezier curve surrport
Diffstat (limited to 'src/grid-geometry.lisp')
-rw-r--r--src/grid-geometry.lisp12
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))))