Skip to content

Commit

Permalink
[#15] map-range
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Dec 2, 2018
1 parent 0206883 commit 85c516f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/quil.core.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
- [x] [`log`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2265) - "Calculates the natural logarithm (the base-e logarithm) of a number"
- [x] [`looping?`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L1705) - "Returns whether the sketch is looping"
- [ ] [`mag`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2278) - "Calculates the magnitude (or length) of a vector"
- [ ] [`map-range`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2297) - "Re-maps a number from one range to another"
- [x] [`map-range`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2297) - "Re-maps a number from one range to another"
- [ ] [`mask-image`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2313) - "Masks part of an image from displaying by loading another image and using it as an alpha channel"
- [x] [`millis`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2335) - "Returns the number of milliseconds (thousandths of a second) since starting the sketch"
- [x] [`minute`](https://github.com/quil/quil/blob/2.8.0/src/cljc/quil/core.cljc#L2348) - "Returns the current minute as a value from 0 - 59"
Expand Down
6 changes: 6 additions & 0 deletions src/doodler/core.clje
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@
[n]
(math/sqrt n))

(defn map-range
[val low1 high1 low2 high2]
(+ low2
(* (- high2 low2)
(/ (- val low1) (- high1 low1)))))

;; Color

(defn color
Expand Down

0 comments on commit 85c516f

Please sign in to comment.