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


#1
 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


#2

there is no procedure “norm”. I think you want “unit


#3

I suggest the usage of mag() because I suppose you need the length of the vectors.


#4

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.


#5

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.