Aether Code
The Aether’s code consist of a dynamic particle system developed in Cinder. The particle system has simple interaction forces, like repulsion and attraction, which is render in real-time, furthermore for continuous interaction with the users. As the particle system is needed to be render in real-time we choosed the Euler method of Integration to solve the particles positions. Euler’s Integration is the fastest method for solving particles positions but not as numerical precise as the Runge Kutta method.
The particle system is based from the works of Memo Akten’s MSAPhysics and Daniel Shiffman Particle System from the Nature of Code.
The following image the particle system has a global attraction force to the center. But each particle has a small repulsion force. This is to have the collision between each one of the particles.
Once implemented a real-time particle system with interaction forces; repulsion and attraction, the next step is to feed the particle points to a Delaunay triangulation algorithm.
Some Delaunay triangulations available to use are: ipolyTri, s-hull, the built-in cinder triangulation and triangle library. The one that worked best for our needs is [triangle](http://www.cs.cmu.edu/~quake/triangle.html).
The algorithm for triangulation could calculate the triangulation of 3000 points in real-time.
The final output is a mesh of points drawn on a image canvas. The canvas includes calculating the Delaunay triangulation of a set of points that behave in accordance with the physics simulation.
The next step is to feed the 2D mesh with various textures. The 2D mesh is converted to a Cinder TriMesh, which the data structure stores each vertex of the mesh and the corresponding index into a single data structure. This is very useful because we can just apply any texture to the mesh and it will dynamic transform the texture to a moving object.
As we know, the particle system has two type of forces that can be applied, repulsion and attraction. The attraction force is the main interaction force that the user can manipulate, because it alters dynamically all the particles in a generative manner, It also continuously changes the topology of the mesh.
So there are two basic functions to handle the forces.
particleSystem.addRepulsionForce( posX, posY, radius, force);
particleSystem.addAttractionForce( posX, posY, radius, force);
some of the code for simple mouse interaction
void ManifoldApp::mouseDown( MouseEvent event ){
isMousePressed = true;
mouse = Vec2i(event.getPos());
}
void ManifoldApp::mouseUp( MouseEvent event ){
isMousePressed = false;
}
void ManifoldApp::mouseDrag( MouseEvent event ){
mouse = Vec2i(event.getPos());
}
void ManifoldApp::update()
{
..
..
..
if(isMousePressed)
particleSystem.addRepulsionForce(mouse.x, mouse.y, 70, 5);
}
The following images are using repulsive forces with either a click of the mouse or a drag.
One with no global attraction force to the center.
The images are exposed into an abstract triangulated form which the user is able to manipulate in real-time through hand gestures.
Video
Aether Interaction Test from thomas sanchez lengeling on Vimeo.