From 55ad89e92a9796979d6f075afba74a6076f45d6d Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 18 Jul 2022 09:07:05 -0500 Subject: [doc] docstring on with-grid-bezier --- examples/11-canvas-geometry.lisp | 2 +- src/grid-geometry.lisp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/examples/11-canvas-geometry.lisp b/examples/11-canvas-geometry.lisp index 325cbe4..7103663 100644 --- a/examples/11-canvas-geometry.lisp +++ b/examples/11-canvas-geometry.lisp @@ -61,7 +61,7 @@ (200 300) (0 400) (40 250)))) - (ww::with-grid-bezier (x y) (control-points :step 0.001) + (ww::with-grid-bezier (x y) (control-points :count 80) (ww::with-grid-rect (rx ry) ((- x 2) (- y 2) (+ x 2) (+ y 2)) (ww::with-pixel (r g b a) (ww::pixel canvas rx ry) (setf g 255))))) diff --git a/src/grid-geometry.lisp b/src/grid-geometry.lisp index b23b207..c046032 100644 --- a/src/grid-geometry.lisp +++ b/src/grid-geometry.lisp @@ -102,9 +102,19 @@ top right corners of the bounding box for POLY " (defmacro with-grid-bezier - ((x y) (control-pts &key (step 0.001)) &body body) - (with-gensyms (fn points a) - `(let* ((,points + ((x y) (control-pts &key (count 1000)) &body body) + "CONTROL-POINTS is an expression that evalueates to a list of (X Y) +pairs, these are the control points for the curve.. COUNT is the +number of points on the bezier curve that will be calclated. The first +point is always the first control point and the last point is always +the last control point. Use high counts for smooth curves, as needed. + +Evaluates the BODY with X Y bound to a point on the bezier curve. +" + (with-gensyms (fn points a step) + `(let* ((,step + (/ 1.0 ,count)) + (,points ,control-pts) (,fn (apply #'bezier-lambda ,points))) -- cgit v1.2.3