#include <v_lib.h>
#include <../samples/include/v_show.h>

/*
 *	This code calculates scale & translate matrix to transform
 *	box (in_min-in_max) to (out_min-out_max)
 */

int main()
{
	vec3_t in_min={-1,-1,-2};
	vec3_t in_max={9,9,8};
	vec3_t out_min={5,0,3};
	vec3_t out_max={25,20,8};
	matrix3x4_t xform;
	logStartConsoleLog();
	logUpperLevel(LOG_TRACE);
	/* Compute transform */
	bboxTransformFromBoxes(xform,in_min,in_max,out_min,out_max);
	conPuts("XFORM:\n");
	showmat3x4(xform);
	/* Transform box */
	conPuts("ARG:\n");
	showvec3(in_min);
	showvec3(in_max);
	conPuts("RESULT:\n");
	mat3x4VecMul(in_min,xform,in_min);
	mat3x4VecMul(in_max,xform,in_max);
	showvec3(in_min);
	showvec3(in_max);
	return 0;
}
