norm : distance of vector


1
2
3
4
5

    v3d::t v;
    v << -321;
 
    co(v.norm() * v.norm(),"v.norm() * v.norm()");
 
cs


unit vector : vector which of norm is one.


1
2
3
4
5
6
7
8
9
10
11
v3d::t v;
    v << -321;
 
    co(v.norm() * v.norm(),"v.norm() * v.norm()");
 
    v3d::t unitVector;
 
    unitVector = 1 / v.norm() * v;
 
    co(unitVector, "unitVector");
    co(unitVector.norm(), "unitVector.norm()");
cs


these kind of operations referred as a normalizing


standard unit vector : vector of same direction with axis in 2D or 3D space which of norm is one.i.e..(1,0,0) , (0,1,0), (0,0,1)



cos theta from inner production between two vectors :

1
2
3
4
5
6
7
8
9
10
11
12
 
    v3d::t v1;
    v3d::t v2;
    v1 << 001;
    v2 << 022;
 
    co(v1.norm() ,"v1.norm()  ");
    co(v2.norm() ,"v2.norm()  ");
    co(v1.dot(v2),"v1.dot(v2) ");
 
    co( deg_rad(acos(v1.dot(v2) / (v1.norm() * v2.norm())) )   , "cosin Theta ") ;
 
cs


result :

1
2
3
4
5
6
7
8
v1.norm()   = 
1
v2.norm()   = 
2.82843
v1.dot(v2)  = 
2
cosin Theta  = 
45
cs




 

+ Recent posts