(ns test.gadjett (:require [gadjett.linear :as glinear :refer [intersection-point-func linear-equation intersection-point find-below-and-above-y linear-equation-func highest-below-x linear-y linear-x-func log-x-intersection-point interpolate-linear-y linear-y-func intersection-point-from-2-lines-points lowest-above-x find-keys-with-value log-x-linear-y lowest-above-y log-x-linear-equation calc-interpolated-values linear-x interpolate-linear-x below-and-above-y highest-below-y find-keys-with-values-in]] [gadjett.collections :as gcoll :refer [compact unflatten-keys sequence->map sequence-of-maps->map =without-keys? dissoc-in split-by-predicate-positions mapify submap? positions filter-map vec->map assoc-cyclic infinity subsequence edn-zip fix-blank-lines map-nested-vals map-to-object deep-merge deep-merge-with mean map-object-kv flatten-keys flatten-keys* compactize-map compactize-map-recursive partition-between take-from-map map-with-index map-object-with-key deep-merge* range-till-end nearest-of-seq branches-and-leaves remove-ending-comments remove-blank-lines filter-branches out-of-bound? map-2d-vec split-by-predicate collify abs append-cyclic map-2d-vec-kv max-and-min index-of nearest-of-ss map-reverse-hierarchy map-object my-replace join-them]]))

Click here to make these examples interactive with ClojureScript.

gadjett.linear

below-and-above-y

(below-and-above-y y [x1 y1] [x2 y2])

calc-interpolated-values

(calc-interpolated-values m y interpolate? axes)

find-below-and-above-y

(find-below-and-above-y m y)

find-keys-with-value

(find-keys-with-value m v)

find-keys-with-values-in

(find-keys-with-values-in m s)

highest-below-x

(highest-below-x m v)

highest-below-y

(highest-below-y m v)

interpolate-linear-x

(interpolate-linear-x m y & {:keys [interpolate? axes select-func], :or {interpolate? (constantly true), axes {:x :linear, :y :linear}, select-func min-coll}})

Returns the interpolated x for a given y acording to the select-func thats passed

  • :interpolate? - a predicate for deciding eather to calc th interpolation or not.
  • :axes - a map that defines what are the axes scales
  • :select-func - what functionality to use if there are multiple interpolated values
  (interpolate-linear-x {10 30 20 50 70 60} 32)

interpolate-linear-y

(interpolate-linear-y m x & {:keys [interpolate? axes], :or {interpolate? (constantly true), axes {:x :linear, :y :linear}}})

intersection-point

(intersection-point a1 b1 a2 b2)

intersection-point-from-2-lines-points

(intersection-point-from-2-lines-points [ax1 ay1 ax2 ay2] [bx1 by1 bx2 by2] & {:keys [axes], :or {axes {:x :linear, :y :linear}}})

intersection-point-func

(intersection-point-func {:keys [x y], :as axes})

linear-equation

(linear-equation x1 y1 x2 y2)

linear-equation-func

(linear-equation-func {:keys [x y], :as axes})

linear-x

(linear-x y x1 y1 x2 y2)

linear-x-func

(linear-x-func {:keys [x y], :as axes})

linear-y

(linear-y x x1 y1 x2 y2)

linear-y-func

(linear-y-func {:keys [x y], :as axes})

log-x-intersection-point

(log-x-intersection-point a1 b1 a2 b2)

log-x-linear-equation

(log-x-linear-equation x1 y1 x2 y2)

log-x-linear-y

(log-x-linear-y x x1 y1 x2 y2)

lowest-above-x

(lowest-above-x m v)

lowest-above-y

(lowest-above-y m v)