View Full Version : Polyline offset...
05-13-2009, 04:29 AM
For my first post I have a maths question... I'm having a LITTLE problem with transforming a polyline into a polygon...
My goal is to get some kind of offset/buffer of a polyline and the biggest problem I have is that on the verts of the lines i get "holes" in the polygons...
Can someone help me with this by giving some advice?
P.S.: I already tried Minkowski Sum but the joining of the polygons gets very hard to do... If someone has some bases for this... :D
Thanks in advance,
05-15-2009, 11:10 AM
My goal is to get some kind of offset/buffer of a polyline
I do not understand.
Look at Delaunay triangulation, it may interest you:
05-20-2009, 04:12 AM
I want to thank you for your answer, but unfortunately that's not what I'm looking for...
For now I have managed to get the polygon I wanted (a polygon that is defined by the polyline and a certain radius that creates a "buffer" involving that polyline... (I don't know if being clear enough but I'm really trying xD))
Thanks anyway dletozeun!
05-21-2009, 09:13 AM
O'key, I think got it.
Do you need to make somethink like a road from central part? I mean, you have some planar linestrip (may be curved), and you need to enlarge it left and right from the curve to make wide quadstrip. Right?
05-21-2009, 09:22 AM
Yes, that's it! You have any suggestions?
I already found a way to do it, but I always like to ear opinions from everyone ;)
Thank you for your reply :D
05-21-2009, 09:45 AM
Well, first of all - sometimes it's too hard to get correct results, because you can have a stitch of radius, say, 1, but your widening offset is for example 2, and you have no way to achieve ideal results. But if forget about it, there are simple solutions.
Me, for getting constant width quads (say, R) I was doing like this: in each linestrip joint I calculated normal bisector N_joint as normalized sum of normals of adjacent segments (say, N_seg_prev and N_seg_cur, these are simply normals to linestrip segments!!). In this direction I enlarged quad left and right. The length of enlargement was R/dot(N_joint,N_seg_prev). Doing so, I achieved constand enlarmenet width. Very first and very last normals were simply segments' normals.
I used this approach for rendering polylines in chart and so on. There are some caveats with texturing. If you want to make good and uniform texturing, you should go in much more sophisticated way, because quads here are trapezoids, and common texturing breaks. But this is another topic :)
05-21-2009, 10:39 AM
Hmmmmmm, I think I get your point but doing it your way, wouldn't the ends of the polygons have some gaps between them?
05-21-2009, 12:19 PM
Mine suggested method creates quadstrip from linestrip. So how could there be any gaps, if it is stripped quad?
I construct it such a way, that first 2 vertices for each next quad are the last 2 from previous one. So there can't be disconnectivity anyhow.
See image below (red vertex are from linestrip, blue - from constructed quadstrip):
05-21-2009, 03:59 PM
Now that's perfection :D I wasn't visualizing your method in the right way :o
Right now I'm using a method wich is mathematicaly very heavy so I'll give it a go with yours to check if the ratio time/effectiveness is worth the try :)
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.