I would like to simplify a perimeter curve, which now consists of many Lines, by grouping the Lines if they have a similar direction. For example, if the angle between two lines is less than 15 degrees.
I have tried several possibilities, but each time it was not the right solution and/or the lists became very confusing (one of my attempts is attached in the dyn-file).
Some pointers in the right direction would be great!
I have put the start and end points of some test lines in Excel, so that you do not have to run the other .dyn-file including all the files (Revit, etc.) that go with it.
Yeah I thought about that too, but let’s say the Angle of Line “A” is 20 degrees, this would then get rounded down to 15 degrees and Line “B” with 28 degrees would get rounded to 30 degrees. So they wouldn’t get put together correctly even though their difference is only 8 degrees.
True, but that’s just how rounding works. There has to be a “hard break” somewhere. On the flip side, if you had 10 lines all evenly spaced 5 degrees from each other you wouldn’t want them all to be considered the same direction. Even though the difference between any two adjacent lines is only 5 degrees, the set as a whole spans 45 degrees.
If you need to be more concise, you might look at the standard deviation between adjacent lines and try to find the “best” angles to round to based on your actual set of values, rather than prespecified increments. You’d essentially have to use a clustering algorithm, but that could be overkill for what you need.
I’m not sure what you mean by that exactly. A set amount (value) would be 15 degree increments. But if you mean a set number of values, you’d have to divide your range by the number of values you want and then round to those values.
Keep in mind 15 degrees is pretty small for simplifying a curve (depending on how much you want it simplified). In this example, 15 degrees wouldn’t actually reduce the number of curves.
I checked out your method, and unfortunately does it not work (in this state) for my perimeter. This is because my perimeter has parts which are (almost) parallel but not immediately following in the “main” list.