diff --git a/src/voxelburst/core.clj b/src/voxelburst/core.clj index b93063d..7e2260a 100644 --- a/src/voxelburst/core.clj +++ b/src/voxelburst/core.clj @@ -53,7 +53,7 @@ (Trace. origin (random-vel) start-radius start-lifespan (+ 70 (rand-int 10)))) (defn drawing? [t bounds] - (and (in-bounds? (:position t) bounds) + (and (in-draw-bounds? (:position t) bounds) (> (:radius t) 0) (> (:lifespan t) 0) (< (:start-time t) 0))) @@ -98,18 +98,22 @@ [v [lo hi]] (and (>= v lo) (<= v hi))) -#_(defn in-bounds? +(defn in-bounds? "Inside bounds box?" [p bounds] (every? true? (map #(single-in-bounds? %1 %2) p bounds))) -#_(defn complex-single-in-bounds? +(defn complex-single-in-bounds? "Is a single value in bounds?" [v [lo hi]] - (and (>= v lo) (<= v hi) - (>= (math/abs v) (/ hi 5)))) + (let [spread (- hi lo) + mid (+ lo (/ spread 2)) + gap (/ spread 20)] + (and (>= v lo) (<= v hi) + (or (<= v (- mid gap)) + (>= v (+ mid gap)))))) -#_(defn in-bounds? +(defn in-draw-bounds? "Inside complex box?" [p bounds] (every? true? (map #(complex-single-in-bounds? %1 %2) p bounds))) @@ -117,7 +121,7 @@ (defn in-bounds? "Inside sphere?" [p bounds] - (<= (v-mag (v-- p [500 500 500])) 220)) + (<= (v-mag (v-- p [500 500 500])) 400)) (defn trace-trajectory [trace bounds] @@ -159,5 +163,5 @@ [count] (time (with-open [o (io/output-stream "sample.ply")] - (let [tree #_sampletree (sample-tree count)] + (let [tree #_sampletree (time (sample-tree count))] (mio/write-ply o (g/tessellate (g/scale (iso/surface-mesh tree 5 0.9) 0.01)))))))