geom/region: add 'bounds' specialisation for region

This commit is contained in:
Danny Robson 2019-08-29 13:10:12 +10:00
parent e6bd571fd5
commit 2a4401da98
2 changed files with 26 additions and 0 deletions

View File

@ -354,6 +354,7 @@ list (
geom/ray.hpp geom/ray.hpp
geom/rect.cpp geom/rect.cpp
geom/rect.hpp geom/rect.hpp
geom/region.cpp
geom/sample/fwd.hpp geom/sample/fwd.hpp
geom/sample/edge.hpp geom/sample/edge.hpp
geom/sample/surface.hpp geom/sample/surface.hpp

25
geom/region.cpp Normal file
View File

@ -0,0 +1,25 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2019 Danny Robson <danny@nerdcruft.net>
*/
#include "ops.hpp"
#include "aabb.hpp"
#include "../region.hpp"
///////////////////////////////////////////////////////////////////////////////
// Bounds calculation for a region is effectively just a type conversion
template <>
cruft::geom::aabb<2,float>
cruft::geom::bounds (region<2,float> val)
{
return aabb2f {
val.base (),
val.away ()
};
}