0

I'm trying to detect a collision between two ellipses

public bool CheckCollision(Ellipse a, Ellipse  b)
{     
    if (a.RenderedGeometry.Bounds.IntersectsWith(b.RenderedGeometry.Bounds) )
        return true;
    return false;  
}

But it doesnt work because I get true all the time

gmetax
  • 3,853
  • 2
  • 31
  • 45
yzahavi
  • 45
  • 2
  • 2
    Well, the Ellipse class doesn't store information about the position of the ellipse, so, the boundary rectangles of two ellipses always interesect. – SnowballTwo Jul 23 '15 at 14:24
  • 1
    If the ellipses are actually circles, the collision detection would better be done by subtracting their center Points, which would give you a Vector. You could then check if the Length of the Vector is less than or equal to the sum of the radii of the two circles. – Clemens Jul 23 '15 at 14:28
  • In order to work with center points, you would replace Ellipse controls by Path controls with an EllipseGeometry. – Clemens Jul 23 '15 at 14:30
  • 1
    http://stackoverflow.com/questions/16132903/how-to-do-c-sharp-collision-detection – Maximus Jul 23 '15 at 14:36

0 Answers0