Skip to content

Commit 75576cf

Browse files
committed
Added some doc strings
1 parent d245a75 commit 75576cf

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/hyperspace/geometry.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
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

src/hyperspace/gravity.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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)

src/hyperspace/misc.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
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

0 commit comments

Comments
 (0)