TransWikia.com

Write condition if rectangle is inside another rectangle

Mathematics Asked on December 3, 2021

I have two rectangles defined by $x_1, y_1, w_1, h_1$ and $x_2, y_2, w_2, h_2$, where $w$ and $h$ are width and height of each rectangle respectively.

The two rectangles intersect iff $$ (x_1 le x_2+w_2 land x_1+w_1 ge x_2) land (y_1 le y_2+h_2 land y_1+h_1 ge y_2) $$

However what if I want to write a condition for only the cases where the first rectangle is inside the second one, and exclude the cases where they have overlapping edges?

How I do this?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP