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


main()
{

 C parallelogram x(ltransform(matrix22(.90, .4, -.1, .6), vector2(1.2, -2.0)),
 						box(0.1, 0.12, 0.99, 0.91));
 int i;
 for(i=0;i<10;i++)	{
	C line_intersection y(x.s(i), x.s(i-1));
	assert(y.one_int());
	if(hypot(y(0)-x.c(i)(0), y(1)-x.c(i)(1)) > .0001)	{
		printf("Sides %d and %d intersect at (%g %g), should be (%g %g)\n",
					i, i-1, y(0), y(1), x.c(i)(0), x.c(i)(1));
		}
	C line_intersection p(x.s(i), x.s(i+2));
	assert(p.no_int() || p.at_inf());
 	}
 printf("OK\n");
}
