Compute area1 = (x2a - x1a) × (y2a - y1a) Compute area2 = (x2b - x1b) × (y2b - y1b) Find intersection rectangle: - left = max(x1a, x1b) - right = min(x2a, x2b) - bottom = max(y1a, y1b) - top = min(y2a, y2b) If left < right and bottom < top, overlap = (right - left) × (top - bottom) Else, overlap = 0 Return area1 + area2 - overlap
Math Fundamentals18 sections · 814 units
Open in CourseRectangle Area - Algorithm
(Step by step process)