Skip to main content
14-Alexandrite
November 6, 2024
Solved

Finding the distance between a line and point

  • November 6, 2024
  • 1 reply
  • 3320 views

Hi there, 

How can I draw the lines with specific points... in pervious thread we draw them each 200 m >>> Can it be drawn in specific distance using these values ( using the metreage values)

I tried to change the markers  

YA_10963798_0-1730890425769.png

and then I need to find the distance between these new lines and all the (Se-CPTs) points .  the distance between  the green point and the nearest metreage line 

YA_10963798_1-1730890707534.png

And then showing them in a plot .

BTW>> I start using mathcad prime 10

Everytime I struggle in mathcad I say I will do it myself , but it is new concept eachtime and I can't reach what I need without your help. Thanks in advance. 

Yusra 

 

Best answer by Werner_E

@YA_10963798 wrote:

Ok... I think the best is to find distance from P to point #2 

NO!!!! You don't mean the distance to POINT #2 !!! You sure are talking of the distance to the LINE through point #2.

There is a huge different if you say point or line!

 

What would be perpendicular to the road when the road is just a number of line segments. The definition of the direction I meant was how you would define perpendicular in that case.

Look again to the sketch with the five points. Would you really say that the red lines are perpendicular to the blue street?

They are just perpendicular to one of the line segments joining. They could as well be perpendicular to the other one or we choose a direction in between. There are many ways we could define the direction of the road "normal".

If it doesn't matter because the points forming the road are very close to each other and the road does not show a large curvature, then we could stay with my approach.

 

My new approach which is attached here uses interpolation to determine more precise the point with the given meterage. So most of the times none of these "red" points will be exactly one of the given "blue" A-points but rather would the red point lie in between two blue points. And so i define the normal to be normal to the line segment the point lies on.

 

The attached file contains both ways to define the distance and also provides means to plot the difference line segment. But even if you zoom in it looks confusing because there are way too much "green" CPT points too close together:

Werner_E_0-1731046050420.png

 

Before you use/send this file again you sure should clean it up, deleting all unnecessary or duplicate calculations and plots. When I played around with it it got slower and slower up to the moment when Prime would not react at all and I had to forcefully close the program via task manager.

Attached file is in P10 format

1 reply

25-Diamond I
November 7, 2024

Its never a good idea to change the rule in midst of a game!

That said, the attached is just a quick hack to modify the already existing function makeMarkers to plot markers a positions provided by a vector.
Maybe you can use and modify it to your needs.

But your vector Meterage contains values which are far too large!! The whole length of the object is just 7500. So values like 22000 would have which meaning??

Werner_E_0-1731004670372.png

 

According your question of finding the distance between a point and a line (I don't think you really mean that as that would be basic maths) I have no idea what you actually are looking for and I must confess that your file with all the remainments of previous questions id far to confusing for me to be able to further invastigate.

 

 

14-Alexandrite
November 7, 2024

Hi Werner, 

I hope you are doing well. Thank you for answering my question, 

 

Actually I collect all the answers I get from you in a file and the ones I get from Stuart in another file then I use them in my orginal file.

 

For the meterage it is too easy to implement it in AutoCAd  ... I think depending on your last file I can manage to add them. Sorry I provided the points of meterage not the distances I changed them as below 

YA_10963798_0-1731006667695.png

 

 

What I meant by  the distance between the line and The selected CPTs ... Can you see these green points ...I want to find the distance between them and the nearst red line you draw 

YA_10963798_1-1731006801864.png

YA_10963798_2-1731007274398.png

Sorry again when I work with more than one program I mix between them and provide wrong data 

thanks in advance 

Yusra 

 

25-Diamond I
November 7, 2024

Are you really talking about the distance from a point to the (theoretically) infinite line! Not to point on the blue street/river/orwhatever for which the the line is just a marker?

After all m red lines may look like the are perpendicular to the blue line, but actually thats just a crude approximation as a right angle never was demanded (you were initially talking just about 'vertical' lines).

Actually my red lines are perpendicular to the previous line segment.

 

Look at the sketch below.

The point P has the shortest distance to the red marker line associated to point #2, the point of the blue line closest to it it point #4.

So what kind of distance is the one you are talking about?

Werner_E_0-1731010000509.png