Deleting Pattern Geometry which is too close together (Populate 2-D+Rotation)

Hi there!


Working on a code to generate rectangles of a uniform size, but populated 2-D according to a picture’s brightness. The rectangles are angled according to a jittered/random degree. It’s working fairly well so far, but I’m running into 2 issues I’d like to resolve:

1 - I want to be able to rotate the squares in the opposite direction - it’s only rotating in the positive degree senses,

2 - I’d like to delete/cull the squares that are too close to each other (anything closer than 3/16", but the model is in mm right now)

A photo of the ideal is attached, and also some screenshots from the code.

If anyone can help I’d really appreciate it!

20.07.16-1806-SMHL-Exterior Screen Pattern-gh.gh (2.1 MB) boundary-help.3dm (791.0 KB)