Line to grid offset - angles problem

im working on a line to grid offset patch and cannot keep a consistent wich-side-is-wich behaviour when the line flips. any idears ? tx

line to grid problem with angles.zip (15.3 kB)

you could check the value before and if there is a jump subtract 0.5 from all following angles until there is another jump…

as i hate these problems i made a plugin which smooths out the angles:

line to grid offset - no problem with angles.zip (30.1 kB)

yes thats it thanks alot, esp for the plugin