Mikko Rasa [Wed, 22 May 2013 20:03:07 +0000 (23:03 +0300)]
Make CompositeShape::get_intersections work with null points
This was a bit tricky, since it's necessary to inspect the points returned
by component shapes to see if they're actually on the composite surface.
To that end, a temporary buffer is allocated. This is most likely used in
interactive point-and-pick situations, so the performance loss should not
be significant.
Mikko Rasa [Wed, 22 May 2013 13:14:16 +0000 (16:14 +0300)]
Rewrite composite shape vector constructors with iterator ranges
Besides the issue of favoring one container type over others, constness
of the contents causes it to be a different, incompatible type. Iterators
solve this in an elegant way.
Mikko Rasa [Tue, 21 May 2013 18:41:15 +0000 (21:41 +0300)]
Make the check_intersection function non-virtual
Almost all shapes were implementing it with a call to get_intersections,
so might as well make the base class do that. Performance loss is likely
negligible.
Mikko Rasa [Tue, 21 May 2013 13:32:49 +0000 (16:32 +0300)]
Math function usage fixes
Add using declarations and #includes where needed, and clean up some
unnecessary ones. abs() is particularly annoying, as the int version
easily gets into the global namespace and doesn't give a warning if
used with floats or doubles.
Mikko Rasa [Sun, 19 May 2013 17:38:22 +0000 (20:38 +0300)]
Don't qualify potentially overloaded functions with the std namespace
Instead put a using std::func before the call. This makes things work if
the template argument is a user-defined type with these functions defined
in another namespace.
Mikko Rasa [Fri, 17 May 2013 10:55:57 +0000 (13:55 +0300)]
Redesign the Vector interface
The constructors from two and three components are now provided directly
by the Vector template, so Vector2 and Vector3 are no longer needed. In
addition, two- and three-component vectors now have named members.