Thanks for this great library. I'm trying to employ the offset function on open polylines to create connected wall segments, however each segment can have varying thickness. Do you have any suggestions for modifying the source to accomodate for this? I've messed around with the GetUnitNormal() and OffsetPoint() functions, but so far couldn't produce any consistent results. Thanks in advance for any pointers in the right direction.
Bert van 't Veer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Varying delta by segment should be possible at least when miter joins are used, but to make it work with eg. round joins, it gets complicated as the attached image shows. When delta varies, it is hard to decide where to draw the arc as there are two different sized circles per source polygon vertex.
Thanks Timo, I do intent to use miter joints but I'm having some troubles on the implementation. I'm not sure whether to modify the unit normals or do some magic in the OffsetPoint function. Any hints?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for this great library. I'm trying to employ the offset function on open polylines to create connected wall segments, however each segment can have varying thickness. Do you have any suggestions for modifying the source to accomodate for this? I've messed around with the GetUnitNormal() and OffsetPoint() functions, but so far couldn't produce any consistent results. Thanks in advance for any pointers in the right direction.
Bert van 't Veer
Varying delta by segment should be possible at least when miter joins are used, but to make it work with eg. round joins, it gets complicated as the attached image shows. When delta varies, it is hard to decide where to draw the arc as there are two different sized circles per source polygon vertex.
Thanks Timo, I do intent to use miter joints but I'm having some troubles on the implementation. I'm not sure whether to modify the unit normals or do some magic in the OffsetPoint function. Any hints?
I tried in experimental Javascript FPoint Clipper:
http://codepen.io/timo22345/pen/LpEbWB/left/?editors=101
GetUnitNormal uses these these offsets as a dividend in
var f = 1 / Math.sqrt(dx * dx + dy * dy)
in place of 1 (in Javascript-window)However this is'nt enough as you see, if you rotate the polygons, use negative offset etc.
--> It seems that major refactoring is needed to support per edge based offsets.