Last active
December 7, 2017 08:09
-
-
Save dimovich/61be116d68b3e75f03a4950510109e1b to your computer and use it in GitHub Desktop.
thi.ng/geom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[thi.ng.geom.core :as g] | |
'[thi.ng.geom.core.vector :as v] | |
'[thi.ng.geom.spatialtree :as t]) | |
(defn update-tree [tree] | |
(fn [agents] | |
(reduce | |
#(g/add-point % %2 %2) | |
(g/clear! tree) ;;works with (t/set-children tree nil) | |
agents))) | |
(def agents (take 50 (repeatedly #(-> (v/randvec3) g/abs (g/* 500))))) | |
(def updater (update-tree (t/octree 0 0 0 500 500 500))) | |
(updater agents) | |
(updater agents) ;;exception | |
;;1. Unhandled java.lang.IllegalArgumentException | |
;; Illegal lookup key: 6 | |
;; core.cljc: 3 thi.ng.xerror.core$throw_BANG_/invokeStatic | |
;; core.cljc: 3 thi.ng.xerror.core$throw_BANG_/invoke | |
;; core.cljc: 8 thi.ng.xerror.core$key_error_BANG_/invokeStatic | |
;; core.cljc: 7 thi.ng.xerror.core$key_error_BANG_/invoke | |
;; vector.cljc: 619 thi.ng.geom.core.vector.Vec3/invoke | |
;; spatialtree.cljc: 259 thi.ng.geom.spatialtree.MutableOctreeNode/make_child_for_point |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment