Instances are a Point in 2D space.
This class is used primarily for recording and handling mouse locations.
Constructor: creates a new GPoint value (x,y).
param x: initial x value Precondition: value is an int or float.
param y: initial y value Precondition: value is an int or float.
All values are 0.0 by default.
The x coordinate of the point.
Invariant: Must be an int or float.
The y coordinate of the point.
Invariant: Must be an int or float.
The class GPoint has overloaded the operations + and - to allow point point addition and subtraction. It also supports scalar multiplication via * on both the right and the left.
Returns: A python list with the contents of this GPoint.
Returns: the interpolation of self and other via alpha.
The value returned has the same type as self (so it is either a GPoint or is a subclass of GPoint). The contents of this object are not altered. The resulting value is
alpha*self+(1-alpha)*other
according to GPoint addition and scalar multiplication.
param other: tuple value to interpolate with Precondition: value has the same type as self.
param alpha: scalar to interpolate by Precondition: value is an int or float.
Returns: the Euclidean distance from this point to other
Parameters: | other – value to compare against |
---|
Precondition: value is a Tuple3D object.