Shortest distance between 2 lines on every point on those lines.

Shortest distance between 2 lines on every point on those lines.

stefanveurink68AXD
Advocate Advocate
5,186 Views
14 Replies
Message 1 of 15

Shortest distance between 2 lines on every point on those lines.

stefanveurink68AXD
Advocate
Advocate

Dear friends, 

 

Situation: There's 2 roads next to eachother. The are not parallel, and have curves in them. 

 

Now: i need to give the distance between them roads along the full road. in other words, i need to draw the side of the first road as a straight line, and the side of the other road (which is a collection of points) as a pline with a certain (shortest) distance from that straight line on every point along the line.
So output should be 1 straight line (the side of the first road) and one line (the side of the second road) with curves and stuff. With this output you can see the distance between the lines in the blink of an eye.  

I hope u understand what i mean. 

 

Any suggestions on how to do this?

0 Likes
5,187 Views
14 Replies
Replies (14)
Message 2 of 15

Erense
Collaborator
Collaborator

If i understand correctly,

 

You take the first road line as basepoint.

Then you offset the measured distances for the second road.

Perpendicular to thes lines you have a (i assume) set distance between the measered points. (like 1 mtr)

Offset these lines and draw a pline over the intersection of the lines.

For obvious visibility reasons break the PLine into 5/10 points, remove the old lines, and only then offset the next few distances.

 

 

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!

Kind regards,

Edwin Rense
Cadac Group AEC BV
Supporting Consultant AEC
Cadac Group .
0 Likes
Message 3 of 15

j.palmeL29YX
Mentor
Mentor

@stefanveurink68AXD  schrieb:

 


I hope u understand what i mean.


 

Nope, sorry. Show us a sketch please what you have and what you expect.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 4 of 15

stefanveurink68AXD
Advocate
Advocate

Thanks for the fast reply.

 

I think I understand your answer. It's kind of measuring de shortest distance on certain chosen points, and draw those distances in the new situation (and then connect them). I think this is a working answer. 

 

The answer i'm looking for however is a more general one. I don't want the distance on SOME points on the different lines, but on ALL the points on the line. Of course there mathematical is a approximation boundary (like u said 1 meter as example), but i'd like a much closer gap, 0.00001 meters for example. U problably understand your method then becomes too much work, so I'm hoping for a more general sollution. 

0 Likes
Message 5 of 15

stefanveurink68AXD
Advocate
Advocate

I'm not allowed to give u the situation it's needed for but i hope this drawing makes it more clear

0 Likes
Message 6 of 15

j.palmeL29YX
Mentor
Mentor

@stefanveurink68AXD  schrieb:

... I i hope this drawing makes it more clear


 

It's not yet clear for me, sorry. For example the straight line at the right has a length of 82.053, on the left side I find no curve with this length ... ?

To clarify for me (us?): Please can you add in your drawing some (> 5) lines where you mess the "shortest distance" and then at the right side these lines again where they create the new curve (i.e. where we find the measured distances).

 

(BTW: I have not yet an idea how to solve the problem. At first I try do understand the challenge ...)

 

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 7 of 15

parkr4st
Advisor
Advisor

is not "all points on the line" an infinite set? 

 

dave

0 Likes
Message 8 of 15

j.palmeL29YX
Mentor
Mentor

@parkr4st  schrieb:

is not "all points on the line" an infinite set? 

 

dave


 

An approximation with a finite number of points is permissible (0.00001 meters was mentioned above as an example).
Whether and how AutoCAD copes with a curve consisting of a very high number of points is another question.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 9 of 15

Erense
Collaborator
Collaborator

Sorry, but when you are talking about roads i assumed there is a bigger margin than your later stated 0.0000001 mtr

 

I cannot believe any road (or infrastructure object) wil ever be created with this narrow margin. When you're a cm off on a road no-one wil notice.

So maybe you have provide a confusing example and no 'real world' example. Like in machinery you wil find 4 decimals values for mm sizes.

Thats where i went off.
Like @j.palmeL29YX said, this margin is even to small for AutoCAD to cope.

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!

Kind regards,

Edwin Rense
Cadac Group AEC BV
Supporting Consultant AEC
Cadac Group .
0 Likes
Message 10 of 15

j.palmeL29YX
Mentor
Mentor

@j.palmeL29YX  schrieb:

@stefanveurink68AXD  schrieb:

... I i hope this drawing makes it more clear


 

It's not yet clear for me, sorry.


 

To describe one of my problems in my mind see the attached pic.

Assuming we have a curve1 and a curve2.
Following the curve1 from left to right, we see a minimal distance to curve2 at point P2. Then the distance is growing until we reach point P2. At the next points the distance decreases again (P3). Hence the range between P2 and P3 of the curve2 will be ignored completely. I doubt you'd want it that way.

