Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2006-04-10 02:43:58

jjones
Guest

points

i have and origin and a destination of a line stored as co ords of a grid (x,y)

i need to calculate if another random point is on the path of that line

any 1 know how?

#2 2006-04-10 03:42:12

Jai Ganesh
Administrator
Registered: 2005-06-28
Posts: 45,956

Re: points

Le the point denoted by (x,y) have coordinates (a,b).
The  segment has one end at the origin ( 0,0 ) and the other end at (a,b).
Therefore, the equation of the straight line is
(y-y1)/(y2-y1) = (x-x1)/(x2-x1)
(x1,y1) = ( 0,0 ), (x2,y2) = (a,b)
Thus, yb=ax
or yb-ax=0 is the equation of the segment.
We know the point (a,b). It could be (1,4) or (5,8) or (-1,4) etc.
Thus, an equation in two variables of degree 1(a linear equation) is obtained.
If the random point is a solution for the equation of the segment, then the point lies on the segment. Otherwise, it does not.


It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline

#3 2006-04-10 04:25:51

jjones
Guest

Re: points

thanks for you reply but i am still a little unclear is there anyway u could show me with an example e.g

start of line = (5,5)
end of line  = (20,20)

point = (10,10)

would the point be on the line?

#4 2006-04-10 04:47:27

jjones
Guest

Re: points

my understandign would be that

where x and y is the point
with x1,y1 the start of the line and x2,y2 the end of the line

(x2-x1) * X - (y2-y1) * y = 0

#5 2006-04-10 16:15:09

Jai Ganesh
Administrator
Registered: 2005-06-28
Posts: 45,956

Re: points

The starting and ending point you have given is (5,5) and (20,20).
Let (x1,y1) be (5,5) and (x2,y2) be (20,20).
The equation of the segment would be
(y-5)/(15) = (x-5)/(15)
y-5 = x-5
y-x=0.
The point (10,10) satisifies this equation.
Therefore, the point (10,10) lies on the segment.


It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline

Board footer

Powered by FluxBB