Definitely: scale() changes strokeWeight().
Apok wrote on Aug 26th, 2009, 1:31pm:I found a partial solution by means of translate()+scale() in draw() but they are far from being intuitive. You even need to resize strokeWeight().
I was think of something to set once for all in setup().
My "problem": I was visualizing y=sin(x) and my code contained "ugly" scale corrections to represent the function in a 400x400 screen.
So I used map() but every time I wanted to print a point, line, etc I had to remember to use map(). Not elegant at all.
Last try: I used a combination of translate() and scale() to represent correctly my interval (y=+1 top, y=-1 bottom, x=-1 left, x=+1 right) but then I needed to remember to correct strokeWeight() around the code because of the changed scale factor.
Code:translate(0, height);
scale(width/2, -height/2); // this is to scale x&y and reverse y
translate(1.0, 1.0); // (0,0) is screen center
strokeWeight(1.0/width); // stroke has to be compensate
// for the scale change
Wouldn't it be better to have a single function in setup() to define which part of screen to magnify (with or without stroke magnification)?
It would be great to study mathematical functions. As soon as a function is "out of screen" you just change a parameter and automatically the rest of the code is ok.
Is there any library that provides it?
Apok