# Path: expyriment/misc/geometry/_geometry.py
# class XYPoint(object):
#     """ The Expyriment point class """
#     def __init__(self, x=None, y=None, xy=None):
#         """Initialize a XYPoint.
# 
#         Parameters
#         ----------
#         x : numeric
#         y : numeric
#         xy : (numeric, numeric)
#             xy = (x,y)
# 
#         Notes
#         -----
#         use `x`, `y` values (two numberic) or the tuple xy=(x,y)
# 
#         """
# 
#         if x is None:
#             if xy is None:
#                 self._x = 0
#                 self._y = 0
#             else:
#                 self._x = xy[0]
#                 self._y = xy[1]
#         elif y is None:
#             #if only a tuple is specified: e-g. Point((23,23))
#             self._x = x[0]
#             self._y = x[1]
#         else:
#             self._x = x
#             self._y = y
# 
#     def __repr__(self):
#         return  "(x={0}, y={1})".format(self._x, self._y)
# 
#     @property
#     def x(self):
#         """Getter for x"""
#         return self._x
# 
#     @x.setter
#     def x(self, value):
#         """Getter for x"""
#         self._x = value
# 
#     @property
#     def y(self):
#         """Getter for y"""
#         return self._y
# 
#     @y.setter
#     def y(self, value):
#         """Getter for y"""
#         self._y = value
# 
#     @property
#     def tuple(self):
#         """Getter for the tuple (x, y) """
# 
#         return (self._x, self._y)
# 
#     @tuple.setter
#     def tuple(self, xy_tuple):
#         self._x = xy_tuple[0]
#         self._y = xy_tuple[1]
# 
# 
#     @property
#     def polar(self):
#         """Getter for polar coordinate the point """
# 
#         return cartesian2polar((self._x, self._y))
# 
#     def move(self, v):
#         """Move the point along the coordinates specified by the vector v.
# 
#         Parameters
#         ----------
#         v : misc.XYPoint
#             movement vector
# 
#         """
# 
#         self._x = self._x + v._x
#         self._y = self._y + v._y
#         return self
# 
#     def distance(self, p):
#         """Return euclidian distance to the points (p).
# 
#         Parameters
#         ----------
#         p : misc.XYPoint
#             movement vector
# 
#         Returns
#         -------
#         dist : float
#             distance to other point p
# 
#         """
# 
#         dx = self._x - p._x
#         dy = self._y - p._y
#         return _math.hypot(dx, dy)
# 
#     def rotate(self, degree, rotation_centre=(0, 0)):
#         """Rotate the point counterclockwise in degree around rotation_centre.
# 
#         Parameters
#         ----------
#         degree : int
#             degree of rotation (default=(0, 0) )
#         rotation_center : (numeric, numeric)
#             rotation center (x, y)
# 
#         """
# 
#         #cart -> polar
#         r, ang = cartesian2polar(xy = (self._x - rotation_centre[0],
#                                        self._y - rotation_centre[1]),
#                                  radians=True)
#         ang -= _math.radians(degree)
#         #polar -> cart
#         self._x, self._y = polar2cartesian(polar=(r, ang), radians=True)
#         self._x += rotation_centre[0]
#         self._y += rotation_centre[1]
# 
# 
#     def is_inside_polygon(self, point_list):
#         """Return true if point is inside a given polygon.
# 
#         Parameters
#         ----------
#         point_list : list
#             point list defining the polygon
# 
#         Returns
#         -------
#         check : bool
# 
# """
# 
#         n = len(point_list)
#         inside = False
# 
#         p1 = point_list[0]
#         for i in range(n + 1):
#             p2 = point_list[i % n]
#             if self._y > min(p1._y, p2._y):
#                 if self._y <= max(p1._y, p2._y):
#                     if self._x <= max(p1._x, p2._x):
#                         if p1._y != p2._y:
#                             xinters = (self._y - p1._y) * (p2._x - p1._x) // (p2._y - p1._y) + p1._x
#                         if p1._x == p2._x or self._x <= xinters:
#                             inside = not inside
#             p1 = p2
# 
#         return inside
# 
# def points2vertices(points):
#     """Returns vertex representation of the points (list of misc.XYPoints)
# 
#     Parameters
#     ----------
#     points : (int, int)
#         list of points
# 
#     Returns
#     -------
#     vtx : list
#         list of vertices
# 
#     """
# 
#     vtx = []
#     for i in range(1, len(points)):
#         vtx.append((points[i].x - points[i - 1].x, points[i].y - points[i - 1].y))
#     return vtx


import math as _math
from ._geometry import XYPoint, points2vertices
            (0, y_b),
            (-x_b, 0),
            (0, line_width - 1),
            (x_b, 0)]


def vertices_trapezoid(width_top, width_bottom, height):
    """Returns a list of vertices describing a trapezoid

    Notes
    -----
    The resulting vertices can be plotted with the class
    stimuli.Shape(vertex_list=...).

    Parameters
    ----------
    width_top: int
        width of the top edge
    width_bottom: int
        width of the bottom edge
    height : int
        height of the trapezoid

    Returns
    -------
    vtx : list of vertices

    """

    left_bottom =XYPoint(x = 0, y = 0)

