# Point on a Vector?

1. Jun 8, 2009

### frogtag

Hi,
This may seem very basic, but it's been a few years since i did A-level maths!
I'm trying to remember how to work out if a point falls on a vector? I can't remember any of the terms so any info would be appreciated.

thanks

2. Jun 8, 2009

### tiny-tim

Welcome to PF!

Hi frogtag! Welcome to PF!

Well, if you have the equation for a line, and you want to know whether (3,5,6) lies on it, just put 3 5 and 6 into the equation and see if it works.

(Or did you mean something else? … if so, give an example )

3. Jun 9, 2009

### frogtag

Thank you tiny-tim,

Taking the idea of an equation ... I reseached this:

Two points A & B, with a directional vector of AB.
Point ? is the potential bisecting point

x? = xA - (xB)t
y? = yA - (yB)t
z? = zA - (zB)t

The way I see it, (only using x for simplicity) xA is the initial point of the vector and xB is the terminal point. t is a value that holds the values 0 at xA and 1 at xB. Now if x? is on the vector then when you work out the maths then 0 =< t =< 1?

Can anyone clarify this for me please

4. Jun 9, 2009

### tiny-tim

Hi frogtag!

(try using the X2 tag just above the Reply box )
Those equations aren't quite right …

you need x = txA + (1 - t)xB etc …

(this is the parametric equation of the line, with of course t as the parameter)

so at t = 0, x = xA, and at t = 1, x = xB

5. Jun 9, 2009

### frogtag

Too say I'm rusty is an understatement!

Using x = txA + (1 - t)xB

surely when t = 0, x = xB not x = xA?

at t = 0 ...

0 * xA = 0 and this is cancelled out, but (1 - 0) = 1 and 1 * xB = xB, so x = xB?

at t = 1 ...

1 * xA = 1, but (1 - 1) = 0 and 0 * xB = 0, this part is cancelled out leaving x = xA?

I'm guessing i'm not grasping this concept properly!

Also I'm thinking i have to solve the equation to seperate t, ie (simple equation example)

5 = t*9

5 / 9 = t

t = 0.5 reocc.

Like this but with the equation you sent?

Last edited: Jun 9, 2009
6. Jun 9, 2009

### tiny-tim

yes, i wrote it the wrong way round!
I'm not sure what you're trying to solve, but whatever it is, yes, you solve by getting all the t on one side.

7. Jun 9, 2009

### frogtag

This equation will be for a computer AI program. The idea I have is that the vector represents a characters line of sight. Point A in the person. Point B is where they can see to. Now I want to be able to test to see if another person crosses the vector/the line of sight. Now using the equation:

x = txA + (1 - t)xB

xA is the person.
xB is the furthest point of sight.
x is the person crossing the vector.

The only variable I have left is t, so what i need to do is isolate t so that i can test its value to see if it's within the ranges of 0 to 1 and thus within the person line of sight.

Just having difficulty with the equation. More than willing to do the hard work if you could point me in the right direction?

This is what I've got so far...

1 - ( x - (txA) / xB ) = t

not great ... and probably not right?!

Last edited: Jun 9, 2009
8. Jun 9, 2009

### tiny-tim

I don't get it.

Is x stationary, or is x a line?

If x is a line, it will need another parametric equation (with a parameter u, say, instead of t), and then you can ask whether the two lines cross.

9. Jun 10, 2009

### frogtag

Because its a computer program I have to use timed intervals to check on the position of x to see where it is. It's like taking a film of a ball moving and checking each frame to see where the ball is. So x will be considered a staionary point.

For the moment yes. The process i'm taking is to develop the visual parameters bit by bit. For this moment, version 1.0, my basic visual parameter is a single line of sight from the person to a set point directly ahead of them. The next versions will see detection of a point within a fan. Then expanding to peripheral vision, so several fans, etc... I think its better to crawl before I walk!

I looked at my old equation and saw I made a mistake. It should have read:

x = xA + (xB-xA)t

x = txA + (1 - t)xB

because I don't understand the concept of your equation. Mine seems more simple, and with it there is only one t and I'm able to isolating it, as such:

x - xA
------- = t
xB - xA

then, the way I see it, if the t value is the same for x, y and z equations, then point [x,y,z] will sit on the vector/line?

10. Jun 10, 2009

### tiny-tim

Yes, they're the same.
oh i see what you mean …

yes, if (x - xA)/(xB - xA) = (y - yA)/(yB - yA) = (z - zA)/(zB - zA),

and if that value is between 0 and 1,

then (x,y,z) lies between A and B

11. Jun 11, 2009

### frogtag

Marvellous. Thank you kindly for your help Tiny-Tim, you're a star!