22 lines
643 B
Python
22 lines
643 B
Python
|
|
from geometry import Point, Rectangle, Triangle, Circle, CollectionOfFigures
|
|
|
|
|
|
c1 = Circle(Point(0, 0), 1)
|
|
c2 = Circle(Point(4, 4), 2)
|
|
r1 = Rectangle(Point(0, 0), Point(4, 4))
|
|
r2 = Rectangle(Point(-3, -3), Point(-1, -1))
|
|
t1 = Triangle(Point(-1, -1), Point(-1, 1), Point(0, 1))
|
|
t2 = Triangle(Point(0, 0), Point(6, 0), Point(0, 6))
|
|
t3 = Triangle(Point(-5, -5), Point(0, 6), Point(5, -5))
|
|
|
|
collection = CollectionOfFigures([c1, c2, r1, r2, t1, t2, t3])
|
|
|
|
p1 = Point(4, 4)
|
|
p2 = Point(-1, 0)
|
|
p3 = Point(0, 0)
|
|
|
|
print(p1, "is in", collection.containing(p1))
|
|
print(p2, "is in", collection.containing(p2))
|
|
print(p3, "is in", collection.containing(p3))
|