Page 1 of 1

Question about seperating axis algorithm in dBoxBox2

Posted: Tue Sep 11, 2012 10:37 am
by NFDream

Code: Select all

	TST(pp[2]*R[1][0]-pp[1]*R[2][0],(A[1]*Q[2][0]+A[2]*Q[1][0]+B[1]*Q[0][2]+B[2]*Q[0][1]),0,-R[2][0],R[2][0],7);
	TST(pp[2]*R[1][1]-pp[1]*R[2][1],(A[1]*Q[2][1]+A[2]*Q[1][1]+B[0]*Q[0][2]+B[2]*Q[0][0]),0,-R[2][1],R[2][1],8);
	TST(pp[2]*R[1][2]-pp[1]*R[2][2],(A[1]*Q[2][2]+A[2]*Q[1][2]+B[0]*Q[0][1]+B[1]*Q[0][0]),0,-R[2][2],R[2][2],9);

	TST(pp[0]*R[2][0]-pp[2]*R[0][0],(A[0]*Q[2][0]+A[2]*Q[0][0]+B[1]*Q[1][2]+B[2]*Q[1][1]),-R[2][0],0,-R[0][0],10);
	TST(pp[0]*R[2][1]-pp[2]*R[0][1],(A[0]*Q[2][1]+A[2]*Q[0][1]+B[0]*Q[1][2]+B[2]*Q[1][0]),-R[2][1],0,-R[0][1],11);
	TST(pp[0]*R[2][2]-pp[2]*R[0][2],(A[0]*Q[2][2]+A[2]*Q[0][2]+B[0]*Q[1][1]+B[1]*Q[1][0]),-R[2][2],0,-R[0][2],12);

	TST(pp[1]*R[0][0]-pp[0]*R[1][0],(A[0]*Q[1][0]+A[1]*Q[0][0]+B[1]*Q[2][2]+B[2]*Q[2][1]),0,-R[1][0],R[0][0],13);
	TST(pp[1]*R[0][1]-pp[0]*R[1][1],(A[0]*Q[1][1]+A[1]*Q[0][1]+B[0]*Q[2][2]+B[2]*Q[2][0]),0,-R[1][1],R[0][1],14);
	TST(pp[1]*R[0][2]-pp[0]*R[1][2],(A[0]*Q[1][2]+A[1]*Q[0][2]+B[0]*Q[2][1]+B[1]*Q[2][0]),0,-R[1][2],R[0][2],15);
what are these "TST" testing for ?

Re: Question about seperating axis algorithm in dBoxBox2

Posted: Tue Sep 11, 2012 5:42 pm
by Erwin Coumans
Those are the 9 separating axis tests, testing the 9 edge-edge directions. The directions are based on the cross products of all the 3x3 edge-edge combinations, one for each box.