# Normal of a Line (Perpendicular lines)

This topic is 3207 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I have a path built up of line segments. For each segment I have calculated a perpendicular line either side using this topic. I now have this: The path runs through the center of these lines. Is there a way to have each of the lines join up correctly instead of overlapping? I hope this make sense. Kind Regards Jayson

##### Share on other sites
Hi,

In order to make the lines connect correctly, you'll need to trim or extend every line segment with the next line segment.

You know the start and the end points of the lines which is enough for calculating the line intersections.

Check this link for a line-line intersection test.

According to the results of the calculations, you'll need to extend or trim the lines.

it is possible that in some cases like steep curves with many line segments the line segment may actually be reversed, which may is a case you'll need to handle.

Good luck!

##### Share on other sites
Thanks, I'll give it a try.

##### Share on other sites
The difficulty may be to detect which lines to intersect. There is no problem as long as following a line path, but problems may come up if T junctions and crossings are allowed to occur. I've posted a possible solution in this recent thread which may be of interest.

##### Share on other sites
Quote:
 Original post by szecssome other ideas
Wasn't yet aware of that thread ... The OP seems to have a popular problem these days :)

##### Share on other sites
I have put so much effort to advertise the "idea", that I will implement that some day (to see if works at all). so maybe I have a thread about it too.

##### Share on other sites
I have no intention of including T junctions or U-turns that would involve the 'walls' colliding. Does that simplify this problem?

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013739
×