We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › simple vecotr problem, point midway between two
Page Index Toggle Pages: 1
simple vecotr problem, point midway between two (Read 225 times)
simple vecotr problem, point midway between two
Jan 30th, 2009, 9:06pm
 
Hi
this is a simple vector problem, but I am hazy on my algebra. I have two points and I want a point midway along the length between the two. I could get the vector between the two and the distance and then probably whip something up using that, but I figure there must be a more direct way. Any ideas?

thanks!
Re: simple vecotr problem, point midway between tw
Reply #1 - Jan 30th, 2009, 9:31pm
 
If by vector you mean PVector, I think you can use div() to cut it in half. Then get the new extremity.

Otherwise, I think the coordinates of the mid-way is just (x1+x2)/2, (y1+y2)/2

Re: simple vecotr problem, point midway between tw
Reply #2 - Jan 30th, 2009, 11:16pm
 
yes, that was pretty dead simple. thanks..again
Page Index Toggle Pages: 1