Sign in to follow this  

Normal of a Line (Perpendicular lines)

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 this post

Link to post
Share on other sites

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 this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this