How to determine if objects are within predefined shape

Hi , i am making game where the user has to pick up objects from the world and put them according to a given design at each level so that it fits the predefined shape, like in the image below those three blocks to fit the shape defined ....

Image

Can any one give me a general idea as to what kind of logic i might need to implement here to find out if the object in the world now matches the exact shape as is predefined at each level and how do i check it .... help will be highly appreciated here...

Regards
Jin
Maybe you could completely surround the outside of the predefined shape with sensors, and check that none of the blocks are touching any sensors.
@force - thanks but i was just wondering that the boxes will not touch the sensors even if they are not inside the predefined shape.... i was thinking of finding coordinates and checking if the boxes coordinates match that of the predefined shape , but i do not know how to determine coordinates in box2d , can any one help here and also what i am thinking , is it on right lines , please suggest ...

Regards
Jin
I mean completely surround it, so that all the space outside the predefined area is entirely covered with sensors and if a box is not in the predefined area then it has to be touching a sensor.

Original thread: https://box2d.org/forum/viewtopic.php?t=8712