# Path: tessagon/core/value_blend.py
# class ValueBlend:
# 
#     def _init_corners(self, **kwargs):
#         # Corners is list of tuples:
#         #   [bottomleft, bottomright, topleft, topright]
#         if 'corners' in kwargs:
#             self.corners = kwargs['corners']
#             if len(self.corners) != 4 or \
#                any(len(v) != 2 for v in self.corners):
#                 raise ValueError("corner should be a list of four tuples, "
#                                  "set either option 'corners' "
#                                  "or options 'u_range' and 'v_range'")
#         elif 'u_range' in kwargs and 'v_range' in kwargs:
#             self.corners = [[kwargs['u_range'][0], kwargs['v_range'][0]],
#                             [kwargs['u_range'][1], kwargs['v_range'][0]],
#                             [kwargs['u_range'][0], kwargs['v_range'][1]],
#                             [kwargs['u_range'][1], kwargs['v_range'][1]]]
#         else:
#             raise ValueError("Must set either option "
#                              "'corners' or options 'u_range' and 'v_range'")
# 
#     def _blend_tuples(self, tuple1, tuple2, ratio):
#         out = [None, None]
#         for i in range(2):
#             out[i] = (1 - ratio) * tuple1[i] + ratio * tuple2[i]
#         return out
# 
#     def blend(self, ratio_u, ratio_v):
#         uv0 = self._blend_tuples(self.corners[0],
#                                  self.corners[1],
#                                  ratio_u)
#         uv1 = self._blend_tuples(self.corners[2],
#                                  self.corners[3],
#                                  ratio_u)
#         return self._blend_tuples(uv0, uv1, ratio_v)


from tessagon.core.value_blend import ValueBlend
            'left': None,
            'right': None
        }

        # Are the neighbors ordered backwards?
        # e.g., a tile with twist['right'] set to True:
        #  self tile: right edge has v=0 at the bottom and v=1 at the top
        #  right neighbor: left edge has v=1 at the bottom and v=0 at the top
        #  (the right tile has twist['left'] true
        self.twist = {
            'top': False,
            'bottom': False,
            'left': False,
            'right': False
        }

    def set_neighbors(self, **kwargs):
        if 'top' in kwargs:
            self.neighbors['top'] = kwargs['top']
        if 'bottom' in kwargs:
            self.neighbors['bottom'] = kwargs['bottom']
        if 'left' in kwargs:
            self.neighbors['left'] = kwargs['left']
        if 'right' in kwargs:
            self.neighbors['right'] = kwargs['right']

    def get_neighbor_tile(self, neighbor_keys):
        tile = self
        for key in self._neighbor_path(neighbor_keys):
            if not tile.neighbors[key]:

# Path: tessagon/core/value_blend.py
# class ValueBlend:
# 
#     def _init_corners(self, **kwargs):
#         # Corners is list of tuples:
#         #   [bottomleft, bottomright, topleft, topright]
#         if 'corners' in kwargs:
#             self.corners = kwargs['corners']
#             if len(self.corners) != 4 or \
#                any(len(v) != 2 for v in self.corners):
#                 raise ValueError("corner should be a list of four tuples, "
#                                  "set either option 'corners' "
#                                  "or options 'u_range' and 'v_range'")
#         elif 'u_range' in kwargs and 'v_range' in kwargs:
#             self.corners = [[kwargs['u_range'][0], kwargs['v_range'][0]],
#                             [kwargs['u_range'][1], kwargs['v_range'][0]],
#                             [kwargs['u_range'][0], kwargs['v_range'][1]],
#                             [kwargs['u_range'][1], kwargs['v_range'][1]]]
#         else:
#             raise ValueError("Must set either option "
#                              "'corners' or options 'u_range' and 'v_range'")
# 
#     def _blend_tuples(self, tuple1, tuple2, ratio):
#         out = [None, None]
#         for i in range(2):
#             out[i] = (1 - ratio) * tuple1[i] + ratio * tuple2[i]
#         return out
# 
#     def blend(self, ratio_u, ratio_v):
#         uv0 = self._blend_tuples(self.corners[0],
#                                  self.corners[1],
#                                  ratio_u)
#         uv1 = self._blend_tuples(self.corners[2],
#                                  self.corners[3],
#                                  ratio_u)
#         return self._blend_tuples(uv0, uv1, ratio_v)


# Path: tessagon/core/abstract_tile.py
from tessagon.core.value_blend import ValueBlend

            'left': None,
            'right': None
        }

        # Are the neighbors ordered backwards?
        # e.g., a tile with twist['right'] set to True:
        #  self tile: right edge has v=0 at the bottom and v=1 at the top
        #  right neighbor: left edge has v=1 at the bottom and v=0 at the top
        #  (the right tile has twist['left'] true
        self.twist = {
            'top': False,
            'bottom': False,
            'left': False,
            'right': False
        }

    def set_neighbors(self, **kwargs):
        if 'top' in kwargs:
            self.neighbors['top'] = kwargs['top']
        if 'bottom' in kwargs:
            self.neighbors['bottom'] = kwargs['bottom']
        if 'left' in kwargs:
            self.neighbors['left'] = kwargs['left']
        if 'right' in kwargs:
            self.neighbors['right'] = kwargs['right']

    def get_neighbor_tile(self, neighbor_keys):
        tile = self
        for key in self._neighbor_path(neighbor_keys):
            if not tile.neighbors[key]:

                return None