PDA

View Full Version : cross product in higher dimensions

 tbaypaul11-28-2006, 02:32 PMI'm trying to help the guy with his VD (voronoi delauany) problem, but I am rusty on my cross product in dimensions greater then 3. Given two vectors u and v in 4 coordinate space. What is the cross product? I have as my result the vector: u2 * v3 - v2 * u3 , u3 * v4 - v3 * u4 , u4 * v1 - v4 * u1 and u1 * v2 - v1 * u2 Is this correct?
Maelcum
11-28-2006, 05:13 PM
Take a look at Wikipedia, especially here:

http://en.wikipedia.org/wiki/Cross_product

M

grantimus
11-28-2006, 06:15 PM
[(u2*v3-v2*u3)+(u2*v4-v2*u4)+(u3*v4-v3*u4),
(v3*u4-u3*v4)+(u3*v1-v3*u1)+(u4*v1-v4*u1),
(u2*v4-v2*u4)+(v2*u1-u2*v1)+(u4*v1-v4*u1),
(v2*u3-u2*v3)+(v2*u1-u2*v1)+(v3*u1-u3*v1)]

I don't know if you're using MEL or the API. But, if you're using mel here is a procedure that will help you out:

global proc float[] gt4DCross(float \$u[],float \$v[]) {
return({(\$u[1]*\$v[2]-\$v[1]*\$u[2])+(\$u[1]*\$v[2]-\$v[1]*\$u[3])+(\$u[2]*\$v[3]-\$v[2]*\$u[3]),
(\$v[2]*\$u[3]-\$u[2]*\$v[3])+(\$u[2]*\$v[0]-\$v[2]*\$u[0])+(\$u[3]*\$v[0]-\$v[2]*\$u[0]),
(\$u[1]*\$v[3]-\$v[1]*\$u[3])+(\$v[1]*\$u[0]-\$u[1]*\$v[0])+(\$u[3]*\$v[0]-\$v[3]*\$u[0]),
(\$v[1]*\$u[2]-\$u[1]*\$v[2])+(\$v[1]*\$u[0]-\$u[1]*\$v[0])+(\$v[2]*\$u[0]-\$u[2]*\$v[0])});
}

tbaypaul
11-28-2006, 07:14 PM
Thanks,
yeah, that proc is exactly what I need.....I knew I was missing terms in each of the coordinates...

CGTalk Moderation
11-28-2006, 07:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.