File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 (+ radius1 radius2)))
5555
5656(defn circle-X-any-circle?
57+ " Does the circle intersects any other circles?"
5758 [circle other-circles]
5859 (some #(circle-X-circle? % circle) other-circles))
5960
Original file line number Diff line number Diff line change 11(ns hyperspace.gravity
22 (:use [hyperspace geometry]))
33
4- (def gravity-constant 0.1 ; 6.6725e-11
5- )
4+ (def gravity-constant 0.1 )
65
76(defn gravity-acceleration
7+ " Returns acceleration for the first object under gravity's impact of
8+ the second one."
89 [{position1 :position mass1 :mass }
910 {position2 :position mass2 :mass }]
1011 (let [d (distance position1 position2)
Original file line number Diff line number Diff line change 11(ns hyperspace.misc )
22
33(defn rand-range
4- " Returns a random integer between low (inclusive) and high (inclusive)"
4+ " Returns a random integer between low (inclusive) and
5+ high (inclusive)"
56 [low high]
6- (+ low (rand-int (+ 1 (- high low)))))
7+ (-> (- high low)
8+ (+ 1 )
9+ rand-int
10+ (+ low)))
711
812(defn saturation
13+ " Ensures that the value is not going out of bounds [low, high]"
914 [value low high]
1015 (cond
1116 (< value low) low
You can’t perform that action at this time.
0 commit comments