Friday, November 7, 2008
Sometimes we need to project one vector over another. See the picture below , we can see a vector u. Now we need to project this u on to x axis, .
This can be done with this equation : p = x * u . (x / Norm[x] ) . p is the result
"." means Dot product. What that equation means is we need to normalize x first ( in general to which we are projecting u vector ) and find the dot product between u and normalized x , and mulitply our x(destingation ) vector by this scalar value. Now we will get the result.
Tuesday, November 4, 2008
A rotation matrix can be represented as
x1 x2 x3
y1 y2 y3
z1 z2 z3
Where (x1, y1, z1) are the first vector (x2, y2, z2), (x3, y3, z3) are the second and third vectors.
Note this matrix is column major oriented.
When you multiply this matrix by an arbitrary vector in space you will get the rotated vector coordinates.
In some situations it is important to know the axis of rotation. Here I am going to present one method to get the rotation axis from rotation matrix.
Consider this matrix which represents a rotation around axis ( 0.7017,0.7017,0 ) , this actually a vector in x-y plane rotated by 45 degree, Like this
The rotation matrix for rotating around this vector by 45 degree is shown below (which I calculated using quaternion)
0.8536 0.146 0.500
0.1460 0.850 -0.500
-0.500 0.500 0.707
When we multiply a arbitrary vector (x,y,z) by this matrix we gets the vector function F as below
(X 0.8536 + y 0.146 + z 0.5) i + ( x 0.146 + y 0.85 – z 0.5 ) j + ( -x 0.5 + y 0.5 + y 0.707 ) k
I,j,k are the base vectors.
Taking curl of this vector function F, we get the axis of rotation.
I calculated the curl of that function and it is (1,-1, 0). After normalizing this vector we can see the result as (.707,-.707, 0),. Earlier we had created the rotation matrix to rotate around the axis ( .707,.707,0). Our answer curl is in the opposite direction of (.707,.707,0) , but it is still correct.
Only problem is with the direction of rotation that is clockwise or anti clock wise..
Monday, November 3, 2008
A few months back i decided to study calculas. I don't want to solve equations. But understanding the concept like infinitily small things and how we can use that in practical purposes. I got a book , which explains very basically the concepts..
As a start of the study i decided to find the area of circle. Everyone knows it .. It is Pi * r ^2.
How it came ? Old people know it . Old indian mathematicians , egyptions all know that.. But calculas is developed after that.. By Sir Newtorn & Sir Lebnitz.
I decided to use caluclas to find the area of circle. We know the cirlcle can be divided in to many triangles see the follwing picture
you can see that a cirlcle containing a triangle. Suppose if we could divide the circle with very small tiny ! triangle , the area will be equal to that of the sum of all area of the triangles.
Okay this is how Infinitely small items can be useful for practical purpose. Here the area of the one Infinitely small triangle is this ( based on radius r )
Area = 1/2 * r cos(theta) * r sin(theta)
Integrating this to 0-2Pi gives the result , see below for the idea