#
# A test of intersection of two cubes. Assumes double precision floating point.
#
#				Gershon Elber, April 94.
#

length = 1;

angle = 10;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12a = b1 * b2;
attrib( b12a, "width", 0.01 );
interact( b12a );

angle = 1;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12b = b1 * b2;
attrib( b12b, "width", 0.01 );
interact( b12b );

angle = 0.1;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12c = b1 * b2;
attrib( b12c, "width", 0.01 );
interact( b12c );

angle = 0.01;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12d = b1 * b2;
attrib( b12d, "width", 0.01 );
interact( b12d );

angle = 0.001;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12e = b1 * b2;
attrib( b12e, "width", 0.01 );
interact( b12e );

angle = 0.0001;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12f = b1 * b2;
attrib( b12f, "width", 0.01 );
interact( b12f );

comment $
# This one fails...
# Do no report this "feature". This is quite a difficult test...
#
angle = 0.00001;
b1 = box( vector( -length / 2, -length / 2, -length / 2 ),
	  length, length, length );
b2 = box( vector( 0, -length / 2, -length / 2 ),
	  length, length, length ) * rotx( angle );
attrib( b1, "width", 0.0001 );
attrib( b2, "width", 0.0001 );
b12g = b1 * b2;
attrib( b12g, "width", 0.01 );
interact( b12g );
$

free( b1 );
free( b2 );
free( b12a );
free( b12b );
free( b12c );
free( b12d );
free( b12e );
free( b12f );
free( angle );
free( length );
