1
2
3
4
5
6
7
8
9
10
 
    //are two vectors orthogonal?
 
    vxd::t v1(4);
    vxd::t v2(4);
 
    v1 << -231,  4;
    v2 <<  120-1;
 
    co(v1.dot(v2), "v1.dot(v2)");
cs



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
    vxd::t v1(3);
    vxd::t v2(3);
 
    vxd::t v3(3);
    vxd::t v4(3);
 
    v1 << 2-13;
    v2 << 4-12;
 
 
    //find v3 which is projection of v1 on v2
    //and  v4 which is projection of v1 on orthogonal vector of v3(or v2)
 
 
    v3 = v_proj(v1, v2);
    v4 = v1 - v3;
 
    co(v3, "v3");
    co(v4, "v4");
 
cs



+ Recent posts