You could always just normalize your initial numbers (divide by initial maximum) and then multiply your output by your new maximum.
This works great if both of your ranges are 0 -> n. If your ranges have different minimums you would have to do some additional scaling. Basically you would subtract your minimum form your maximum (getting the range) and then normalize from 0 -> range, and then when you are done just add the range back in.
If I had pd at work I would write a quick abstraction for you. It should be easy to set up.
m.
-----Original Message----- From: Hans-Christoph Steiner [mailto:hans@eds.org] Sent: Tuesday, March 18, 2003 9:03 AM To: pd-list@iem.kug.ac.at Subject: [PD] Range object
I am looking for an object to change the range of numbers. Specially, I am working with mice and joysticks, which output numbers in a specific range (screen resolution for mice; 0-65535 for usb joysticks). I would like an object like this [ranger inMin inMax outMin outMax].
Anyone seen something like this? I couldn't find anything in pdb.
.hc
zen
\[D[D[D[D
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
Scanned for viruses on 18 Mar 2003 18:24:50 No viruses found. Virus scanning by http://erado.com