# Rotate Rectangles in place Avoiding Superposition?

Hi people,

I am having some trouble working this one out. Probably I am missing something obvious…
I want to rotate each rectangle in place and displace them to avoid superposition between each other.

I tried 2 methods:

Method B. Which consists in calculating the hypotenuse depending on the angle and multiplying this by the nr of rectangles. That gives the total length that the rectangles occupy. It fails when the angles is 90 though, as the cos90 = 0. It also tends to over separate

Method A. Which is a more geometrical method, drawing a line, trimming it and measuring its length. But it also fails at angles 0, 90, 180 as the curve fails to be trimmed.

RotateBoxes_v01.gh (19.0 KB)

This one is another geometrical solution.

RotateBoxes_v01_re.gh (26.4 KB)

4 Likes

Thank you Kim! This looks exactly like what I was trying to achieve.

Other method

rec.gh (13.3 KB)

With math

2 Likes

Thank you @seghierkhaled. There is not difference though, that the rectangles should be rotating in place, that is form their center, not a vertex.

Edit: Nvm, fixed by just creating the rectangle form center! Great!

Yes and (x*2)