Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 1015 Bytes

README.md

File metadata and controls

15 lines (8 loc) · 1015 Bytes

circletosquare

This program converts a set of circle coordinates (coordinates underneath the line of a circle with a given radius), into a transformed set of coordinates based on a square with the same diameter (in the shown example with a radius of 256; -256 <= x <= 256, -256 <= y <= 256).

image

into

image

But, I wanted it to not just work at the edges, and to transform any coordinate according to the transformation of the circle into the square. So, for example:

image

Etc. The purpose of this was to see how I would convert a joystick which has the wrong maximum inputs, as a circle, and map them onto correct maximum inputs, as a square. The actual file only has a radius of 1, as that matches with windows' measurement of a controller's input.