开发者

Cross product function in matlab

Can someone explain to me how to use the cross product function in matlab?

An ex开发者_StackOverflowample, I have the following image with 6 fixed points on the cube, how to find the two other points of the cube? alt text http://img24.imageshack.us/img24/6479/drawcube01.png


It's good to know what the cross-product function means without using Matlab.

If you have two vectors A = ax i + ay j + az k and B = bx i + by j + bz k, the cross product is defined as the vector C as follows:

C = (aybz - byaz) i - (axbz - bxaz) j + (axby - bxay) k

You can visualize C as perpendicular to both A and B in the direction of a right-hand screw when you rotate A into B.

Another way to write it is:

C = ab sin(θ)n, where a is the magnitude of A, b is the magnitude of B, and n is the unit normal vector.

In your case, the magnitudes of A and B are the lengths of the sides of the Rubik's Cube. The point that you want is the end of the vector C.

ADDITIONAL DETAIL:

In your case, the vector A runs from the bottom point to the corner on the right; the vector B starts at that common bottom point to the corner on the left. Cross A into B to get the vector that runs perpendicular to the bottom plane up towards the unknown corner point. Make it a unit vector. Multiply the unit vector by the length of the side of the cube. Add the common bottom point to the components of this vector and you have the absolute coordinates of the unknown corner. Repeat for the other three points and you're done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