Free Form Demolition!

Well it didn't cut out to be what I proposed it would be.

USER GUIDE:

Point Button selects deformation according to point locations.

Shoot Button selects deformation according to a sphere's trajectory.. if that makes any sense at all

Shatner Button was an attempt to shatter the polygons.

Plane Button uses the picked plane as the deformation tool

Two main lights, for the left side or the right side

One center light, number 3

Recon button reconstructs your model

Mpeg Ein
Mpeg Svei
Deformed Shark I thought it needed more fins.
My car. Restored.
Free form demolition is the concept of being able to transform an object beyond the normal translation,rotation and scaling routines. Most free form deformation programs use lattice points in deforming their models. Others allow directly manipulated free form deformation in which the deformation is applied pretty much right on top of the mesh. Rather than using control points the user defines their own control. There are many tools that can be used to deform a model. A lot are borrowed from the tools use mostly in sculpting. The idea of kneading a model just as would knead clay is not foreign to free form deformation. I never got to spend too much time on the actual deformation of the model. The hardest part for me to accomplish was what had seemed to me the easiest segment of my program.. the picking. With the amount of rotations and translations you apply to the world it is hard to find the exact point you are choosing, with reference to mouse coordinates on the openGl window. With enough time spent looking on Google I finally found out that I would have to use gluUnproject and a bit of ray casting to find the right coordinates. After several days of struggling to find why three different methods of ray casting I still couldn't find the exact point. I borrowed ideas from websites who borrowed ideas from vector calculus. Using dot a series of dot products it is possible to know the exact point in the world view your mouse is pointing to. My error lay in the placing of the gluUnProject call, which requires the correct projection matrix as well as the correct, viewport and modelview matrix you are currently rendering in. I first calculated the unit vector of the picking point, which sounds odd, since it is a point that i'm referencing. With two calls of gluUnproject you can find the points in the near clipping plane and the far clipping plane, and subtract one from the other to find your direction and then you can just normalize the vector. Now that you have your direction vector you can use the polygon which you have picked, which I forgot to mention earlier. You will need a plane to find the exact point at which you are pointing to. The equation of a plane can be found by finding the dot product between the plane's normal and one of the plane's points. The dot product of the two is the distance from the origin the plane is, you use this knowledge along with the definition of the dot product A.B = |A||B|(cos O) to find the final intersection on the plane/ where your mouse is clicking. There are many ways to implement deformation on a model. Numerical methods such as Bezier splines , normal forms, and pseudo inverse are common as well as many other methods. I attempted to apply Bezier transforms onto the model I was rendering but my results were chaotic, often I would lose polygons which might seem impossible, but most likely the points referenced by the polygons were set to zero in the midst of all the calculations.