|
1 | 1 | from sympy import Symbol, Rational
|
2 | 2 | from sympy.geometry import Circle, Ellipse, Line, Point, Polygon, Ray, RegularPolygon, Segment, Triangle
|
3 |
| -from sympy.geometry.entity import scale |
| 3 | +from sympy.geometry.entity import scale, GeometryEntity |
4 | 4 | from sympy.testing.pytest import raises
|
5 | 5 |
|
6 | 6 | from random import random
|
7 | 7 |
|
8 | 8 |
|
| 9 | +def test_entity(): |
| 10 | + x = Symbol('x', real=True) |
| 11 | + y = Symbol('y', real=True) |
| 12 | + |
| 13 | + assert GeometryEntity(x, y) in GeometryEntity(x, y) |
| 14 | + raises(NotImplementedError, lambda: Point(0, 0) in GeometryEntity(x, y)) |
| 15 | + |
| 16 | + assert GeometryEntity(x, y) == GeometryEntity(x, y) |
| 17 | + assert GeometryEntity(x, y).equals(GeometryEntity(x, y)) |
| 18 | + |
| 19 | + c = Circle((0, 0), 5) |
| 20 | + assert GeometryEntity.encloses(c, Point(0, 0)) |
| 21 | + assert GeometryEntity.encloses(c, Segment((0, 0), (1, 1))) |
| 22 | + assert GeometryEntity.encloses(c, Line((0, 0), (1, 1))) is False |
| 23 | + assert GeometryEntity.encloses(c, Circle((0, 0), 4)) |
| 24 | + assert GeometryEntity.encloses(c, Polygon(Point(0, 0), Point(1, 0), Point(0, 1))) |
| 25 | + assert GeometryEntity.encloses(c, RegularPolygon(Point(8, 8), 1, 3)) is False |
| 26 | + |
| 27 | + |
| 28 | + |
9 | 29 | def test_subs():
|
10 | 30 | x = Symbol('x', real=True)
|
11 | 31 | y = Symbol('y', real=True)
|
|
0 commit comments