#include <gpk_std.h>
#include <stdio.h>
#include <assert.h>
#include "../box.h"

#define F 0.99999

box shrink(C box& a)
{
 return box(a.center()*(1-F)+a.c00()*F,
 							a.center()*(1-F)+a.c11()*F);
}

parallelogram shrink(C parallelogram& a)
{
 C ltransform s(a.center(), a.center(), matrix22(F, 0, 0, F));
 return s*a;
}

main()
{

 C box a(0,0,3,3);
 C box as = shrink(a);
 assert(a.encloses(as.c00()));
 assert(a.encloses(as.c01()));
 assert(a.encloses(as.c10()));
 assert(a.encloses(as.c11()));

 C parallelogram b(ltransform(vector2(0,0), vector2(10,10),
 								matrix22(2.2, -.3, .1, .6)),
					box::unitbox);
 C parallelogram bs = shrink(b);
 assert(b.encloses(bs.c00()));
 assert(b.encloses(bs.c01()));
 assert(b.encloses(bs.c10()));
 assert(b.encloses(bs.c11()));
 printf("OK\n");
}

