Calculate a vector from the center of a square to edge based on radius
Given a square (described by x, y, width, height) and an angle (in radians) I need to calculate a vector that originates at the squares centre and terminates at the point that collides with the edge of the square at the given angle. I'm really most interested in the point it collides at so if that would make calculation more efficient let me know. Can this be generalized to Rectangles? How about polygons in general? The vector will be center + (cos(angle), sin(angle))*magnitude . Given that you want to intersect this with a square, you need to determine magnitude. You can get that with a