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))))
|
(Trace. origin (random-vel) start-radius start-lifespan (+ 70 (rand-int 10))))
|
||||||
|
|
||||||
(defn drawing? [t bounds]
|
(defn drawing? [t bounds]
|
||||||
(and (in-bounds? (:position t) bounds)
|
(and (in-draw-bounds? (:position t) bounds)
|
||||||
(> (:radius t) 0)
|
(> (:radius t) 0)
|
||||||
(> (:lifespan t) 0)
|
(> (:lifespan t) 0)
|
||||||
(< (:start-time t) 0)))
|
(< (:start-time t) 0)))
|
||||||
@ -98,18 +98,22 @@
|
|||||||
[v [lo hi]]
|
[v [lo hi]]
|
||||||
(and (>= v lo) (<= v hi)))
|
(and (>= v lo) (<= v hi)))
|
||||||
|
|
||||||
#_(defn in-bounds?
|
(defn in-bounds?
|
||||||
"Inside bounds box?"
|
"Inside bounds box?"
|
||||||
[p bounds]
|
[p bounds]
|
||||||
(every? true? (map #(single-in-bounds? %1 %2) 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?"
|
"Is a single value in bounds?"
|
||||||
[v [lo hi]]
|
[v [lo hi]]
|
||||||
(and (>= v lo) (<= v hi)
|
(let [spread (- hi lo)
|
||||||
(>= (math/abs v) (/ hi 5))))
|
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?"
|
"Inside complex box?"
|
||||||
[p bounds]
|
[p bounds]
|
||||||
(every? true? (map #(complex-single-in-bounds? %1 %2) p bounds)))
|
(every? true? (map #(complex-single-in-bounds? %1 %2) p bounds)))
|
||||||
@ -117,7 +121,7 @@
|
|||||||
(defn in-bounds?
|
(defn in-bounds?
|
||||||
"Inside sphere?"
|
"Inside sphere?"
|
||||||
[p bounds]
|
[p bounds]
|
||||||
(<= (v-mag (v-- p [500 500 500])) 220))
|
(<= (v-mag (v-- p [500 500 500])) 400))
|
||||||
|
|
||||||
(defn trace-trajectory
|
(defn trace-trajectory
|
||||||
[trace bounds]
|
[trace bounds]
|
||||||
@ -159,5 +163,5 @@
|
|||||||
[count]
|
[count]
|
||||||
(time
|
(time
|
||||||
(with-open [o (io/output-stream "sample.ply")]
|
(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)))))))
|
(mio/write-ply o (g/tessellate (g/scale (iso/surface-mesh tree 5 0.9) 0.01)))))))
|
||||||
|
|||||||
Reference in New Issue
Block a user