Ejemplo 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)
Ejemplo n.º 2
0
x = Symbol('x')
y = Symbol('y')
f = solve(c1.equation(x, y) - c2.equation(x, y), [x, y], dict=True)
print(f[0][x].evalf(5))

#l = Line(Eq(y - 0.15, 0))
#print(l.equation())
# o = c2.intersection(c3)
# print(o.)
# print(inters)

a = tuple(Point(0.14, 0.15).evalf(4))
print(a)
p1, p2, p3 = Point(0.35, 0.335), Point(0.35, 0.34), Point(0.355, 0.34)
t = Triangle(p1, p2, p3)
# print(t.incenter.evalf(5))

a = [1, 2, 3, 4]
b = [5, 6, 7, 8]
c = ["rosa", "maria", "paco", "lucia"]
res = list(zip(a, b, c))
for x, y, z in res:
    print(x)

fig, ax = plt.subplots()
#circle = mpatches.Circle((3.0,4.0), 5, alp)
c = plt.Circle((3.0, 4.0), 1, color='blue', alpha=1)
ax.scatter(3.0, 4.0, c="red")
ax.add_artist(c)
fig.savefig('plotcircles.png')