import math


def ellipse_properties(x, y, w):
    """
    Given a the (x,y) locations of the foci of the ellipse and the width return
    the center of the ellipse, width, height, and angle relative to the x-axis.

    :param double x: x-coordinates of the foci
    :param double y: y-coordinates of the foci
    :param double w: width of the ellipse
    :rtype: tuple of doubles
    :returns: (center_coordinates, width, height, angle_in_rads)

    """
    p1 = [x[0], y[0]]
    p2 = [x[1], y[1]]
    
    #center point
    xy = [(p1[0] + p2[0])/2, (p1[1] + p2[1])/2]		
    #distance between points
    d = ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**(0.5)	
    #theta to positive Xaxis
    angle = math.atan((p1[1] - p2[1])/(p1[0] - p2[0])) 
    #sin = math.sin(-angle)
    #cos = math.cos(-angle)
    #width will be the axis the points lie on
    width = 2*((0.5*d)**2 + (0.5*w)**2)**(0.5) 		
    height = w

    return (xy, width, height, angle*180/math.pi)