Jump to content
  • Advertisement
Sign in to follow this  
jaysonturner

Normal of a Line (Perpendicular lines)

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

If you intended to correct an error in the post then please contact us.

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
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!

Share this post


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


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


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!