"""
Module to demonstrate the Point class
This module has a few simple functions that show how to use the Point class in
Cornell Extensions.
Author: Walker M. White (wmw2)
Date: September 16, 2017 (Python 3 Version)
"""
import cornell
def incr_x(q):
"""
Increments the x coord of p by 1
Example: (1,2,3) becomes (2,2,3)
The function does not return a value (it is a procedure).
It just modifies the point "in place"
Parameter p: The point to adjust
Precondition: p is a Point object
"""
q.x = q.x+1
def copy2d(p):
"""
Makes a 2d copy of the point p
This function makes (and returns) a new point
that has the same x, y value as p, but whose
z value is 0.
Parameter p: The point to copy
Precondition: p is a Point object
"""
# Make a new point
q = cornell.Point3(p.x,p.y,0)
return q