An other (bigger) problem: If we follow the curve2 and mess the minimal distances to curve1 we will get an entirely different result.

I think you need to completely rethink the task. (We don't know what you finally expect).

 

cadder

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 11 of 15

j.palmeL29YX
Mentor
Mentor

Here is one of several possible interpretations of your problem (if I understand you right) with a proposal for a solution in principle. (I did it manually).  See attached .dwg from up to down.
- Given are two rails (blue). First we draw a new curve (red) in the middle of the two blue curves. This is already a problem of its own, and has been discussed many times - without a final solution. I used this method: draw a high number of neighboring circles that touch the two blue curves tangentially. Then draw the red curve using the centerpoints of this circles.
- Then place a short  line perpendicular at an endpoint of the red curve and array this line along the curve in a given distance (here 5000). Let this lines reach from one blue curve to the other (trim/extend). (Another variant could be: draw a set of lines lines from one blue curve to the other curve using the the points, where a circle touches the both curves. Check which variant gives a better result for you).
- Now draw a staight line with the length of the red curve. Place vertical lines in the same distance as above and give each of the lines the same length as the appropriate line of the pattern above.
- Last you can draw a final spline using the upper endpoint of all this vertical lines.

 

Is this what you are looking for?

If yes: Then you have "only" one problem to solve: automate this process (because of the very high number of definition points). Good luck finding a programmer who will take care of this task. (or you can do it yourself ?).

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 12 of 15

Kent1Cooper
Consultant
Consultant

@stefanveurink68AXD wrote:

.... i need to give the distance between them roads along the full road. ….


 

The impossibility of this, in my mind, is to define the "distance between the roads."  If I space points equally along the lower one [green], presumably the distance from each point to the other road is perpendicular from that point to the other road  [red lines]:

Roads1.PNG

It seems obvious that isn't going to be what you want.  The points closer to the ends don't even have a perpendicular to the other road.

If distance is perpendicular, that's not the same from each road's "point of view."  Here, the distance from the lower road at A to the upper road hits at B, but the distance from the upper road at B to the lower road hits at C.

Roads2.PNG

So which [if either] is the "distance between the roads" there, and where exactly is  "there"?

If I do an "average" route between the two road center-lines, and space points along that, the distances [if perpendicular] from the same point to the two roads aren't in anything like opposite directions from that point:

Roads3.PNG

So again, what's the "distance" between them?  The sum of the lengths of those two red lines?  That doesn't seem right either.  The distance between the points where the red lines hit the road center-lines?  Even that is greater than the distance from either road measured perpendicular to the other.

 

If you can be specific about what constitutes  the "distance" between them at a given location, and where that location is  [on one of them? between them? where  between them?], maybe something can be worked out.

 

Kent Cooper, AIA
Message 13 of 15

parkr4st
Advisor
Advisor

define the points.  MEASURE can put points on the lines by a given number or distance.   use as many as you want to the precision you want.

data extract the x,y coordinates of all the points

for each point on the straight line paired with all the points on the curved line solve for distance  

 (delta x)^2 +(delta y)^2 = distance^2

unless there are z values involved in which case use the appropriate math

query for the minimum from each solution set.  which is the shortest distance between the two lines from a point on the straight line to a point on the curved line.  in cases where y1 = y2 the line is vertical (north-south).  x1 = x2 the line is horizontal. (east west)

purely a guess an my part but that is what I interpret out of your vague request in the OP.

 

dave

 

 

 

0 Likes
Message 14 of 15

Spakron
Participant
Participant

Hi, I just saw this message and I have the same problem to solve (measure the shortest distance between 2 curved lines) BUT measure the distance between A NUMBER of points within these lines (we can set the number of points manually) Since you mentioned that there might be someone that can do this programming task, do you know anyone that would be able to do it? or where should I search for help to solve the problem?

0 Likes
Message 15 of 15

Kent1Cooper
Consultant
Consultant

@Spakron wrote:

... measure the distance between A NUMBER of points within these lines (we can set the number of points manually) ....


I have a LADDER command that does that with two Line paths.  Attached is a modification called LADDERC.lsp with its eponymous command name, to work with two paths of any finite kind with linearity [anything in the (vlax-Curve...) class other than Rays/Xlines].  It divides the length of each path object equally within itself, which means it works well with "clean" path relationships:

Kent1Cooper_0-1626270457860.png

and gets a little weirder as the configurations of the two paths get a little more variable:

Kent1Cooper_2-1626270702747.png

but goes kind of wacko if they're very different:

Kent1Cooper_3-1626270827316.png

So it's appropriate in certain kinds of relationships and not others.

 

[The source routine is from 12 years ago, and if I were to write it today I would do certain things differently, but all I did was modify it minimally.  Very lightly tested.]

 

Kent Cooper, AIA
0 Likes