Sunday, November 22, 2009

Commit 1 of today

Ok seems i lazed out yesterday evening and wow got locked out of my own room for 3 hours.. laughs well sort of didnt have the key to my lock so guess yesterday evening went down the drain. Been lazing around since morning trying to do the collision detection .

First off I got the Qtimers to work . Nothing fancy about it either. When i started off with the cloth collision... I decided to give options. well more for my qt i guesss. .so well wrote a ground class..

well what did i write in the ground class... well basically it is a plane defined in the point normal form..

so something along the lines of

class ground{
vector normal;
point Point_on_plane;
}


and then i found the mathematical equations to find the distance between a point and the plane . well let cut the mathematics short and you know you can find resources on net. try this one (http://mathworld.wolfram.com/Point-PlaneDistance.html )

Well to find the distance between pt plane ax+by+cz+d=0 and point (x0,y0,z0) we basically find a vector betwee nthe point on plane and the point ..


By projecting the vector on the plane and finding magnitude we can find the distance between point and the plane

Vector connect = Point1 - PointonPlane

projectiondistance = | connect.normal | / |normal|

if this value is negative then it is on the side away from the normal and well vice versa.


So every point when it moves checks for crossing the plane and when it does a projection algorithm works to snap the point onto the plane.

Projection of point onto a plane p = q - dist * n ((q is the point to be projected , dist = distance between point and plane and n the normal of the plane ))

so well pretty much good and working so far . also attached is a little video of the progress in 3 days

sorry abt the background noise was recorded in linux heheheh

revno: 7
committer: sundar@animcentral
branch nick: qtClothSImulation
timestamp: Sun 2009-11-22 14:33:25 +0000
message:
Ok great my first step of collision. Collision etween the cloth and a plane.I created a new class called ground wis a plane defined in the point normal form. We can find the distance between a point a plane and as well as the projection. What happens here is that when the cloth simulates at each point it checks for whether the cloth is below or above the plane and when it finds it dropping the plane it projects the point onto the plane. Might as well add a little tolerance value so that the cloth shows little wrinkles or something to that effect.