Create wall offset from lines

Hello everyone,

I’m currently working on a project where I need to create surfaces to represent the bases of walls. To achieve this, I’m offsetting lines by specific distances. However, I’ve encountered an issue where the offset lines end up overlapping each other.

To tackle this problem, I’ve been trying to develop a logical algorithm. The idea is to extend the lines when they encounter convex corners and trim them when they encounter concave corners. This approach works well for polylines, but I’m struggling to find a solution when three walls share a common point, as depicted in the image below.

In the image, the red lines represent the lines I have in Grasshopper, and the brown surfaces are the desired outcomes.

I’m reaching out to see if anyone has encountered a similar challenge or has suggestions for an algorithm that could address these scenarios. Your insights would be invaluable @DanielPiker @Quan_Li @Joseph_Oster

Thank you in advance

Wall lines.gh (2.1 KB)

many questions :slight_smile:

  • how do you define the offset direction of each line?
  • would be acceptable for your workflow to offset half distance on each side of each line?
  • the final output you want is a unique surface for all the curves which have an end in common, or you want to have all the single surfaces from each line?

Sure :slight_smile:

  1. The offset is a positive value following the direction of the creation of the lines (from the initial point to the end point, the positive values go to the right side). The lines are created following that criteria so when applying the offset, the result is what I want. What I would like to solve is the overlapping problem. (Green lines in the picture are the offsets and red lines the initial lines)

Half distance on each side it is not acceptable in this case

The final output should be all the single surfaces from each line as shown in the picture

Thanks for your help!

clear, thanks for the explanations :+1:

I’m think to a completely different approach, which is based on overlapping areas at intersections, and missing overlapping areas at corners
and I’m thinking at this because sometimes you have to extend a curve, sometimes you have to shorten a curve, and you need a reliable and repeatable system to make choices

for instance, these numbers indicate how many end-points coming from different lines are accumulating at a given point:

image

and this sort of leads me to think:

  • whenever you have just 1 point, then things are ok as they are
  • whenever you have 2 end-points together, one of the two lines should contract/expand by a full width
  • whenever you have 3 end points together, one of the two colinear lines should for sure contract by full width, and the non-colinear one may contract or not

then it’s more a matter of deciding which of the candidate lines receives which treatment and why

I did a very fast sketch of the idea, full of repetitions, bad practices and stuff like those in the form of a loop, but it should be corrected using MANY more sample-lines because there are many cases not covered in the simple file you attached

could you please provide some more sample lines?

be aware: opening the file will send you to hell without dying ._____.
[and it needs the plugin Anemone for looping]

Visit_hell_without_dying.gh (44.8 KB)

1 Like

you need a logic of priority that determines which surface (or line) trims the other

2 Likes

Thank you @inno that was a very interesting approach! I really appreciate seeing your point!

BTW, Is there a possibility of replacing Anemone plugin by a Python/C# Component. I would like to avoid extra plugins if possible

Here you have a GH file with the lines I have to cover. The result for data tree level 3 for example should be something like this:

Although in this example I do not have them it can also be possible to have an intersection with 4 lines with a coincident point

Thanks again for your help!

Wall lines_1.gh (3.8 KB)
Wall Lines_1.3dm (43.3 KB)

I have no idea :slight_smile:
for sure you can code the whole thing and run it inside the Script component itself… but that’s something much more complicated

regarding the behaviors, I think the most important points are, given a point P where lines are meeting:

  • how many lines meet at P
  • the angles between them
  • their direction (because the direction of the curve defines the direction of the offset)

in the cases you have provided, only a relatively small subset of all possible cases are present: I think it’s important to define if the missing cases are never present, or if they might be present but are just not in those samples

for instance:

this short sentence defines a whole new group of possible cases :smiley:
and the thing of having the curve direction to determine in which side the curve is offset generates many more possible cases

I’m starting to believe a simpler approach likealways extending any meeting curve by its thickness, create its surface, make some booleans (solely with Clipper2 plugin, so it’s another no-go :frowning: ) and see the result might be a better approach :slight_smile:

1 Like

Thanks for your time and for your help @inno I really appreciate it :slight_smile: