2015-10-13 18:19:47 +11:00
|
|
|
#include "geom/aabb.hpp"
|
2015-04-09 14:05:01 +10:00
|
|
|
|
2015-04-13 16:45:56 +10:00
|
|
|
#include "tap.hpp"
|
|
|
|
|
|
|
|
#include <tuple>
|
|
|
|
|
2017-08-24 16:43:54 +10:00
|
|
|
using util::geom::aabb2f;
|
2015-10-13 18:19:47 +11:00
|
|
|
|
2015-04-13 16:45:56 +10:00
|
|
|
|
2015-04-09 14:05:01 +10:00
|
|
|
int
|
|
|
|
main (int, char**)
|
|
|
|
{
|
2015-04-13 16:45:56 +10:00
|
|
|
util::TAP::logger tap;
|
|
|
|
|
2015-04-09 14:05:01 +10:00
|
|
|
{
|
|
|
|
// Test contraction
|
2017-08-24 16:43:54 +10:00
|
|
|
const aabb2f val { { 2, 2 }, { 8, 8 } };
|
|
|
|
const aabb2f res { { 3, 3 }, { 7, 7 } };
|
2015-04-09 14:05:01 +10:00
|
|
|
|
2017-08-24 16:54:48 +10:00
|
|
|
tap.expect_eq (val.contract (1.f), res, "over contraction");
|
2015-04-09 14:05:01 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
// Test expansion
|
2017-08-24 16:43:54 +10:00
|
|
|
const aabb2f val { { 2, 2 }, { 8, 8 } };
|
|
|
|
const aabb2f res { { 1, 1 }, { 9, 9 } };
|
2015-04-09 14:05:01 +10:00
|
|
|
|
2017-08-24 16:54:48 +10:00
|
|
|
tap.expect_eq (val.expand (1.f), res, "expansion");
|
2015-04-09 14:05:01 +10:00
|
|
|
}
|
2017-05-22 13:55:21 +10:00
|
|
|
|
|
|
|
return tap.status ();
|
2015-04-09 14:05:01 +10:00
|
|
|
}
|