Another offset-question: I have a tree of multiple offsetted polygons (file attached). The offsets are irregular. That means there are sides that are offsetted by a different distance. E.g. “0” → No offset. Therefore I´m not using normal offset-components such as Clipper. As you can see in the images the offsets start overlapping when the offset-distance becomes bigger. I´ve tried a bunch of methods to remove those “wrong” offsets:
A) By area: Remove small offsets: Doesn´t work because the size of the input-geometry can be very small or very big.
B) By edge-length: Remove offset-segments that are below a certain length: Doesn´t work because “wrong” offsets can have high lengths as well.
C) By edge-amount: Remove those offsets whos segment-count does not equal the “parent” polygon: Doesn´t work because a wrong offset can have the same amount of segments as its parent.
D) By polygon-center: Keep only the polygons that surround the centeroid of the parent-polygon: Doesn´t work because correct offsets might not enclose the parent-centeroid.
I think a good approach would be to remove offsets that intersect with other offsets. But I can´t manage the tree-structure Help! Thanks in advance.
I see in your example there is already the offsets that are cutted. Bad news the orientation is quite always the same. You must improve this and split the self intersecting curve and keeping the original direction. So you could them calculate the good winding direction and then cull the “bad” curves.
As you added to your answer: My polygons are all in the same direction. I´m using fennecs “Region” component to “cut” the offsets. How would you cut the offsets in order to correct the winding? That´s my definition:
OK if you begin with a good topology.
What I understand from your tool is that.
For a polyline all segments have a factor of offset (0 to offset distance)
With that you make a new polyline.
You have to find the self intersection
Cut the curves at the self intersection and make N polygons
Calculate the winding of the polygon
Just keep the good winding polygons
I think you must do all the steps in your own program (Python C# …) in order to be sure to keep tracks of the good orientation. It is not clear how you manage to do that.
Exact. It´s also not clear to me how I manage to do that I mean I`m quiet close to what I want. Rewritting all operations is no option for me. What do you think about the method of removing offsets that simply intersect others? Correct offsets do not intersect with others - Wrong ones do. So that might be a way to cull the wrong ones? Thx.
I went in a completely different direction, it works for these cases but may not for others.
The idea is to create planes from the initial polyline (one per segment), offset these planes accordingly (1 or 0), split the surface and retrieve the only piece of surface that is “inside” all the planes.
I made all efforts to remove custom plugins that would have made some operations significantly easier, but I’m still using Elefront’s Graft Parallel at some point.
I´m going insane! Why is it so hard to build a robust algorithm Does the triangle not intersect on the top edge with another polygon? But I agree in this case the decission has to be done which offset is the correct one
Maybe one could find the “first” bad offset and cull all the upcomings…
You mean convex polygons, but I agree, so this is not a general solution but hopefully enough for this case.
I tried to remove curves based on their intersections with the previous curve (test if curve N intersects N+1, get all True statements and cut the list at the first occurence of True), but this fails for polygons where one edge is not offsetted.
It is why I think Rhincommon could be used because Intersection could be a point or an overlap. I don’t know if a Grasshopper component was done to mimic this.
It gives me exactly what I want. My polygons will only be convex so this is quiet an awesome solution. I certainly have to study and understand this definition. You guys are amazing.
I tried something but this quite crazy. I split the concave region into convex regions using bisectors at concave points. Then use the script above to compute the paths for each convex region, assuming a 0mm offset along the bisector. Then merge the polylines by removing the overlapping segments…
Unfortunately this “random” segmentation is not suitable for me since I´m dealing with real-world geometry (buildings and properties). Does your definition take the “irregular” offset into account? E.g. one side should not be offseted at all?
Your definition doesn´t work for this polygon The provided polygon resembles the outline of a real-world-property. I want to generate an offsets to each side. Some sides might have different offset-values than others.
I think I solved this problem: The aim was to create mulitple offsets of multiple polygons that
A) Are irregular meaning that some sides of the offsets had a offset distance of 0 m.
B) Work for concave and convex polygons.
C) Would not create “overlapping polygons” if the offset distance became to high.
To achieve this I created a “previous offset” meaning that I´ve moved sides that should have a 0 m-offset outwards by a high value. Then I used the clippr plugin to offset all polygons by multiple values (no overlaps (C) ). Then I trimmed all offsets by the polygon outline. This would create the 0-m-offsets where needed (A). This works for concave polygons as well (B).