What is the vector field?

Vector field (in our case) is just a to function exatly the same as variation described in my previous post about Folds.

Why vector? Because you can treat a pair of as vector for each point from 2d plane. This way you get field of vectors.

Vector fields can be visualised in the following way

How to get the vector field

The main goal, in this article, is to research various ways to create vector fields. There two cases.

We can operate on functions which returns pair of values like variations. In this case such function defines vector field itself. We can use also some vector operations (like substraction, sum, etc…) to get new functions.

The second option is to get single float number like from noise(), dist() between points or dot product of vectors, etc. And convert this number into vector.

When I change my field vector to be constant one (different than 0), my points start move.

PVector v = new PVector(0.1, 0.1);

Perlin noise

Let’s begin with perlin noise in few configurations. I’m going to change only marked lines from the code stub.

Variant 1

noise(x,y) function in processing returns value from 0 to 1 (actually implementation used in Processing has some problems and real value is often in range from 0.2 to 0.8). I will treat resulted value as an angle in polar coordinates and use sin()/cos() functions to convert it to cartesian ones. To properly do this I have to scale it up to range or or even more. I show few variants here.

Variant 3

Two of above variants were using classic method. Now I get rid of polar->cartesian conversion and I’m going to treat returned value from noise() as cartesian coordinates. Angle of the vector is the same for whole field and only length of vector is changed. This leads to some interesting patterns. Experiment with scaling input coordinates and

Parametric curves

Let’s use parametric curves to convert noise() result into vector. The big list of them is defined in Wolfram Alpha or named here. Parametric curve (or plane curve) is a function . Click section name to see plot of the curve.

Variant 6 – comparison

Here I want to compare different curves using the same method. I change marked lines into pair of curves defined above. I’ve put noiseSeed(1111); in setup() to have the same noise structure. Check image description to see what curves were used.