The shape in the diagram is 3 blocks (9cm) long, and it is 2 blocks (6cm) deep. So by Pythagoras, the "shadow of AB on the floor" has length $\sqrt{9^2+6^2} = \sqrt{117}$ cm, as shown in the diagram below.
The figure is also 2 blocks (6cm) high, as shown below, so can now use Pythagoras again to find $AB$: