Jump to content
  • Advertisement
Sign in to follow this  
Numsgil

Collision Detection test cases

This topic is 3336 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;

Lodestone.CollisionDetection.ShapeToShape.ClosestPointsOnShapesToEachOther(
	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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!