From a1bfda1b34afffaf3ea757c3720bbc1762c6cd99 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 18 Jul 2022 08:45:21 -0500 Subject: [add] bezier curve surrport --- src/grid-geometry.lisp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/grid-geometry.lisp') 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)))) -- cgit v1.2.3