4f1a10f25245

Update to latest cl-losh
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 09 Jun 2019 11:27:41 -0400
parents 91c04aa41ac5
children 4b63cff9f912
branches/tags (none)
files flax.asd package.lisp src/colors.lisp src/drawing/api.lisp src/drawing/plot.lisp src/drawing/png.lisp src/drawing/svg.lisp src/looms/001-triangles.lisp src/looms/002-wobbly-lines.lisp src/looms/004-turtle-curves.lisp src/looms/007-stippling.lisp src/package.lisp

Changes

--- a/flax.asd	Wed Mar 27 19:59:02 2019 -0400
+++ b/flax.asd	Sun Jun 09 11:27:41 2019 -0400
@@ -26,10 +26,10 @@
                  (:file "quickutils")
                  (:module "lofi-tri"
                   :components ((:file "lofi.tri")))))
-   (:file "package")
    (:module "src" :serial t
     :components
-    ((:file "base")
+    ((:file "package")
+     (:file "base")
      (:file "colors")
      (:file "transform")
      (:module "drawing" :serial t
--- a/package.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-(defpackage :flax.base
-  (:use :cl :iterate :losh :flax.quickutils
-        :3d-vectors
-        :3d-matrices)
-  (:export
-    :rand
-    :with-seed
-    :random-or
-    :randomly-initialize
-    :round-to))
-
-(defpackage :flax.colors
-  (:use :cl :iterate :losh :flax.base :flax.quickutils)
-  (:export
-    :color
-    :with-color
-    :hsv
-    :rgb))
-
-(defpackage :flax.transform
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :3d-vectors
-    :3d-matrices)
-  (:export
-    :transformation
-    :scale
-    :rotate
-    :translate
-    :ntransform))
-
-(defpackage :flax.drawing
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :flax.transform
-    :3d-vectors
-    :3d-matrices)
-  (:export
-    :with-rendering
-    :render
-    :fade
-    :triangle
-    :path
-    :points
-    :rectangle
-    :point
-    :circle
-    :text))
-
-
-(defpackage :flax.looms.001-triangles
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :3d-vectors)
-  (:export :loom))
-
-(defpackage :flax.looms.002-wobbly-lines
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :3d-vectors)
-  (:export :loom))
-
-(defpackage :flax.looms.003-basic-l-systems
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :3d-vectors)
-  (:export :loom))
-
-(defpackage :flax.looms.004-turtle-curves
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :flax.transform
-    :3d-vectors)
-  (:export :loom))
-
-(defpackage :flax.looms.005-simple-triangulations
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :3d-vectors)
-  (:export :loom))
-
-(defpackage :flax.looms.006-tracing-lines
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :3d-vectors)
- (:export :loom))
-
-(defpackage :flax.looms.007-stipple
-  (:use :cl :iterate :losh :flax.base :flax.quickutils
-    :flax.colors
-    :3d-vectors)
-  (:export :loom))
-
-
--- a/src/colors.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/colors.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -11,7 +11,7 @@
   (g 0.0d0 :type color-float)
   (b 0.0d0 :type color-float))
 
