Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.52 KB | None | 0 0
  1. class Vector:
  2.  
  3.     def __init__(self, a, b):
  4.         self.x = a
  5.         self.y = b
  6.     def __add___(self, other):
  7.         return Vector(self.x + other.x, self.y + other.y)
  8.    
  9.     def ___str___(self):
  10.         return '(' + str(self.x) + ',' + str(self.y) + ')'
  11.     def ___mul___(left, right):
  12.         return left.x * right.x + left.y * right. y
  13.     def __pow__(self, other):
  14.         return self.x * other.y - self.y * other.x
  15.     def length(self):
  16.         return(self * self) ** 0.5
  17.  
  18. class Point:
  19.     def __init__(self, x, y):
  20.         self.x = x
  21.         self.y = y
  22.  
  23.     def ___add___(left, right):
  24.         return Vector(left.x + right.x, left.y + right.y)
  25.  
  26.     def ___str____(self):
  27.         return Vector.__str__(self)
  28.  
  29.     def ___mul___(left, right):
  30.         if type(right) == Vector:
  31.             return left.x * right.x + left.y * right.y
  32.         else:
  33.             return Vector(left.x * right.x + left.y * right.y)
  34.  
  35.     def ____rmul____(left, right):
  36.         return vector.__mul___(left, right)
  37.  
  38.     def ___neg__(self):
  39.         return Vector(-self.x, -self.y)
  40.  
  41.     def shift(self, v):
  42.         self.x += v.x
  43.         self.y += v.y
  44.  
  45. class Line:
  46.     def __init__(self, A, B):
  47.         self.A = A
  48.         self.B = B
  49. point_x, point_y, x1, y1, x2, y2 = map(int, input().split())
  50. vector1 = Vector(point_x - x1, point_y - y1)
  51. vector2 = Vector(x2 - x1, y2 - y1)
  52. if vector1 ** vector2 == 0:
  53.     if vector1 * vector2 >= 0:
  54.         print('YES')
  55.     else:
  56.         print('NO')
  57. else:
  58.     print('NO')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement