PDA

View Full Version : calucurate velocity from two points?


deluxmilkman
12-01-2011, 10:12 AM
I need to calculate world space velocity from two positions i have.


vector $position1 = <<1,5,4>>;
vector $position2 = <<5,6,7>>;
vector $velocity = ????? ;



how can i achieve this?

thanks.

berniebernie
12-01-2011, 10:52 AM
I think velocity needs time (v=d/t) but assuminh your time between these two positions is '1', then your velocity is the distance between the two points isn't it ? And the magnitude the speed; so

vector $p1 = <<1,5,4>>;
vector $p2 = <<5,6,7>>;
vector $velocity = <<$p2.x-$p1.x,$p2.y-$p1.y,$p2.z-$p1.z>> ;
float $speed = mag($velocity);

?

NaughtyNathan
12-01-2011, 11:38 AM
or, for simplicities sake:
...
vector $velocity = $p2-$p1;
...;)
:nathaN

berniebernie
12-01-2011, 04:47 PM
:blush:


this is filler text

deluxmilkman
12-02-2011, 09:43 PM
:thumbsup: thanks guys.

CGTalk Moderation
12-02-2011, 09:43 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.