 <p>Use Python's classes for this.</p> <p>A simple example. Let's first define a Point data structure that will hold information about a point in cartesian coordinates:</p> <pre><code>class Point(object): """ Define a point at X, Y """ def __init__(self, x=0, y=0): self.x=x self.y=y </code></pre> <p>Now let's define a circle:</p> <pre><code>class Circle(object): def __init__(self, x=0, y=0, radius=1): """ Define a circle centered at X, Y with radius """ self.x=x self.y=y self.radius=radius </code></pre> <p>Now you can declare an instance of each and test if the point is inside the circle:</p> <pre><code>&gt;&gt;&gt; c1=Circle() # default of x=0, y=0, radius=1 &gt;&gt;&gt; p1=Point(5,6) # a point at x=5, y=6 </code></pre> <p>Is that point inside the circle? You can test it:</p> <pre><code>&gt;&gt;&gt; ((p1.x-c1.x)**2 + (p1.y - c1.y)**2)**0.5&lt;c1.radius False </code></pre> <p>That would be a whole lot easier if we did not have to remember the pythagorian theorem for the circle's center and the point. Let's add that basic functionality to the Circle object:</p> <pre><code>class Circle(object): def __init__(self, x=0, y=0, radius=1): self.x=x self.y=y self.radius=radius def point_in(self, p): return ((p.x-self.x)**2 + (p.y - self.y)**2)**0.5&lt;self.radius </code></pre> <p>Now you can use a more logical method:</p> <pre><code>&gt;&gt;&gt; c1.point_in(Point(5,5)) False &gt;&gt;&gt; c1.point_in(Point(.5,.5)) True </code></pre> <p>So what about 'above' or 'below'? I suppose 'above' would mean if a point is outside the circle and <code>Point.y &gt; Circle.y</code>. Add this to the Circle class:</p> <pre><code>def above(self, p): return ((p.x-self.x)**2 + (p.y - self.y)**2)**0.5 &gt; self.radius and p.y&gt;self.y </code></pre> <p>Test it:</p> <pre><code>&gt;&gt;&gt; c1.above(Point(5,5)) True </code></pre> <p>You can extend this concept so that you can test if a circle overlaps another circle or an area of a polygon defined by Points. You can also extend it so that each shape will use the appropriate formula for itself and the other shape. (How do you know if polygons intersect? Now we are talking more complexity! Start <a href="http://stackoverflow.com/a/218081/298607">HERE</a>. If you have OpenGL, you can draw the two polygons offscreen with two additive colors and test for added pixel colors...)</p> <p>Then extend that to what you mean by 'above' and 'below' for triangles squares, rectangles, circles. Your basic definition of shapes other than a circle will require a rotation or just be defined as polygons by their vertices. </p>