Code center > Darwinbots3
Collision detection tests
Numsgil:
Just to add more detail:
You'll want to get Annulus building. I think all the tests should build. You'll need Visual Studio 2010 still.
if you look in Modules\Annulus\Annulus.UnitTests\SweptCollisionDetection\PolygonvsPolygonTests.cs, there's a bunch of tests for solid hits for edge-vs-edge, edge-vs-vertex and vertex-vs-vertex. But I don't really have any tests for two polygons sliding against each other or just touching and then leaving each other.
Peter:
Managed to get a compatibility warning when installing VS2010 on windows 8.1. :huh:
Getting some failed tests. Nothing that seems troubling, but I had some issues on installation and initial running the project :glare: so I'll post them just in case.
Error 1 "Element [0]: Expected "GlancingNoMotion 0 <0 : 0>" but was "Entering 0 <5 : 0>"" in "Annulus.UnitTests.SweptCollisionDetection::CirclevsCircleTests.NoMotionTests::NoMotion_Intersecting_Incident" J:\SVN\darwinbots\source\Trunk\Modules\Annulus\Annulus.UnitTests\SweptCollisionDetection\CirclevsCircleTests.cs 106 Annulus.UnitTests
Error 2 "Element [0]: Expected "GlancingNoMotion 0 <0 : 0>" but was "Entering 0 <1 : 0>"" in "Annulus.UnitTests.SweptCollisionDetection::CirclevsCircleTests.LinearMotionTests::CoMovement_JustIntersecting" J:\SVN\darwinbots\source\Trunk\Modules\Annulus\Annulus.UnitTests\SweptCollisionDetection\CirclevsCircleTests.cs 219 Annulus.UnitTests
Warning 3 "The triangulator needs to be able to handle non parallel edges." in "Annulus.UnitTests.CSG::TriangulationTests.FindSharedEdgesTests::Parallel" J:\SVN\darwinbots\source\Trunk\Modules\Annulus\Annulus.UnitTests\CSG\TriangulationTests.cs 1208 Annulus.UnitTests
Warning 4 "CutEdgesWithNearbyVertices tests." in "Annulus.UnitTests.CSG::TriangulationTests.CutEdgesWithNearbyVerticesTests::Todo" J:\SVN\darwinbots\source\Trunk\Modules\Annulus\Annulus.UnitTests\CSG\TriangulationTests.cs 1216 Annulus.UnitTests
Error 5 The command ""J:\SVN\darwinbots\source\Trunk\Junk\Annulus.UnitTests\Debug\Annulus.UnitTests.exe"" exited with code 2. Annulus.UnitTests
What are the different glancing transitionstates? Is it possible to generate images of certain steps?(it would help checking my own math)
Numsgil:
I literally just did the CirclevsCircle stuff this week, so it's possible I haven't flushed through a change I need to to make it work. I wouldn't worry about it for now.
The warnings are not failures as much as a running TODO list.
Upgrading to VS 2013 is on my todo list, but I haven't tackled it yet. I imagine it will make this stuff much easier.
...
Basically:
Entering/Exiting - A forcefull collision, with the collider entering or exiting the collidee.
GlancingParallel - Two features (ie: vertex or edge) are rubbing against each other in such a way that they are neither entering nor exiting each other. Imagine one box sliding on top of another, for instance.
GlancingInside/Outside - Imagine throwing a ball up to the ceiling so that it *just* touches the ceiling and then falls back down. Here, *just* means it has 0 velocity when it touches. Inside/Outside indicates whether you're inside the polygon glancing against the boundary from the inside or outside the polygon glancing against the boundary from the outside.
Stationary - Means the two features are intersecting but not moving relative to each other. Basically if you had a GlancingParallel collision and froze the motion, it would be Stationary.
GlancingParallelEntering/Exiting - I don't think this will get returned by anything; it's mostly used internally.
FeaturesAligning - Usually means two polygons are really deeply penetrating. Basically the interior side of one feature is colliding against the exterior side of another feature, and continuing on.
I need to play with it all some more. I might collapse some of the states, or rename them, or combine them, or add more. I don't have a good intuitive sense of what the different states really are for two colliding polygons. I originally thought I could get away with just entering/exiting states but I need more data than that when I process the results of the collision detection algorithm to feed it in to a useful format.
...
In terms of visualizing, there isn't anything super convenient right now. If you were feeling adventurous you could see about generating animated SVGs from the test description. The SimplePolygon class already has something for spitting out SVG descriptions of the polygons, for instance, and there's a javascript library I'm using to allow the mouse to zoom and pan the image in the browser. See for instance Modules\Annulus\Annulus.UnitTests\CSG\StraightSkeletonBuilderTests.cs, around line 1160, where I set up a full SVG for a test. I haven't played with it at all but I think SVG animation is possible. The advantage of SVG animation is that you can literally specify the angular velocity, position, linear velocity, etc. and update the elements' transforms from those, so it would be the easiest way to visualize what the input data is doing. Of course, it involves very webby programming, which I'm not all that knowledgeable about so I don't know how much help I could give. It's almost certainly worth the effort if you could do it.
There's also Annulus.Testbed, but whether you can get it to run or not is questionable. You'd have to manually copy the test input data to Modules\Annulus\Annulus.Testbed\Main.cs to get it to work. And I haven't done much proofing of the graphics stuff so I'm not sure what you'd have to have installed in terms of DirectX SDKs, etc., to make sure it would work.
Peter:
Patch attached, the last test has a weird end result or at least I don't get it.
Also for VS2010 the main issue wasn't the compatibility. But some protection program in the background messing around where it shouldn't. Just found it messed up I got that message, it's not old enough to expect it and the program itself is even written by microsoft.
Numsgil:
Thanks! I modified some of the expected results a bit and submitted them. Two of them are currently failing. The way I decide how to interpret a transition is currently really mucky and these new tests show I need to either add some new cases or more likely bite the bullet and really figure out how the transitions are supposed to work. The current system is really ad hoc which is never a good sign. :/
Anyway, good start. Keep them coming :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version