tags:

views:

405

answers:

1

Hi,

I have a set of shapes which need to be drawn on top of each other. I need to re-order them such that the smallest shape gets drawn last (i.e. it will be closest to the user). Is there any way to check whether a shape overlappes (encloses and/or intersects) another shape. I know there is a method in Rect structure called Contains which checks whether there is an object within it. Is there a similar method or a way to simulate it on Shapes in WPF? Thanks in advance for any help.

Cheers,

Nilu

A: 

You could probably use the Geometry.FillContainsWithDetail method. Its name is ill-chosen IMHO, but the description is clear :

Returns a value that describes the intersection between the current geometry and the specified geometry.

I have successfully used it for collision testing before, so it should work for you too...

Thomas Levesque
thanks Thomas, I will try it out :) Although I think I might have to create Geometry objects corresponding to each of the shapes.
Nilu