Given the four corners $(x, y)$ of a square, the center $(x, y)$, and a starting direction (ex: $45^\circ$) around a $360^\circ$ rotation ($0^\circ/360^\circ$ at the top), how do you find out the intercept on the perimeter as the direction is incrementally stepped?
What I'm basically doing is taking a circle of radius $(r)$, determining it's area $(A)$, converting that to length $(L)$ of the sides of the square, and then determining the corners $(x, y)$ given the starting center point and the above described direction. This allows for the square to rotate it's starting position depending on the direction. I used the equations below to determine the corners (assuming $(x, y)$ is the center of the circle):
$$\left(x - \frac{L}{2} * (\sin(\text{rotation}) - \cos(\text{rotation})), y + \frac{L}{2} * (\sin(\text{rotation}) + \cos(\text{rotation}))\right)$$ $$\left(x + \frac{L}{2} * (\sin(\text{rotation}) + \cos(\text{rotation})), y + \frac{L}{2} * (\sin(\text{rotation}) - \cos(\text{rotation}))\right)$$ $$\left(x + \frac{L}{2} * (\sin(\text{rotation}) - \cos(\text{rotation})), y - \frac{L}{2} * (\sin(\text{rotation}) + \cos(\text{rotation}))\right)$$ $$\left(x - \frac{L}{2} * (\sin(\text{rotation}) + \cos(\text{rotation})), y - \frac{L}{2} * (\sin(\text{rotation}) - \cos(\text{rotation}))\right)$$
This means the y value will be $$\mathrm{y=\pm\frac{tan\theta}{1+|tan\theta|}}$$
graph.Is this what you mean? This uses the “square” trigonometric functions instead of the normal “circle” functions.
– Тyma Gaidash Jul 30 '21 at 01:54