Xpeng Motors interview question

How to compute iou for two triangle objects