separate out draw bounds
This commit is contained in:
@ -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]]
|
||||
(let [spread (- hi lo)
|
||||
mid (+ lo (/ spread 2))
|
||||
gap (/ spread 20)]
|
||||
(and (>= v lo) (<= v hi)
|
||||
(>= (math/abs v) (/ hi 5))))
|
||||
(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)))))))
|
||||
|
||||
Reference in New Issue
Block a user