|
-
Apr 24th, 2006, 07:43 AM
#1
Thread Starter
New Member
help needed
hi,
I have a line drawn on a grid all i know is start and end co-ords of the line from the start co-ord i need to calculate a point on the line that is just slightly further down the line than the first point. is this possibe?
-
Apr 24th, 2006, 02:07 PM
#2
Fanatic Member
Re: help needed
If I understand correctly, you have the coordinates of 2 points that define a line (let's call them x1,y1 and x2,y2) and you want to know the coordinates of a point x,y that is a certain distance d along the line from x1,y1 in the direction of x2,y2. If that's what you are looking for, following methodology applies.
1. The line is at an angle to horizontal. The tangent of the angle (theta) is: tan(theta) = (y2 - y1)/(x2 - x1). Calculate theta
2. The unknown point x,y is a distance d along the line from point x1, y1 in the direction of x2,y2.
x = x1 + d*cos(theta)
y = y1 + d*sin(theta)
-
Apr 24th, 2006, 04:45 PM
#3
Re: help needed
Or you can calculate the length of the line L to be sqrt(dx^2 + dy^2), where dx is x2 - x1 and dy is y2-y1. If you are looking for distance l along the line D, then x' = x1+(dx*l/L) and y' = y1+(dy*l/L).
It amounts to the same thing.
zaza
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|