Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#15] map-range #33

Merged
merged 1 commit into from
Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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