• Advertisement
Sign in to follow this  

Collision Detection test cases

This topic is 3210 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on GJK and Conservative Advancement for my 2D physics engine. I'm also heavily unit testing things. So far I've just been making up unit test cases, but my concern is that I'm missing edge cases. Is there a library of test cases for collision detection somewhere I could copy in to my unit tests? Something describing initial conditions and proper end conditions for various basic and edge cases? Like for GJK one of my unit tests looks like:
IShape quad = new Polygon(new Vector[] { new Vector(-1, 1), new Vector(1, 1), new Vector(1, -1), new Vector(-1, -1) } );

Matrix transformA = new Matrix(0, new Vector(0, 0));
Matrix transformB = new Matrix(-Math.PI / 4, new Vector(-20, 0));

Vector ptA = Vector.Zero;
Vector ptB = Vector.Zero;

	quad, transformA, transformA.Inverse(), ref ptA,
	quad, transformB, transformB.Inverse(), ref ptB

CheckEqual(new Vector(-1, 0), ptA);
CheckEqual(new Vector(1, 1), ptB);
It tests Vertex-to-Edge nearest features. I have various initial conditions, and a black and white test condition which is either true or false. But coming up with test conditions is absolutely exhausting.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement