For my program, I implemented AABB collision which works fine. When AABB collision detects a collision between 2 boxes, I want to find the surface area of portion where the 2 boxes are overlapping. Is there a simple equation to use to find out that surface area?The main issue: So it was really easy for me to point out places to calculate to find my overlapping X and Y values to find my surface are. Just like (|6-3|)*(|6-4|). My issue is that I'm trying to have no conditional problems. So I was wondering if there is a formula where you can plug in all the edge points of both boxes and it will always give the surface area that is overlapping no matter how they overlap. This will save me a lot of time and be more efficient when writing my code.NOTE:Boxes are oriented by the axis; Therefore, the sides will always be parallel to the X and Y axis. The edge points of Box 1 and Box 2 is all that is known; So that being said, there is no co-ordinates of where the lines are intersecting.
Surface Area calculations
java