#Name: Laraib Shaikh

#Student Number: 1205628

#Macid: shaikhl

#Lab Section: L09

#Lab: Major 05



# This program draws a polygon



class ConvexPolygon:

    #constructor

    def __init__(self,v):

        self.v = v

   

    #accessors

    def getVertices (self):

        return self.v



    def getN (self):

        return len(self.v)



    #mutators    

    def setVertex (self,i,x,y):

        self.v[i][0]= x

        self.v[i][1]= y



    def isPointInside (self, x,y):

        xp = 0

        yp = 0

        for P in range (len(self.x)):

            xp = self.getVertices ()[P][0]

            yp = self.getVertices ()[P][1]

            if P == (xp,yp):

                return True

            else:

                return False

        

#function outside the class

def polygonCollision (a,b):

    a,b = 0

    for i in range(len(self.v)):

        a,b = ((yp-y)*((x+1)-x))-((xp-x)*((y+1)-y))

        vertex = ConvexPolygon(a,b)

        if vertex > 0 or vertex < 0:

            return True

        else:

            return False



"""



Design Question:



The algorithm isPointInside can be implemented either using loops or if-else statements or while statement. in this program, it is implemented using the if-else statements.



Test Cases:



Test



1) test: for function isPointInside

   input: (6, 5)

   expected output: True



2) test: for function isPointInside

   input: (-8,-5)

   expected output: False



3) test: for function polygonCollision

   input: (6,4)

   expected output: True



4) test: for function polygonCollision

   input: (0,0)

   expected output: False

    

   



"""

