A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: How to determine point x,y between two points?

  1. #1
    Member
    Join Date
    Feb 2007
    Location
    Russia
    Posts
    37

    How to determine point x,y between two points?

    How to determine point x,y between two points?

    p.s.
    Sry. I was Ok Math in school but that was long ago I completely forgot most.
    Submit good games here -
    gamebalance.com is my site.

  2. #2
    Junior Member
    Join Date
    Nov 2007
    Posts
    18
    I used equation of segment in this kind of case.
    Let A and B be the initial and final Point and P be any point between A and B
    then we have
    P=A+t(B-A) ......(1)
    where 0<=t<=1
    if you have a point P(x,y), you can substitute it in equation 1 and if the value of t is between 0 and 1 ,the point (x,y) is in between the two point.
    Hope it will solve your problem.
    thanks

  3. #3
    Member
    Join Date
    Feb 2007
    Location
    Russia
    Posts
    37
    Totally not understand this way
    I understand there is
    point1 x1,y1
    point2 x2,y2
    should find point3's x3 y3 that is between point1 and point 2

    Quote Originally Posted by bid
    I used equation of segment in this kind of case.
    Let A and B be the initial and final Point and P be any point between A and B
    then we have
    P=A+t(B-A) ......(1)
    where 0<=t<=1
    if you have a point P(x,y), you can substitute it in equation 1 and if the value of t is between 0 and 1 ,the point (x,y) is in between the two point.
    Hope it will solve your problem.
    thanks
    Submit good games here -
    gamebalance.com is my site.

  4. #4
    Member
    Join Date
    Feb 2007
    Location
    Russia
    Posts
    37
    OH I got it!
    It is
    x3=(x1+x2)/2
    y3=(y1+y2)/2
    It is maybe same as u were say but it was not understandable for me.
    P.S.
    How to change topic state to [resolved]?
    Submit good games here -
    gamebalance.com is my site.

  5. #5
    Member
    Join Date
    Aug 2007
    Posts
    61
    There is a general solution:

    x = p1.x + blend * (p2.x - p1.x);
    y = p1.y + blend * (p2.y - p1.y);

    where blend is the percentage between the two points you want. So if you want halfway blend = 0.5

  6. #6
    Member
    Join Date
    Feb 2007
    Location
    Russia
    Posts
    37
    It seems same as what i figured to go with.
    With this blend i guess it can be found any point between interval. Like 1 = 100% so if i need ~1/3 i go with 0.33
    thanks.
    Submit good games here -
    gamebalance.com is my site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center