# [PD] Prime limit sliders (fwd)

Mathieu Bouchard matju at artengine.ca
Thu Mar 31 21:27:00 CEST 2005

```---------- Forwarded message ----------
Date: Thu, 31 Mar 2005 13:43:59 -0500 (EST)
From: Mathieu Bouchard <matju at artengine.ca>
To: Chuckk Hubbard <badmuthahubbard at gmail.com>

On Tue, 29 Mar 2005, Chuckk Hubbard wrote:
> For instance, with the prime limits:
> 3-4
> 5-1
> 7-1
> 11-1
> 13-0
> 17-0

The set of all possible fractions can be expressed as a six-dimensional
9-by-3-by-3-by-3-by-1-by-1 grid (in this example). If you have GridFlow then
you could do this:

[9 3 3 3 1 1 6 # 3 5 7 11 13 17( <-- make many copies of prime list
|
| [#for (-4 5) (-1 2) (-1 2) (-1 2) (0 1) (0 1)] <-- make indices
|  |
| [#cast f] <-- convert to float (from int)
|  |
[# **] <-- raise primes to all possible power combinations
|
[#fold *, seed 1] <-- multiply prime powers together
|

and then the next step is to make a sorted list of those values. It would
involve [#ravel] and [#grade] and [#finished] and [#store].

at that point, half of your problem is solved, and the other half is to take
any number and find the closest possible value in your list. For that job, you
can use [#convolve (1 2 # 1 1)] [# >> 1] to find the boundaries of the centered
intervals (which are averages of successive values in the previous list). Each
interval is centered on an allowed fraction and encompasses all values for
which the closest allowed fraction is that one.

If that list is any big, you'll have a hard time searching in it, but I guess
you won't use big lists anyway because it'd make more pixel positions than are
available on the actual slider...

You can do the same with plain Pd of course (plus maybe zl), it's just that
it'd take many times more boxes. (I mean, it doesn't matter if you decide to
not use GridFlow, i am just trying to communicate a few concepts to you)

.-----------------------------------------------------------------.
/  The Diagram is the Program (TM) ,--------------------------------}
{----------------------------------"     http://artengine.ca/matju  /
`-----------------------------------------------------------------'

```