# Polygon ribbons, again...

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

## Recommended Posts

Hi everyone, I need to create a constant-width polygon ribbon from an array of 2D points with either open or closed ends, I have tried two methods with varying results. Neither are incredibly fast or particularly tidy. One relies heavily on trig (a lot of vectors & atan) the other works with offsetting the lines between the points, along each lines normal, and getting the intersections between lines with common vertices... it's faster than trig, but only just. Does anyone know where I can find a good reference or tutorial or even just a method that I can explore? (Googling hasn't helped me thus far, since it seems that not many people call them ribbons :P) Thanks guys and gals.

##### Share on other sites
The first step is to compute the bissector of the angle between two consecutive segments. This is done by adding two vectors of the same length, one from each segment (either two segment normals pointing to the same side, or two segment directions one of which is reversed).

Then, you select the correct length by scaling the bissector by dot(bissector,normal) times half the width of your ribbon. Then, you add and substract the bissector to the endpoint shared by the two segments to get the additional points.

That's three vector adds, one dot product, one scaling.

##### Share on other sites
All the normal placements of the new points are correct, but their distance from the original polygon aren't constant, that is, they don't give a constand line width.

You say that I must get dot(bisector, normal), which normal must I use?

I tried both the segment normals and the normal I had to invert. But all three cases have the bisector length tend to zero as the two segments become close to being a straight line.

##### Share on other sites
Okay, it seems that I have it sussed, I was using the segment vectors to do all my calculations, now I'm using the normals to the segments and it seems to work perfectly! I just have to add exceptions to open edges and I'm done!

ToohrVyk, you kick ass! Thanks alot! :D

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
A4L
13
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013658
×