# Path: expyriment/misc/geometry/_geometry.py
# class XYPoint(object):
#     """ The Expyriment point class """
#     def __init__(self, x=None, y=None, xy=None):
#         """Initialize a XYPoint.
# 
#         Parameters
#         ----------
#         x : numeric
#         y : numeric
#         xy : (numeric, numeric)
#             xy = (x,y)
# 
#         Notes
#         -----
#         use `x`, `y` values (two numberic) or the tuple xy=(x,y)
# 
#         """
# 
#         if x is None:
#             if xy is None:
#                 self._x = 0
#                 self._y = 0
#             else:
#                 self._x = xy[0]
#                 self._y = xy[1]
#         elif y is None:
#             #if only a tuple is specified: e-g. Point((23,23))
#             self._x = x[0]
#             self._y = x[1]
#         else:
#             self._x = x
#             self._y = y
# 
#     def __repr__(self):
#         return  "(x={0}, y={1})".format(self._x, self._y)
# 
#     @property
#     def x(self):
#         """Getter for x"""
#         return self._x
# 
#     @x.setter
#     def x(self, value):
#         """Getter for x"""
#         self._x = value
# 
#     @property
#     def y(self):
#         """Getter for y"""
#         return self._y
# 
#     @y.setter
#     def y(self, value):
#         """Getter for y"""
#         self._y = value
# 
#     @property
#     def tuple(self):
#         """Getter for the tuple (x, y) """
# 
#         return (self._x, self._y)
# 
#     @tuple.setter
#     def tuple(self, xy_tuple):
#         self._x = xy_tuple[0]
#         self._y = xy_tuple[1]
# 
# 
#     @property
#     def polar(self):
#         """Getter for polar coordinate the point """
# 
#         return cartesian2polar((self._x, self._y))
# 
#     def move(self, v):
#         """Move the point along the coordinates specified by the vector v.
# 
#         Parameters
#         ----------
#         v : misc.XYPoint
#             movement vector
# 
#         """
# 
#         self._x = self._x + v._x
#         self._y = self._y + v._y
#         return self
# 
#     def distance(self, p):
#         """Return euclidian distance to the points (p).
# 
#         Parameters
#         ----------
#         p : misc.XYPoint
#             movement vector
# 
#         Returns
#         -------
#         dist : float
#             distance to other point p
# 
#         """
# 
#         dx = self._x - p._x
#         dy = self._y - p._y
#         return _math.hypot(dx, dy)
# 
#     def rotate(self, degree, rotation_centre=(0, 0)):
#         """Rotate the point counterclockwise in degree around rotation_centre.
# 
#         Parameters
#         ----------
#         degree : int
#             degree of rotation (default=(0, 0) )
#         rotation_center : (numeric, numeric)
#             rotation center (x, y)
# 
#         """
# 
#         #cart -> polar
#         r, ang = cartesian2polar(xy = (self._x - rotation_centre[0],
#                                        self._y - rotation_centre[1]),
#                                  radians=True)
#         ang -= _math.radians(degree)
#         #polar -> cart
#         self._x, self._y = polar2cartesian(polar=(r, ang), radians=True)
#         self._x += rotation_centre[0]
#         self._y += rotation_centre[1]
# 
# 
#     def is_inside_polygon(self, point_list):
#         """Return true if point is inside a given polygon.
# 
#         Parameters
#         ----------
#         point_list : list
#             point list defining the polygon
# 
#         Returns
#         -------
#         check : bool
# 
# """
# 
#         n = len(point_list)
#         inside = False
# 
#         p1 = point_list[0]
#         for i in range(n + 1):
#             p2 = point_list[i % n]
#             if self._y > min(p1._y, p2._y):
#                 if self._y <= max(p1._y, p2._y):
#                     if self._x <= max(p1._x, p2._x):
#                         if p1._y != p2._y:
#                             xinters = (self._y - p1._y) * (p2._x - p1._x) // (p2._y - p1._y) + p1._x
#                         if p1._x == p2._x or self._x <= xinters:
#                             inside = not inside
#             p1 = p2
# 
#         return inside
# 
# def points2vertices(points):
#     """Returns vertex representation of the points (list of misc.XYPoints)
# 
#     Parameters
#     ----------
#     points : (int, int)
#         list of points
# 
#     Returns
#     -------
#     vtx : list
#         list of vertices
# 
#     """
# 
#     vtx = []
#     for i in range(1, len(points)):
#         vtx.append((points[i].x - points[i - 1].x, points[i].y - points[i - 1].y))
#     return vtx


# Path: expyriment/misc/geometry/_basic_shapes.py
import math as _math
from ._geometry import XYPoint, points2vertices

            (0, y_b),
            (-x_b, 0),
            (0, line_width - 1),
            (x_b, 0)]


def vertices_trapezoid(width_top, width_bottom, height):
    """Returns a list of vertices describing a trapezoid

    Notes
    -----
    The resulting vertices can be plotted with the class
    stimuli.Shape(vertex_list=...).

    Parameters
    ----------
    width_top: int
        width of the top edge
    width_bottom: int
        width of the bottom edge
    height : int
        height of the trapezoid

    Returns
    -------
    vtx : list of vertices

    """

    left_bottom =XYPoint(x = 0, y = 0)

    right_bottom = XYPoint(x = width_bottom, y = 0)