- Drag the blue points to change the shape of the quad - Drag the red point around
This demonstrates a method that checks to see if a point lies inside of a quad or not. It can be useful to do this when checking for collisions between a point and a hitbox. Unfortunately, concave quads will mess things up... sorry about that! How it Works: The program is finding the areas of 4 triangles. The four triangles share a common vertex: the red point, or the moving projectile. The other two vertices of the triangles are two vertices from the quad, each triangle using different sides of the quad. The sum of these triangle areas are compared to the area of the quad itself, and if the former of the two areas is less than or equal to the latter, the point is inside the quad. Enjoy!