PDA

View Full Version : Distance between particle and camera, how to compute?


castelis
01-04-2003, 02:23 PM
I am writing some patricle expressions and i am now facing this problem ( because of my bad knowledge of analytical geometry ). I have knowledge about the position of particle and also about position of camera. What I need is to compute distance between them, I know that it is very trivial (basic) operation for everybody who taked lessons of math on secondary school seriously. Anybody advise me? Castelis

Nicool
01-04-2003, 08:12 PM
I remember in the maya3 doc , their where some lines about it... look at the new one.
And know their exists a node called "distanceBetween". Mel:

createNode distanceBetween;

Sorry, I can't give you more infos :)

JasonA
01-05-2003, 08:11 PM
Nicool's solution would be quicker if you can find that. I just scrolled upon the thread and thought I'd add a comment.

If you can't find some automated function in Maya to handle it for you, you can always use vectors from analytical geometry. Define a position vector (in X,Y,Z) between the two objects and then take the resulting vector's magnitude. In other words, subtract position 1 from position 2 (final minus initial). Then take the square root of the sum of the squares of the resulting vector.

As a forumla,
let camera coordinates = x1, y1, z1
and let particle coordinates = x2, y2, z2,
then
distance = sqrt [ (X2-X1)^2 + (Y2-Y1)^2 + (Z2-Z1)^2 ]

castelis
01-06-2003, 06:49 AM
Thank you thats it. I have to compute distances for each particle so th createNode solution is not effective for me. Thank you both.

CGTalk Moderation
01-14-2006, 02:00 AM
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.