This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-30
Channels
- # bangalore-clj (1)
- # beginners (9)
- # boot (51)
- # cider (20)
- # cljs-dev (419)
- # clojars (1)
- # clojure (338)
- # clojure-brasil (64)
- # clojure-dev (7)
- # clojure-greece (2)
- # clojure-italy (3)
- # clojure-russia (10)
- # clojure-spec (127)
- # clojure-uk (12)
- # clojurebridge (2)
- # clojurescript (132)
- # core-async (8)
- # cursive (37)
- # datomic (34)
- # dirac (5)
- # events (1)
- # funcool (3)
- # hoplon (39)
- # jobs (3)
- # leiningen (3)
- # off-topic (16)
- # om (44)
- # onyx (7)
- # pedestal (20)
- # protorepl (1)
- # random (1)
- # re-frame (64)
- # reagent (6)
- # specter (4)
- # test-check (9)
- # untangled (17)
- # vim (4)
for instance i have this function:
(defn pixel->tile [position tile-size]
{:x (Math/floor (/ (:x position) tile-size))
:y (Math/floor (/ (:y position) tile-size))})
i suppose i’d want to check that the output is non-nil and > 0? but that doesn’t seem to ensure the logic of it
It’s a pretty simple function, so it might be hard to come up with something much better. You could check whether the returned x is <= to the position x
you could probably come up with a distance-scaling property
a relationship between (distance p1 p2) and (distance (f p1) (f p2))
or more generally the 2d-vector representing the offset between them