-(define-with-macro (color :conc-name "") r g b)
+(define-with-macro color r g b)
 
 (defun rgb (r g b)
   (make-color (coerce r 'double-float)
--- a/src/drawing/api.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/drawing/api.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -6,7 +6,7 @@
 
 
 ;;;; Canvas -------------------------------------------------------------------
-(defclass* (canvas :conc-name "") ()
+(defclass* canvas ()
   ((width :type (integer 0))
    (height :type (integer 0))
    (padding :type (single-float 0.0 0.5) :initform 0.03)
@@ -28,7 +28,7 @@
 (defmethod initialize-instance :after ((canvas canvas) &key)
   (recompute-output-transformation canvas))
 
-(define-with-macro (canvas :conc-name "") width height)
+(define-with-macro canvas width height)
 
 (defgeneric make-canvas (type &key &allow-other-keys))
 
@@ -73,7 +73,7 @@
 
 
 ;;;; Drawables ----------------------------------------------------------------
-(defclass* (drawable :conc-name "") ()
+(defclass* drawable ()
   ((opacity :type (double-float 0.0d0 1.0d0))
    (color :type color)))
 
@@ -81,7 +81,7 @@
 
 
 ;;;; Paths --------------------------------------------------------------------
-(defclass* (path :conc-name "") (drawable)
+(defclass* path (drawable)
   ((points :type list)))
 
 (defun path (points &key (opacity 1.0d0) (color *black*))
@@ -102,7 +102,7 @@
 
 
 ;;;; Triangles ----------------------------------------------------------------
-(defclass* (triangle :conc-name "") (drawable)
+(defclass* triangle (drawable)
   ((a :type vec3)
    (b :type vec3)
    (c :type vec3)))
@@ -130,7 +130,7 @@
 
 
 ;;;; Rectangles ---------------------------------------------------------------
-(defclass* (rectangle :conc-name "") (drawable)
+(defclass* rectangle (drawable)
   ((a :type vec3)
    (b :type vec3)
    (round-corners :type float :initform 0.0)))
@@ -165,7 +165,7 @@
 
 
 ;;;; Circles ------------------------------------------------------------------
-(defclass* (circle :conc-name "") (drawable)
+(defclass* circle (drawable)
   ((center :type vec3)
    (radius :type single-float)))
 
@@ -188,7 +188,7 @@
 
 
 ;;;; Points -------------------------------------------------------------------
-(defclass* (point :conc-name "") (drawable)
+(defclass* point (drawable)
   ((location :type vec3)))
 
 (defun point (location &key (opacity 1.0d0) (color *black*))
@@ -208,7 +208,7 @@
 
 
 ;;;; Text ---------------------------------------------------------------------
-(defclass* (text :conc-name "") (drawable)
+(defclass* text (drawable)
   ((pos :type vec3)
    (font :type string)
    (size :type single-float)
--- a/src/drawing/plot.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/drawing/plot.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -4,7 +4,7 @@
 ;;; TODO: shell out to svgsort automatically?
 
 
-(defclass* (plot-canvas :conc-name "") (svg-canvas) ())
+(defclass* plot-canvas (svg-canvas) ())
 
 (defmethod make-canvas ((type (eql :plot)) &key height width)
   (let ((scene (svg:make-svg-toplevel 'svg:svg-1.1-toplevel
--- a/src/drawing/png.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/drawing/png.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -43,7 +43,7 @@
 
 
 ;;;; Canvas -------------------------------------------------------------------
-(defclass* (png-canvas :conc-name "") (canvas)
+(defclass* png-canvas (canvas)
   (image state))
 
 (defmethod make-canvas ((type (eql :png)) &key height width background)
--- a/src/drawing/svg.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/drawing/svg.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -10,7 +10,7 @@
 
 
 ;;;; Canvas -------------------------------------------------------------------
-(defclass* (svg-canvas :conc-name "") (canvas)
+(defclass* svg-canvas (canvas)
   (scene))
 
 (defmethod make-canvas ((type (eql :svg)) &key height width background)
--- a/src/looms/001-triangles.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/looms/001-triangles.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -11,12 +11,12 @@
 
 
 ;;;; Elements -----------------------------------------------------------------
-(defstruct (triangle (:conc-name ""))
+(defstruct (triangle (:conc-name nil))
   (a (vec 0 0) :type vec2)
   (b (vec 0 0) :type vec2)
   (c (vec 0 0) :type vec2))
 
-(define-with-macro (triangle :conc-name "") a b c)
+(define-with-macro triangle a b c)
 
 (defun triangle (a b c)
   (make-triangle :a a :b b :c c))
--- a/src/looms/002-wobbly-lines.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/looms/002-wobbly-lines.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -9,12 +9,11 @@
 
 
 ;;;; Elements -----------------------------------------------------------------
-(defstruct (line (:conc-name "")
+(defstruct (line (:conc-name nil)
                  (:constructor line (points)))
   (points (error "Required") :type vector))
 
-(define-with-macro (line :conc-name "") points)
-
+(define-with-macro line points)
 
 ;;;; Element Conversion -------------------------------------------------------
 (defun convert (line opacity)
--- a/src/looms/004-turtle-curves.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/looms/004-turtle-curves.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -12,7 +12,7 @@
   (angle *starting-angle*)
   (state nil))
 
-(define-with-macro turtle x y angle state)
+(define-with-macro (turtle :conc-name turtle-) x y angle state)
 
 
 (defun rot (angle amount)
@@ -132,8 +132,8 @@
     (finally (return word))))
 
 (defun run-named-l-system (l-system iterations)
-  (run-l-system (l-system-axiom l-system)
-                (l-system-productions l-system)
+  (run-l-system (axiom l-system)
+                (productions l-system)
                 iterations))
 
 
@@ -389,12 +389,12 @@
            (*color* (hsv (rand 1.0)
                          (random-range 0.5 0.8 #'rand)
                          (random-range 0.9 1.0 #'rand)))
-           (axiom (l-system-axiom l-system))
-           (*angle* (l-system-recommended-angle l-system))))
+           (axiom (axiom l-system))
+           (*angle* (recommended-angle l-system))))
     (multiple-value-bind (productions mutagen)
         (if pure
-          (values (l-system-productions l-system) nil)
-          (maybe-mutate-productions (l-system-productions l-system))))
+          (values (productions l-system) nil)
+          (maybe-mutate-productions (productions l-system))))
     (flax.drawing:with-rendering
         (canvas filetype filename width height :background bg :padding 0.05))
     (progn
@@ -402,7 +402,7 @@
         turtle-draw
         transform-to-fit
         (flax.drawing:render canvas <>))
-      (values (l-system-name l-system)
+      (values (name l-system)
               iterations
               mutagen))))
 
--- a/src/looms/007-stippling.lisp	Wed Mar 27 19:59:02 2019 -0400
+++ b/src/looms/007-stippling.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -11,8 +11,8 @@
 (defstruct (circle (:conc-name nil)) center radius)
 
 
-(define-with-macro (rectangle :conc-name "") a b)
-(define-with-macro (circle :conc-name "") center radius)
+(define-with-macro rectangle a b)
+(define-with-macro circle center radius)
 
 
 (defun random-coord ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/package.lisp	Sun Jun 09 11:27:41 2019 -0400
@@ -0,0 +1,92 @@
+(defpackage :flax.base
+  (:use :cl :iterate :losh :flax.quickutils
+        :3d-vectors
+        :3d-matrices)
+  (:export
+    :rand
+    :with-seed
+    :random-or
+    :randomly-initialize
+    :round-to))
+
+(defpackage :flax.colors
+  (:use :cl :iterate :losh :flax.base :flax.quickutils)
+  (:export
+    :color
+    :with-color
+    :hsv
+    :rgb))
+
+(defpackage :flax.transform
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :3d-vectors
+    :3d-matrices)
+  (:export
+    :transformation
+    :scale
+    :rotate
+    :translate
+    :ntransform))
+
+(defpackage :flax.drawing
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :flax.transform
+    :3d-vectors
+    :3d-matrices)
+  (:export
+    :with-rendering
+    :render
+    :fade
+    :triangle
+    :path
+    :points
+    :rectangle
+    :point
+    :circle
+    :text))
+
+
+(defpackage :flax.looms.001-triangles
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :3d-vectors)
+  (:export :loom))
+
+(defpackage :flax.looms.002-wobbly-lines
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :3d-vectors)
+  (:export :loom))
+
+(defpackage :flax.looms.003-basic-l-systems
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :3d-vectors)
+  (:export :loom))
+
+(defpackage :flax.looms.004-turtle-curves
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :flax.transform
+    :3d-vectors)
+  (:export :loom))
+
+(defpackage :flax.looms.005-simple-triangulations
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :3d-vectors)
+  (:export :loom))
+
+(defpackage :flax.looms.006-tracing-lines
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :3d-vectors)
+ (:export :loom))
+
+(defpackage :flax.looms.007-stipple
+  (:use :cl :iterate :losh :flax.base :flax.quickutils
+    :flax.colors
+    :3d-vectors)
+  (:export :loom))
+
+