Repository: sympy/sympy

Issue:
geometry's encloses method fails for non-polygons
The perimeter of objects that are not polygons are not properly accounted for with the encloses method so a circle whose center is in a triangle but is larger than the triangle is reported as being enclosed by the triangle:

https://groups.google.com/forum/#!topic/sympy/vhSScImk3dc

```
>>> var('a')
a
>>> t=Triangle(sss=(1,3,3))
>>> c=t.circumcenter
>>> t.intersection(Circle(c,3))  # no intersection between the two
[]
>>> t.encloses(Circle(c,3))
True
```

Discussion:

Patch:
diff --git a/sympy/geometry/entity.py b/sympy/geometry/entity.py
index af3ed9fad8..5f9d07ea95 100644
--- a/sympy/geometry/entity.py
+++ b/sympy/geometry/entity.py
@@ -258,7 +258,7 @@ def encloses(self, o):
         elif isinstance(o, Ray) or isinstance(o, Line):
             return False
         elif isinstance(o, Ellipse):
-            return self.encloses_point(o.center) and not self.intersection(o)
+            return self.encloses_point(o.center) and not self.intersection(o) and self.encloses_point(Point(o.center.x+o.hradius,o.center.y))
         elif isinstance(o, Polygon):
             if isinstance(o, RegularPolygon):
                 if not self.encloses_point(o.center):


Test patch:
diff --git a/sympy/geometry/tests/test_polygon.py b/sympy/geometry/tests/test_polygon.py
index 37604e5392..cef5a5cf05 100644
--- a/sympy/geometry/tests/test_polygon.py
+++ b/sympy/geometry/tests/test_polygon.py
@@ -3,7 +3,7 @@
 
 from sympy import Abs, Rational, Float, S, Symbol, cos, pi, sqrt, oo
 from sympy.functions.elementary.trigonometric import tan
-from sympy.geometry import (Circle, GeometryError, Point, Polygon, Ray, RegularPolygon, Segment, Triangle, are_similar,
+from sympy.geometry import (Circle, Ellipse, GeometryError, Point, Polygon, Ray, RegularPolygon, Segment, Triangle, are_similar,
                             convex_hull, intersection, Line)
 from sympy.utilities.pytest import raises
 from sympy.utilities.randtest import verify_numerically
@@ -78,6 +78,8 @@ def test_polygon():
     assert p5.encloses_point(Point(1, 3))
     assert p5.encloses_point(Point(0, 0)) is False
     assert p5.encloses_point(Point(4, 0)) is False
+    assert p1.encloses(Circle(Point(2.5,2.5),5)) is False
+    assert p1.encloses(Ellipse(Point(2.5,2),5,6)) is False
     p5.plot_interval('x') == [x, 0, 1]
     assert p5.distance(
         Polygon(Point(10, 10), Point(14, 14), Point(10, 14))) == 6 * sqrt(2)