Design and implement generic geometry interfaces
We removed classes represent several geometries and added new free functions to operate with point, size (dimension) and rectangle instead.
There are no interfaces for polygon and region.
Closed this ticket.
Ascension.Graphics defines three geometric structures (Point, Dimension and Rect class templates) to provide platform-independent interface.
However, because instances of these classes are not native objects, there are inherent overheads and some inconveniences.
We remove these class templates and provide more generic ways by using strategies (policies), meta functions and free functions.
// Old code template<typename Coordinate> Coordinate distance(const Point<Coordinate>& a, const Point<Coordinate>& b) { const Coordinate dx = a.x - b.x, dy = a.y - b.y; return std::sqrt(dx * dx, dy * dy); } // New code template<typename Point> typename Coordinate<Point>::Type distance(const Point& a, const Point& b) { const typename Coordinate<Point>::Type dx = x(a) - x(b), dy = y(a) - y(b); return std::sqrt(dx * dx, dy * dy) }