# 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
            self.u_num = kwargs['u_num']
        if 'v_num' in kwargs:
            self.v_num = kwargs['v_num']
        if not self.u_num or not self.v_num:
            raise ValueError("Make sure u_num and v_num intervals are set")

        if 'u_cyclic' in kwargs:
            self.u_cyclic = kwargs['u_cyclic']
        if 'u_phase' in kwargs and kwargs['u_phase']:
            self.u_phase = kwargs['u_phase']
        if 'u_shear' in kwargs and kwargs['u_shear']:
            self.u_shear = kwargs['u_shear']
        if 'v_twist' in kwargs:
            self.v_twist = kwargs['v_twist']

        if 'v_cyclic' in kwargs:
            self.v_cyclic = kwargs['v_cyclic']
        if 'v_phase' in kwargs and kwargs['v_phase']:
            self.v_phase = kwargs['v_phase']
        if 'v_shear' in kwargs and kwargs['v_shear']:
            self.v_shear = kwargs['v_shear']
        if 'u_twist' in kwargs:
            self.u_twist = kwargs['u_twist']

        # Note: id_prefix is not used for calculation, just debugging
        self.id_prefix = self.tessagon.__class__.__name__
        if 'id_prefix' in kwargs:
            self.id_prefix = kwargs['id_prefix']
        self.fingerprint_offset = kwargs.get('fingerprint_offset') or None


# 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/tile_generator.py
from tessagon.core.value_blend import ValueBlend

            self.u_num = kwargs['u_num']
        if 'v_num' in kwargs:
            self.v_num = kwargs['v_num']
        if not self.u_num or not self.v_num:
            raise ValueError("Make sure u_num and v_num intervals are set")

        if 'u_cyclic' in kwargs:
            self.u_cyclic = kwargs['u_cyclic']
        if 'u_phase' in kwargs and kwargs['u_phase']:
            self.u_phase = kwargs['u_phase']
        if 'u_shear' in kwargs and kwargs['u_shear']:
            self.u_shear = kwargs['u_shear']
        if 'v_twist' in kwargs:
            self.v_twist = kwargs['v_twist']

        if 'v_cyclic' in kwargs:
            self.v_cyclic = kwargs['v_cyclic']
        if 'v_phase' in kwargs and kwargs['v_phase']:
            self.v_phase = kwargs['v_phase']
        if 'v_shear' in kwargs and kwargs['v_shear']:
            self.v_shear = kwargs['v_shear']
        if 'u_twist' in kwargs:
            self.u_twist = kwargs['u_twist']

        # Note: id_prefix is not used for calculation, just debugging
        self.id_prefix = self.tessagon.__class__.__name__
        if 'id_prefix' in kwargs:
            self.id_prefix = kwargs['id_prefix']
        self.fingerprint_offset = kwargs.get('fingerprint_offset') or None


        self.color_pattern = kwargs.get('color_pattern') or None