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

03 March 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.


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

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

03 March 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.


CGTalk Moderation
03 March 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.