From 4f9014a1513fa37d2bf8ac7d8d6eb042c45c0931 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 22 Mar 2019 16:34:44 +1100 Subject: [PATCH] geom/segment: instantiate bounds for segments --- geom/segment.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/geom/segment.cpp b/geom/segment.cpp index aba65fed..48974ce9 100644 --- a/geom/segment.cpp +++ b/geom/segment.cpp @@ -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 (), rect.cast ()); } + + +/////////////////////////////////////////////////////////////////////////////// +template <> +cruft::geom::aabb3f +cruft::geom::bounds (cruft::geom::segment3f obj) +{ + return { + min (obj.a, obj.b), + max (obj.a, obj.b), + }; +}