This demonstrates using the cross product in an expression in prepping normals for copy stamping.
Mathematics and Houdini.
Date Created:Friday February 16th, 2007 06:31 PM
Date Modified:Saturday August 02nd, 2008 01:05 PM
First add normals using a Point SOP.
Then shift the point numbers using a Sort SOP. This shifts the point number 0 to 1, 1 to 2 etc...
Now, using another point SOP, we take the difference of the point position of the shifted points and the original points. This makes it so point 1 will point directly at point 2, and so on.
We now use the cross product on the vector from the pointed normals, and the original normals, and extract the vector 0, 1 or 2 depending on which value we need. We can extract a vector using square braces, for example, putting  on the end of a function that returns a vector will return the first component in that vector. 0 is for x, 1 for y, and 2 for z. This value is also normalized between 0 and 1 using the normalize() function.
normalize( cross( vector3($NX,$NY,$NZ), vector3($NX2,$NY2,$NZ2) ) )
A brief overview of the network.
Download: crossproduct.hip 68 KB
Please login or Click Here to register for downloads
Cross Product by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com