Checking overlapping shapes in WPF
I have a set of shapes to draw on top of each other. I need to reorder them so that the smallest shape is drawn last (i.e. it will be closest to the user). Is there a way to check if a shape overlaps (encloses and / or intersects) another shape. I know there is a method in the structure Rect
called Contains
that checks if there is an object in it. Is there a similar method or way to simulate it in shapes in WPF? Thanks in advance for any help.
Greetings,
Nilu
You can probably use the method Geometry.FillContainsWithDetail
. His name is poorly chosen IMHO, but the description is clear:
Returns a value that describes the intersection of the current geometry and the specified geometry.
I've used it successfully for collision testing before, so it should work for you too ...