Point Class Reference

Public Member Functions

def __add__(self, other)
def __init__(self, initialX=0, initialY=0)
def __mul__(self, operand)
def __rmul__(self, operand)
def __str__(self)
def __xor__(self, angle)
def distance(self, other)
def get(self)
def getX(self)
def getY(self)
def normalize(self)
def scale(self, factor)
def setX(self, val)
def setY(self, val)

Detailed Description

Stores a two-dimensional point using cartesian coordinates.

Member Function Documentation

def __add__ (   self,

Return a new point that is the sum of this Point and the other.

def __init__ (   self,
  initialX = 0,
  initialY = 0 

Create a new point instance.

initialX   x-coordinate of the point (default 0)
initialY   y-coordinate of the point (default 0)

def __mul__ (   self,

Return the result when multiplying the Point by an operand.

When the operand is a scalar (i.e., an int or float), return a
Point that has coordinates equal to the original times the factor.

When operand is another Point, return a scalar that is the dot
product of the two points.

def __rmul__ (   self,

Return the result when multiplying the Point by an operand.

See __mul__ for details.

def __str__ (   self  ) 

Return a string representation of the point (e.g., '<0,0>').

def __xor__ (   self,

Return a new point instance representing the original, rotated about the origin.

angle  number of degrees of rotation (clockwise)

def distance (   self,

Return the distance between this point and the other.

def get (   self  ) 

Return an (x,y) tuple.

def getX (   self  ) 

Return the x-coordinate.

def getY (   self  ) 

Return the y-coordinate.

def normalize (   self  ) 

Mutate the point, scaling it to have distance one from the origin.

If the point currently represents the origin, it is unchanged.

def scale (   self,

Scale the coordinates by the given factor.

def setX (   self,

Set the x-coordinate to val.

def setY (   self,

Set the y-coordinate to val.

The documentation for this class was generated from the following file:
Generated on Fri Dec 21 18:19:30 2007 by  doxygen 1.5.3