# Path: opc/hue.py
# def getHueGen(step=0.05, hue=0):
#     """
#     Generator that returns a stream of shades as hues
#     """
#     while True:
#         hue = fmod(hue + step, 1)
#         yield hue
# 
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]


from opc.colors import BLACK
from opc.hue import getHueGen, hsvToRgb
from random import randint


class Point(object):

    def __init__(self, x, y, dx, dy, hue):
        self.x = x
        self.y = y
        self.dx = dx
        self.dy = dy
        self.hue = hue
        self.age = 0

    def update(self, matrix, expires):
        decay = 1-(float(self.age)/expires)
        self.age += 1

# Path: opc/hue.py
# def getHueGen(step=0.05, hue=0):
#     """
#     Generator that returns a stream of shades as hues
#     """
#     while True:
#         hue = fmod(hue + step, 1)
#         yield hue
# 
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]


# Path: art/utils/fire.py
from opc.colors import BLACK
from opc.hue import getHueGen, hsvToRgb
from random import randint



class Point(object):

    def __init__(self, x, y, dx, dy, hue):
        self.x = x
        self.y = y
        self.dx = dx
        self.dy = dy
        self.hue = hue
        self.age = 0

    def update(self, matrix, expires):
        decay = 1-(float(self.age)/expires)
        self.age += 1

        color = hsvToRgb(self.hue, 1, decay)