Xpeng Motors Interview Question

How to compute iou for two triangle objects