**Alex's notes**

# Noise field

A vector field is a function that takes position as input and returns a vector as output. You can visualize this as grid of arrows, where each arrow represents the vector at that position in the field.

Imagine that the vector field represents some sort of flow, like wind. If we place a particle somewhere in the field and let the wind push it around, it will trace out a path through the field. The shape of that path will depend on the underlying vector field. If we change the shape of that field, we’ll change the shape of the path, in sometimes surprising ways.

For example, if we use perlin noise to generate the vector field, the generated path almost looks like lightning. If we continue drawing the particle path as we animate the underlying noise, the lightning effect is even more prevalent.

In this video we’re going to code up this effect using the programming language Processing.

First, let’s write a function to represent our vector field. A vector field takes a position and maps it to a vector. So to represent such a thing in code, we’ll write a function like:

```
PVector vectorField(PVector position) {
// todo...
}
```