# Math Help - how to find two endpoints of a line..??

1. ## how to find two endpoints of a line..??

Hi...

I have a particular point on a curve.. This curve isnt a smooth curve.. anyways, i need to draw a tangent at this point.. i have the following information in hand:

1. Point P at which tangent has to be drawn.
2. Length l of the tangent.

Now i want the two end-points of the tangent in such a way that P is the mid-point of these new points.. I dont have equation of the curve. i dont know slope of the tangent..

Is there any way to do this.??

2. Originally Posted by rakeshthp
Hi...

I have a particular point on a curve.. This curve isnt a smooth curve.. anyways, i need to draw a tangent at this point.. i have the following information in hand:

1. Point P at which tangent has to be drawn.
2. Length l of the tangent.

Now i want the two end-points of the tangent in such a way that P is the mid-point of these new points.. I dont have equation of the curve. i dont know slope of the tangent..

Is there any way to do this.??

If you only have the coordinates of P and the length of the line segment you'll come out with the equation of a circle around P with $r = \dfrac l2$

3. ## hmm..this might give u a clue

Does point P have coordinates? if they have you could solve for the equation of the slope of the tangent line by using the equation y-y'=m(x-x'). then all else will follow..you could reply to me..of course

4. ## OK guys...

Let me be more precise... Pls refer to the image diagram attached along this post..

You will find 5 points.. I need to calculate points a, b, c and d.. SO i thought i would begin by finding points a, d

lengths (Pa) and (Pd) is not constant.. it may vary every time.. it is called "along boundary length".. So, for a given along boundary length, i need to find these two points a, and d, with respect to P in such a way that,

Code:
l(Pa) = l(Pd) = along boundary length
and points a and d must lie on any of the line segments..

First way i thought was to find the tangent(shown in green), of "along boundary length" and get two end points.. from these two end points i can draw a line which will intersect the arc, and i can get values of "a" and "d"... But now i feel this logic is having some fault..

Now am stuck up.. My ultimate goal is to find values of points a, b, c and d for given set of inputs:

1. Point P
2. along boundary length l(Pa), l(Pd)
3. off boundary length l(ab), l(cd)

Any way to get this solved..??

5. Well this does not seem to make much sense to me. In the first place your green "tangent" line is not unique since you are at a corner. Probably you want the the line that is the perpendicular to the line that bisects the angle apd. But what use that would be when one of your two points as gone past a corner is beyond me. You can easily calculate that line assuming you know the corners adjacent to P.

To calculate the points a(t), d(t) you just need to start from point p. Say d(t) is supposed to be 5 units from p. Then you first see if that takes you past the the first corner heading upwards from p. If it does then subtract that segment's length from 5 . Then see if what is left takes you past the next corner and if so subtract the next segment's length and so on. Eventually you will find which segment you are on, and you can find where you are on it easily enough. And you can do the same for a. I have no idea what points b and c are supposed to be. They look to be perpendiculars to your "tangent line". But your requirement that the two ends of the segment of the tangent you are drawing are equidistant from P means that these points have no particular relation to a and d except while each point is on a different one of the two segments that meet at P. So where are b and c drawn from?
And Why would you want to work any of this out?

6. In the first place your green "tangent" line is not unique since you are at a corner. Probably you want the the line that is the perpendicular to the line that bisects the angle apd.
That tangent is not a part of my problem.. For a given point P, first i need to calculate points A and D.. Then depending on these points, i need to find out points B and C.. Actually i need to draw a rectangular domain, which is perpendicular to the point P.

I have no idea what points b and c are supposed to be. They look to be perpendiculars to your "tangent line".
Not perpendiculars to my tangent.. but perpendicular to points A and D..

But your requirement that the two ends of the segment of the tangent you are drawing are equidistant from P means that these points have no particular relation to a and d except while each point is on a different one of the two segments that meet at P. So where are b and c drawn from?
Further details:
The line drawn is assumed to be a boundary (assume it as ocean boundary or Great wall of china).. and the along-boundary length is the distance between point P and point a & point P and point d..

off-boundary length means the distance away from the boundary.. in this case distance between point p and mid point of line bc..

Actually, the flow goes something like this.. In this system:

1) user will first input the points of the arc(connected line).. Using these points, connected line is drawn.. Among these points one point is point P..

2) Next user will define a region to perform some operation. This region is defined by

i) Inputting the point of interest around which the region is defined. Here in our example, point P is the point of interest, where user wants to define a region.
ii) Inputting the along-boundary length. Using this length, we need to find the points A and D..
iii) Inputting the off-boundary length.. Once Points A and D are estimated, next step is to estimate, points B and C in such a way that distance of point P and mid-point(BC) is equal to the off-boundary length. And these two points need to be perpendicular to point of interest P.

3) After estimating all four points, users region is defined. And this region has to be in a rectangular shape.

4) Once the area is defined, further processing is done..

Any more queries, then pls feel free to ask.. I hope this information makes my problem understandable.....

7. I can't understand your post, and am not inclined to help you with a complex programming exercise, but please note the following very important point.

There is no such concept as perpendicular points. Points are just points. Lines can be perpendicular to one another. What I think you mean is that you want to draw perpendiculars from certain points to a certain line. That line being the green tangent line in your diagram. This green line is the perpendicular through P to the line that bisects the angle between the adjacent segments.
I already told you how to find points A and D in my last post. I don't think there is an easy way to do it.
Next you should construct the perpendiculars from A and D onto the green tangent line.
In general once either A or D has moved past the end of the segment with P as one endpoint, there is no reason for these points to be equidistant from P.
Finally B and C lie somewhere on these perpendiculars.

8. Hey, it works .. but there is some difference in the distance.. i mean if distance is 10.5, it may show, 10.256 or somethign.. anyways, it works but.. thanks.. further i can improve if required...