AtrusDni
07-13-2009, 06:33 PM
I am working on a script, to test if points lie on a side of a plane or not. Basically I get the plane matrix and multiply it by the normal and test if the point is behind the plane with this:
float $value = ($pntPos - $planePos) * $wPoint;
$pntPos is a vector representing the xyz position in space that I want to check.
$planePos is a vector representing the xyz position in space of the plane.
$wPoint is the worldspace normal of the plane.
I am using xform -q -m pPlane to get the rotation matrix from the object and am multiplying that by the plane normal so I get the normal in world space.
It works quite well, BUT! it is not fast because it has to interact with geometry, and has a bit of overhead. I would like to do this all through mel with no object interaction, and have it be strictly math based. So, my question is . . . .
How would I go about accuiring the rotation matrix of an object if:
1) I have an XYZ vector describing its position, so thats good to go.
2) If I have two points XYZ position, how would I (thru mel) get the direction vector pointing from one to the other? (this would be the same as a plane's worldspace normal, am I right?)
Thanks again for the help! I am no good at math so I am learning as I go.
float $value = ($pntPos - $planePos) * $wPoint;
$pntPos is a vector representing the xyz position in space that I want to check.
$planePos is a vector representing the xyz position in space of the plane.
$wPoint is the worldspace normal of the plane.
I am using xform -q -m pPlane to get the rotation matrix from the object and am multiplying that by the plane normal so I get the normal in world space.
It works quite well, BUT! it is not fast because it has to interact with geometry, and has a bit of overhead. I would like to do this all through mel with no object interaction, and have it be strictly math based. So, my question is . . . .
How would I go about accuiring the rotation matrix of an object if:
1) I have an XYZ vector describing its position, so thats good to go.
2) If I have two points XYZ position, how would I (thru mel) get the direction vector pointing from one to the other? (this would be the same as a plane's worldspace normal, am I right?)
Thanks again for the help! I am no good at math so I am learning as I go.
