PDA

View Full Version : How to write "d = norm(cross(B-A,P-A))/norm(B-A)" in maya expression?


deluxmilkman
03-29-2012, 02:41 PM
d = norm(cross(B-A,P-A))/norm(B-A);

This is a formula for finding the distance between a point and a line segment in 3D space.
A, B, and P are all vectors.
Maya expression is not taking "norm" procedure.

Thaks

NaughtyNathan
03-29-2012, 03:17 PM
there is no procedure "norm". I think you want "unit"

haggi
03-29-2012, 03:54 PM
I suggest the usage of mag() because I suppose you need the length of the vectors.

deluxmilkman
03-29-2012, 04:04 PM
yeah, the fornula was wrong.
it was mag.

d = |(P - A) x (P - B)| / |(B - A)|

where "|..|" denotes the magnitude value (positive) and "x" is the cross product.

thanks.

CGTalk Moderation
03-29-2012, 04:04 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.