Esempio n. 1
0
def test_geometry():
    p1 = Point(1, 2)
    p2 = Point(2, 3)
    p3 = Point(0, 0)
    p4 = Point(0, 1)
    for c in (
            GeometryEntity,
            GeometryEntity(),
            Point,
            p1,
            Circle,
            Circle(p1, 2),
            Ellipse,
            Ellipse(p1, 3, 4),
            Line,
            Line(p1, p2),
            LinearEntity,
            LinearEntity(p1, p2),
            Ray,
            Ray(p1, p2),
            Segment,
            Segment(p1, p2),
            Polygon,
            Polygon(p1, p2, p3, p4),
            RegularPolygon,
            RegularPolygon(p1, 4, 5),
            Triangle,
            Triangle(p1, p2, p3),
    ):
        check(c, check_attr=False)
Esempio n. 2
0
def test_geometry():
    p1 = Point(1, 2)
    p2 = Point(2, 3)
    p3 = Point(0, 0)
    p4 = Point(0, 1)
    for c in (GeometryEntity, GeometryEntity(), Point, p1, Circle,
              Circle(p1, 2), Ellipse, Ellipse(p1, 3, 4), Line, Line(p1, p2),
              LinearEntity, LinearEntity(p1, p2), Ray, Ray(p1, p2), Segment,
              Segment(p1, p2), Polygon, Polygon(p1, p2, p3,
                                                p4), RegularPolygon,
              RegularPolygon(p1, 4, 5), Triangle):
        # XXX: Instance of Triangle hangs because of hasattr in check().
        # Triangle(p1,p2,p3)
        check(c)
        pass
Esempio n. 3
0
def test_issue_5933():
    from sympy.geometry.polygon import (Polygon, RegularPolygon)
    from sympy.simplify.radsimp import denom
    x = Polygon(*RegularPolygon((0, 0), 1, 5).vertices).centroid.x
    assert abs(denom(x).n()) > 1e-12
    assert abs(denom(radsimp(x))) > 1e-12  # in case simplify didn't handle it