We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Cross Product (Read 325 times)
Cross Product
Aug 22nd, 2009, 4:58am
 
hello  

I seem to be having some issues with obtaining the normals of two vectors, using cross product
at the moment i have them as explained below

PVector v3 = new PVector();
v3 =nodes[p][q+1].pos.cross(nodes[p+1][q-1].pos);

line(nodes[p][q].X,nodes[p][q].Y,nodes[p][q].Z,v3.x,v3.y,v3.z);

the issue is that when i do this on a flat surface, the normals
should all be facing up, however it seems that some of them are reversed and facing downwards whilst some face upwards. so im not quite sure what im doing wrong??

does anyone have any suggestions??
Re: Cross Product
Reply #1 - Aug 22nd, 2009, 5:14am
 
I am not expert in the field, but Wikipedia confirms that cross product isn't commutative, so axb isn't the same as bxa, hence, probably, the opposite directions.

Note: the new PVector() just creates an object that is dropped on the next line (as cross() returns another PVector).
Page Index Toggle Pages: 1