We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Ok, this is kinda difficult to explain with words so I decided to come up with some graphics to explain what I'm trying to achieve:
01.- Randomly divide the sketch horizontally in uneven parts (red lines). I will use hem as x coordinates.
02.- Randomly divide the sketch vertically in uneven parts (cyan lines). I will use them as y coordinates.
03.- Connect the x and y coordinates using lines
04.- This is my goal, instead of lines, I want to create a continuous curve.
It that possible or am I daydreaming? Is there a better way to do what I want? Thanks in advance for taking your time to review this thing.
Answers
http://processing.org/reference/curveVertex_.html ?
This is what I have at the moment:
You can use the Shapes3D library (get using Sketch > Import Library > Add Library menu) to create a 2D Bezier spline from a set of points. The code below created this image.
Alternatively, add the following function:
and in your code, replace line() with drawBezier(). Not perfect (°), but a step forward.
° for simple inflexion points, ie. two successive descending or ascending lines.
For these, the control points should be aligned on a line average of the two lines.
Wow, that was fantastic! Thanks you all for your help. I'll be expanding the script and I'll come back if I have more questions.
OK, here's the deal. A friend helped me to modify the sketch and use a function to create a line so the other parallel lines could be created easily. I am wondering if it's possible to shift the x position of the new lines to create a more interesting effect. This is the code at the moment:
Yes, call drawBezier() (there was a typo in my function definition, sorry) with an offset on x1 and x2. The offset can be an additional parameter to createLine(), for example.
Sorry, I didn't get that. What I want it the parallel lines to have different x position, or at least shifted a bit forward or backward. Is there any way to introduce that variant in that sketch?
I would make an array of offsets of same size than pointsArray. In createLine(), I would fill the array with random numbers, eg. between -3 and 3. Then, in the loop, call drawBezier() by adding pointsArray[i].x (or i+1) with the offset of same index.
Hmmm, I think I'm doing something wrong: