We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
according to my understanding from the reference page of processing and also experimenting a bit, both lerp() and map() commands work always linearly.
What I mean about that is if I m mapping numbers between 1 and 100 to 1-2; 50 will be always 1.5
Is there a way -- rather a simple way to modify map() command so that is does not map numbers linearly but lets say with a hyperbolic curve?
Once you map values in grasshopper with a graph-mapper it lets you modify the curve. My aim is to understand and also use the map() command to generate different mapping methods.
If anyone did or knows how to edit the map() function like this, I would appreciate the help.
Best, Omer
Answers
Dunno about hyperMap(), but here's map()'s Java source:
https://GitHub.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L4811
Just write your own Function
No the map function is linear and cannot be changed. The only option would be to create your own 'map' function.
You can do it like this
Which has the output
Hi!
thank you for the answers.
I was trying to map the already mapped numbers, thinking that is would be squared; makes much more sense this way.
I am slowly starting to understand what is going on in this example code. Thank you very much!
float inT = map(value, start1, stop1, 0, 1);
can be replaced w/:float inT = norm(value, start1, stop1);
*-:)https://Processing.org/reference/norm_.html
quark's approach with little graphic and more functions
new version: