# a3.py
# YOUR NAME(S) AND NETID(S) HERE
# DATE COMPLETED HERE
""" Functions for Assignment A3"""
import colormodel
import math

def complement_rgb(rgb):
    """Returns: the complement of color rgb.
    
    Precondition: rgb is an RGB object"""
    # We asserted this precondition for you.  You do not need to do anything here.
    assert (type(rgb) == colormodel.RGB), 'Value '+ `rgb`+' is not a RGB object'
    
    # THIS IS WRONG.  FIX IT
    return colormodel.RGB(rgb.red, rgb.green, rgb.blue)


def truncate5(value):
    """Returns: value, as a string, using exactly 5 characters.
    
    The truncated value will have one of the forms:
       ddd.d      Example:  360.1
       dd.dd      Example:  29.53
       d.ddd      Examples: 4.003,  0.001,  and 0.000
    
    Precondition: value is a number (int or float), 0 <= value <= 999."""
    # To get the desired output, do the following
    #   1. Make sure value is a float.  If it is not, convert it to one.
    #   1. If value < 0.001, set value to 0.
    #      This prevents value appearing in scientific notation, e.g. 1.5E-6.
    #   2. Convert value to a string s, in the usual way. Note that s is guaranteed to
    #      have at least three chars: a decimal point and a digit on either side of it.
    #      Therefore, the simplest thing to do as s is being constructed is to make
    #      sure s has at least 5 chars by appending "00" after the decimal point.
    #   3. Return the first five characters of s.
    
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return ''


def round5(value):
    """ Returns: value, as a string, but expand or round to be (if necessary) 
    exactly 5 characters.
    
    Examples:
       Round 1.3546  to  1.355.
       Round 1.3544  to  1.354.
       Round 21.9954 to  22.00.
       Round 21.994  to  21.99.
       Round 130.59  to  130.6.
       Round 130.54  to  130.5.
       Round 1       to  1.000.
    
    Precondition: value is a number (int or float), 0 <= value <= 360."""
  
  
    #
    # MAKE SURE THAT VALUE IS A FLOAT BEFORE USING THE BUILT-IN round() FUNCTION
    # If it is not a float convert it to one with the float() function.
    #
    # Obviously, you want to use the built-in function round().  However, 
    # remember that the rounding takes place at a different place depending on
    # how big value is. Look at the examples in the specification.
    
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return ''


def round5_cmyk(cmyk):
    """Returns: String representation of cmyk in the form "(C, M, Y, K)".
    
    In the output, each of C, M, Y, and K should be exactly 5 characters long.
    Hence the output of this function is not the same as str(cmyk)
    
    Precondition: cmyk is an CMYK object."""
    # STUB: Replace this return statement
    return ''


def round5_hsv(hsv):
    """Returns: String representation of hsv in the form "(H, S, V)".
    
    In the output, each of H, S, and V should be exactly 5 characters long.
    Hence the output of this function is not the same as str(hsv)
    
    Precondition: hsv is an HSV object."""
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return ''


def rgb_to_cmyk(rgb):
    """Returns: color rgb in space CMYK, with the most black possible.
    
    Formulae from en.wikipedia.org/wiki/CMYK_color_model.
    
    Precondition: rgb is an RGB object"""
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return None


def cmyk_to_rgb(cmyk):
    """Returns : color CMYK in space RGB.
    
    Formulae from en.wikipedia.org/wiki/CMYK_color_model.
    
    Precondition: cmyk is an CMYK object."""
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return None


def rgb_to_hsv(rgb):
    """Return: color rgb in HSV color space.
    
    Formulae from wikipedia.org/wiki/HSV_color_space.
    
    Precondition: rgb is an RGB object"""
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return None


def hsv_to_rgb(hsv):
    """Returns: color in RGB color space.
    
    Formulae from http://en.wikipedia.org/wiki/HSV_color_space.
    
    Precondition: hsv is an HSV object."""
    # ASSERT PRECONDITIONS
    
    # STUB: Replace this return statement
    return None