These 2 polygons are not colliding, though this method returns true:

            new float[]{
                        100.0f, 750.0f, 
                        200.0f, 750.0f, 
                        100.0f, 150.0f, 
                        200.0f, 150.0f
            new float[]{
                        77.0f, 695.0f, 
                        91.0f, 695.0f, 
                        84.0f, 681.0f

Am I using it correctly?


The first polygon is not convex, swapping vertex 3 and 4 solved the problem

  • 1
    \$\begingroup\$ Then please mark you answer as final (the green check icon). \$\endgroup\$ – Philip Allgaier Apr 5 '14 at 13:55
  • \$\begingroup\$ Is there any documentation that mentions the specific order that you need to define your verticies in? \$\endgroup\$ – ashes999 Apr 5 '14 at 14:42
  • \$\begingroup\$ I need to wait 2 days until I can mark my own answer as the correct one. \$\endgroup\$ – cahen Apr 5 '14 at 18:56
  • \$\begingroup\$ @ashes999, you need to enter in the same order you would if you were drawing it with a pen, but of course this doesn't guarantee it's convex \$\endgroup\$ – cahen Apr 5 '14 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.