Skip to content Skip to sidebar Skip to footer

Check If Square Is Contained In Another Square

So I'm doing a little project in python using pyglet(opengl). When I click on a point in the screen a Square is generated that expands equally from the coordinate. So for example i

Solution 1:

You can do it with just three points. Given a point inside the boundary (say top left) you can check that the top right point doesn't exceed the boundary in the positive x direction and that the lower left point doesn't exceed the negative y direction.

This assumes the boundary is square though. The fourth point can not exceed the length (x,y) of the points already measured.

Post a Comment for "Check If Square Is Contained In Another Square"