SHARE
TWEET

Untitled

a guest Feb 16th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Edge(object):
  2. def __init__(self, pointA, pointB):
  3.     self._A = pointA
  4.     self._B = pointB
  5.     ab = pointA + pointB
  6.     self._midpoint = Vector(ab.x / 2, ab.y / 2, ab.z / 2)
  7.  
  8.  
  9. def get_A(self):
  10.     return self._A
  11.  
  12. def set_A(self, point):
  13.     self._A = point
  14.  
  15. def get_B(self):
  16.     return self._B
  17.  
  18. def set_B(self, point):
  19.     self._B = point
  20.  
  21. A = property(get_A, set_A)
  22. B = property(get_B, set_B)
  23.  
  24. def __eq__(self, other):
  25.     if isinstance(other, Edge):
  26.         if (self.A == other.A) and (self.B == other.B):
  27.             return True
  28.         elif (self.B == other.A) and (self.A == other.B):
  29.             return True
  30.         else:
  31.             return False
  32.  
  33. def __ne__(self, other):
  34.     return not self.__eq__(other)
  35.  
  36. def __hash__(self):
  37.     return hash((self.A, self.B)) # =/= hash((self.B, self.A))!
  38.  
  39. def __str__(self):
  40.     return "[{}, {}]".format(self.A, self.B)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top