Liking cljdoc? Tell your friends :D

circle-packing.core


base-configclj/s


circle-intersects-any?clj/s

(circle-intersects-any? circle all-circles)
(circle-intersects-any? padding circle all-circles)

checks if the given circle intersects with any other given circles

checks if the given circle intersects with any other given circles
raw docstring

circles-intersect?clj/s

(circles-intersect? circle-1 circle-2)
(circles-intersect? padding {c1 :center r1 :radius} {c2 :center r2 :radius})

given two circles and optionallly padding checks if they intersect

given two circles and optionallly padding checks if they intersect
raw docstring

gen-packed-circlesclj/s

(gen-packed-circles)
(gen-packed-circles config)
(gen-packed-circles config initial-circles)

returns a list of packed circles, where a circle has a :center as 2d vec and :radius. optinally takes a config map containing :min-radius a number or a 0-arity function returning a number :max-radius a number or a 0-arity function returning a number :radius-step a number or a 0-arity function returning a number :max-circles number :max-attempts number :padding a number or a 0-arity function returning a number :random-sampler a 0-arity function that return a 2d vec of random points :in-bounds? a function that takes a circle as argument and return boolean based on bound checks where a circle has a :center as 2d vec and :radius

optionally also takes intial list of circles where a circle has a :center as 2d vec and :radius


default config

{:min-radius 5 :max-radius 10 :max-circles 20 :radius-step 1 :max-attempts 100 :padding 0 :random-sampler #(random-in-rect random-range 0 0 100 100) :in-bounds? (partial in-bound-rect? 0 0 100 100)}

returns a list of packed circles, where a circle has a :center as 2d vec and :radius.
optinally takes a config map containing
:min-radius a number or a 0-arity function returning a number
:max-radius a number or a 0-arity function returning a number
:radius-step a number or a 0-arity function returning a number
:max-circles number
:max-attempts number
:padding a number or a 0-arity function returning a number
:random-sampler a 0-arity function that return a 2d vec of random points
:in-bounds? a function that takes a circle as argument and return boolean based on bound checks where a circle has a :center as 2d vec and :radius

optionally also takes intial list of circles where a circle has a :center as 2d vec and :radius

---

default config

{:min-radius 5
 :max-radius 10
 :max-circles 20
 :radius-step 1
 :max-attempts 100
 :padding 0
 :random-sampler #(random-in-rect random-range 0 0 100 100)
 :in-bounds? (partial in-bound-rect? 0 0 100 100)}
raw docstring

in-bound-circle?clj/s

(in-bound-circle? c1 r1 {c2 :center r2 :radius})

given center as 2d vec, radius and a circle as arguments returns true if the provided circle is in bound where a circle has a :center as 2d vec and :radius. meant to be used for :in-bound?

given center as 2d vec, radius and a circle as arguments returns true if the provided circle is in bound where a circle has a :center as 2d vec and :radius. meant to be used for :in-bound?
raw docstring

in-bound-rect?clj/s

(in-bound-rect? x-start y-start x-end y-end {[x y] :center r :radius})

given start and end points of a reactangle and a circle as arguments returns true if the provided circle is in bound where a circle has a :center as 2d vec and :radius. meant to be used for :in-bound?

given start and end points of a reactangle and a circle as arguments returns true if the provided circle is in bound where a circle has a :center as 2d vec and :radius. meant to be used for :in-bound?
raw docstring

make-circleclj/s

(make-circle center radius)

given center as 2d vec and radius generate a circle

given center as 2d vec and radius generate a circle
raw docstring

random-in-circleclj/s

(random-in-circle random [x y] radius)

given a random number generator, center as 2d vec and radius of a circle returns random points inside

given a random number generator, center as 2d vec and radius of a circle returns random points inside
raw docstring

random-in-rectclj/s

(random-in-rect random x-start y-start x-end y-end)

given a random number generator (taking min and max arguments), start and end points of a reactangle returns random points inside

given a random number generator (taking min and max arguments), start and end points of a reactangle returns random points inside
raw docstring

random-rangeclj/s

(random-range start end)

given start and end generates a random number in range

given start and end generates a random number in range
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close