Start of 2d geometry helper functions and structures