0

So I have some code as follows

 class Circle: 
    def __init__(self, x0, y0, r): 
        self.x0 = x0 
        self.y0 = y0
        self.r= r
    ##Method checking whether a given point is in the circle
    def is_in(self, pos):
        if (self.x0 - pos[0])**2 + (self.y0 - pos[1])**2 <= self.r: 
            return True 
        return False 

    ##method checking whether two circles intersect
    def intersect(self, circle2): 
        dist_sqrd = (self.x0 - circle2.x0)**2 + (self.y0 - circle2.y0)**2

        if np.sqrt(dist_sqrd) <= self.r + circle2.r: 
            return True 
        return False

Now in the second function intersect I want to specify that the second arugment must be another circle, i.e. same type as self. How can I do this?

Enforce
  • 111
  • 4

0 Answers0