Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vector():
- def __init__(self):
- self.x = 0
- self.y = 0
- def get_vector(self):
- return [self.x, self.y]
- class Point():
- def __init__(self):
- self.x = 0
- self.y = 0
- def get_point(self):
- return[self.x, self.y]
- def add_vector(self, vector):
- p2 = Point()
- p2.x = self.x + vector.x
- p2.y = self.y + vector.y
- return p2
- v = Vector()
- v.x = 2
- v.y = 3
- p = Point()
- p.x = 1
- p.y = 0
- p2 = p.add_vector(v)
- print(p2.get_point())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement