geom/segment: instantiate bounds for segments

This commit is contained in:
Danny Robson 2019-03-22 16:34:44 +11:00
parent 382e093f57
commit 4f9014a151

View File

@ -8,6 +8,7 @@
#include "segment.hpp"
#include "aabb.hpp"
#include "ops.hpp"
#include "../region.hpp"
@ -66,3 +67,15 @@ cruft::geom::intersects (cruft::geom::segment2i seg, cruft::region2i rect)
{
return intersects (seg.cast<float> (), rect.cast<float> ());
}
///////////////////////////////////////////////////////////////////////////////
template <>
cruft::geom::aabb3f
cruft::geom::bounds (cruft::geom::segment3f obj)
{
return {
min (obj.a, obj.b),
max (obj.a, obj.b),
};
}