Ticket #25301

Design and implement generic geometry interfaces

Open Date: 2011-05-28 18:42 Last Update: 2011-06-12 13:26

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
7
Severity:
7
Resolution:
Fixed
File:
None

Details

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)
}

Ticket History (3/3 Histories)

2011-05-28 18:42 Updated by: exeal
  • New Ticket "Design and implement generic geometry interfaces" created
2011-05-28 22:20 Updated by: exeal
  • Resolution Update from None to Accepted
2011-06-12 13:26 Updated by: exeal
  • Resolution Update from Accepted to Fixed
  • Status Update from Open to Closed
  • Ticket Close date is changed to 2011-06-12 13:26
Comment

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.

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login