Wave Simulation in Processing

Wave movement in processing We want to simulate a wave movement based on the up-and-down of a grid of balls. I have imagined of two kinds of ways that we can interact with our wave grid: -Point based control: The wave is simulated starting from a point, and moves towards all directions from that very point. We will gonna control the position of the point that affects the grid, by mouse position, or Leap Motion gesture position. -Line based control: The wave grid is affected by a line, and moves in the vertical direction of the line. The line is adjusted by our mouse position or Leap Motion gesture position.

  • The grid of balls

We will write a class for the grid. They are the basic class that we will simulate the movement of grid. I have used  IGeo  Vector library here.

 

  •  Control the grid by point

Here I will write a class that functions as a point field that can affect the position of the grid.

For this point field, it is capable of calculating the distance to each ball in the grid, and thus change the position based on the distance, through the calculation of the cos value based on the distance, the wave distance, the phase, and the circulation.

  •  Control the grid by Line

Here I will write a class that functions as a line field that can affect the position of the grid. It is based on a line2d class that can help me do some geometry calculation.

Based on the line class above, I wrote a line wave class which will utilize the functions to affect grid nodes according to the distance to the certain line described in the way of line2d class.

  •  The Main function of the point control simulation software

We need this main function that will utilize the class of grid and pointwave that we wrote, thus to finalize the simulate of the behavior of the wave movement based on our control of that point. We will start with the mouse control, which is a function built in processing, and later on we will use the Leap Motion control to replace the mouse Position here.   In order to show 3D perspective in a more controled way, I have used a 3D camera library called peasy camera here.

 

Leave a Reply

Your email address will not be published. Required fields are marked *