Clamps Dictionary
get-interp-vals
Function
(get-interp-vals proplist)
Return an interpolation breakpoint list for the interp function with alternating min and max values of the form (x1 min1 x2 max1 x3 min2 x4 max2…)
x values in the result are going from 0..1, the distance between succesive x vals calculated by the :dtime function form.
A form (:dtime 0.2) will result in x values (0 0.2 0.4 0.6 0.8 1).
A form (:dtime (n-lin x 0.2 0.5)) will result in x values (0 0.2 0.46 0.8 1).
Note that the final dtime value is truncated in the second example.
form should contain a :dtime
, :min
and :max
property. The
forms of :dtime
, :min
and :max
can use x, referring to its
value and the forms of :min
and :max
can additionally use ip-num
and ip-idx, referring to the current idx and the total num of values
in the interpolated list. :bindings
is an optional binding form for
variables usable within the context of the :min
and :max
forms.
Arguments
proplist |
Property List containing :dtime , :bindings , :min and :max properties. |
:round |
whether the results should get rounded to two decimal places (default t). |
Examples
(digest-interp-form (:dtime (n-exp x 0.3 0.05) :min (n-lin x 0.5 0) :max (n-lin x 0.5 1))) ;; => (0 0.5 0.3 0.65 0.48 0.26 0.61 0.8 0.71 0.15 0.79 0.9 0.86 0.07 ;; 0.92 0.96 0.98 0.01 1 1.0) (plot-2d (digest-interp-form (:dtime (n-exp x 0.3 0.05) :min (n-lin x 0.5 0) :max (n-lin x 0.5 1))))

(digest-interp-form (:bindings ((min 0) (max 1)) :dtime (n-exp x 0.3 0.05) :min (float (* ip-idx (/ 0.5 (1- ip-num))) 1.0) :max (- 1.0 (* ip-idx (/ 0.5 (1- ip-num)))))) ;; => (0 0.0 0.3 0.94 0.48 0.11 0.61 0.83 0.71 0.22 0.79 0.72 0.86 ;; 0.33 0.92 0.61 0.98 0.44 1 0.5) (plot-2d (digest-interp-form (:bindings ((min 0) (max 1)) :dtime (n-exp x 0.01 0.3) :min (float (* ip-idx (/ 0.5 (1- ip-num))) 1.0) :max (- 1.0 (* ip-idx (/ 0.5 (1- ip-num)))))))

See also
Created: 2025-08-17 So 16:52