Normal of a Line (Perpendicular lines)

Started by
6 comments, last by jaysonturner 14 years, 1 month ago
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
Advertisement
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!
Thanks, I'll give it a try.
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.
some other ideas
Quote:Original post by szecs
some other ideas
Wasn't yet aware of that thread ... The OP seems to have a popular problem these days :)
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.
I have no intention of including T junctions or U-turns that would involve the 'walls' colliding. Does that simplify this problem?

This topic is closed to new replies.

Advertisement