Ejemplo n.º 1
0
    def test_convert_hue_to_unit(self):
        # Check outer bounds
        self.assertEqual(0.0, Color.convert_hue_to_unit(0))
        self.assertEqual(1.0, Color.convert_hue_to_unit(360))

        # Check defined colors
        self.assertEqual(Color.convert_hue_to_unit(Color.BLUE.hue), .667)
        self.assertEqual(Color.convert_hue_to_unit(Color.RED.hue), 0.0)
        self.assertEqual(Color.convert_hue_to_unit(Color.GREEN.hue), .319)
        self.assertEqual(Color.convert_hue_to_unit(Color.YELLOW.hue), .167)
        self.assertEqual(Color.convert_hue_to_unit(Color.LIGHT_BLUE.hue), .514)
        self.assertEqual(Color.convert_hue_to_unit(Color.VIOLET.hue), .833)
        pass
Ejemplo n.º 2
0
def tuple_from_type(plane: PlaneType) -> tuple:
    unit = Color.convert_hue_to_unit(plane.hsv.hue)
    return unit, plane.hsv.saturation