I was doing something the same. Given a site boundary, I want to create a concuptual massing.
Last time, I had a uniform setback that I can assign so it was easy. However, this was very limiting so I decided to add varying setbacks for each sides of the site.

I searched through the entire forum and found varying solutions on how to achieve different setbacks as the direction is not very consistent.
I found Kyle’s blog and explanation to be the best solution so I tried to re-create the graph as I couldn’t download Kyle Martin’s graph from his link anymore.

It works fantastic with one major problem, when the two converging lines meet at more than 180 degrees on the internal side, it takes the external angle and so the point created is at the external.

I haven’t looked into your script yet but if you’re just looking for a way to find points where internal angles are more than 180 degrees, you can use the vector cross product of the direction tangents of the curves meeting at those points.

In a closed polygon, if there are no re-entrant corners, the cross product of direction vectors at any point will all have the same sign (positive or negative). But the sign will change at re-entrant corners. You could then use this to add conditions to your graph to tackle the problem.

Note that this will only work if the polygon has been constructed in a structured manner (points connected clockwise or anticlockwise). If this isn’t the case, another approach may be required.

The reason it wasn’t working as you already found out was when Vector.AngleWithVector was greater than 180 as the node itself does not allow returns of over 180. So I wrote the whole script into python with a while node where it checks if the points are within the boundary and if they are not, it gets the opposite angle (360-theta) and does the process again.

It seems to work but test it out and let me know. Setback.dyn (37.8 KB)