I was wondering if anyone could give me an idea on how to implement first a class to define a polygon, and second how to detect collisions between two polygons using this class. I am working in Java on Android to be more specific, though I can use the NDK for C/C++ too. I think to define my polygon I will just need an array of vertices right?
When I do the collision detection I have read things about the Separation Axis Theorem and GJK algorithm. Is this the right way to go, or am I making this too complicated. Just trying to get started in the correct direction. Thanks!
You sound like you’re fairly new to this kind of thing, and this is maybe a bigger question that you realize.
I think you’d do best to define the problem your trying to solve first, and then find a solution that solves that problem.
Let me ask you some qualifying questions:
are you talking about 2d or 3d?
Is this for a physics system?
do you need to know where they intersect or just if they intersect?
do you need to do a boolean operation on the shapes (like get the intersection or the union or something)?