diff src/laser/rasterize.clj @ 13:397ab24b4952

saving, to update with correct fix later
author Robert McIntyre <rlm@mit.edu>
date Sun, 29 Aug 2010 00:03:09 -0400
parents f952052e37b7
children db745c95aabd
line wrap: on
line diff
     1.1 --- a/src/laser/rasterize.clj	Tue Aug 24 19:10:22 2010 -0400
     1.2 +++ b/src/laser/rasterize.clj	Sun Aug 29 00:03:09 2010 -0400
     1.3 @@ -183,7 +183,11 @@
     1.4  
     1.5  (defn row->gcode [[x-dpi y-dpi] row]
     1.6    (let [[x1 y1] (first row)
     1.7 -	[x2 y2] (last row)]
     1.8 +	[x2 y2] (last row)
     1.9 +	x2 (+ x2 (* x-dpi 0.318))]
    1.10 +	  
    1.11 +
    1.12 +;    (println x2)
    1.13      (str (format "G0 X%.3f Y%.3f\n"
    1.14  		 (float (* x1 (/ x-dpi)))
    1.15  		 (float (* y1 (/ y-dpi))))
    1.16 @@ -232,7 +236,8 @@
    1.17  		  (reverse (gather-row row))
    1.18  		  (gather-row row))]
    1.19  	    (let [x (float (* x (/ x-dpi)))
    1.20 -		  y (float (* y (/ x-dpi)))]
    1.21 +		  y (float (* y (/ x-dpi)))
    1.22 +		  x (+ x 0.159)];; shift by a small margin.
    1.23  	      (if-not forward?
    1.24  		(str (format "0 0 1 %.3f\n" x)
    1.25  		     (format "0 1 1 %.3f\n" y))
    1.26 @@ -245,7 +250,6 @@
    1.27  
    1.28  
    1.29  (defn make-rows [pic]
    1.30 -  
    1.31    (map (partial sort #(< (first %1) (first %2)))
    1.32         (partition-by last
    1.33  		     (sort (fn [[x1 y1][x2 y2]] (> y2 y1))
    1.34 @@ -368,3 +372,13 @@
    1.35  	(with-bindings  {#'*out* temp}
    1.36  	  (Thread/sleep 5000)
    1.37  	  (println "hi")))))))
    1.38 +
    1.39 +
    1.40 +(comment
    1.41 +  (do
    1.42 +    (require 'rlm.quick)
    1.43 +    (ns laser.rasterize)
    1.44 +    (rlm.quick/dirty)
    1.45 +    (use :reload-all 'laser.rasterize)
    1.46 +    (undef map-keys)
    1.47 +    (use :reload-all 'laser.rasterize)))