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

main()
{
 C nltransform T(vector2(0.5,0.5), vector2(0.5,0.5),
				matrix22(-1,0,0,-1),
				tensor222(0,0,0,.1,0,0,0,0));
				/*
				tensor222(.1,.2,-.1,-.2,.1,0,0,-.1));
				*/
 C ltransform t(T.linearize());

 C nparallelogram Tb(T, box::unitbox);
 C parallelogram tb(t, box::unitbox);
 C box Tob(Tb.outsidebox());
 C box tob(tb.outsidebox());

 double x;
 for(x=1e-7;x<1;x+=0.01*(1-2e-7))	{
	double y;
	for(y=1e-7;y<1;y+=0.01*(1-2e-7))	{
		C vector2 txy(t(vector2(x,y)));
		C vector2 Txy(T(vector2(x,y)));
		assert(tob.encloses(txy));
		assert(Tob.encloses(Txy));
		}
	}
 printf("OK\n");
 return 0;
}
