Module game_qu.math.point
Expand source code
class Point:
"""Stores the x and y coordinates of point"""
x_coordinate = 0
y_coordinate = 0
def __init__(self, x_coordinate, y_coordinate):
""" Calls set_point(), so the x_coordinate and y_coordinate can be set
Args:
x_coordinate (float): the value of the point's x coordinate
y_coordinate (float): the value of the point's y coordinate
Returns:
None
"""
self.set_coordinates(x_coordinate, y_coordinate)
def set_coordinates(self, x_coordinate, y_coordinate):
""" Sets the x_coordinate and y_coordinate can be set
Args:
x_coordinate (float): the value of the point's x coordinate
y_coordinate (float): the value of the point's y coordinate
Returns:
None
"""
self.x_coordinate, self.y_coordinate = x_coordinate, y_coordinate
def get_copy(self):
"""
Returns:
Point: a copy of this point"""
return Point(self.x_coordinate, self.y_coordinate)
Classes
class Point (x_coordinate, y_coordinate)
-
Stores the x and y coordinates of point
Calls set_point(), so the x_coordinate and y_coordinate can be set
Args
x_coordinate
:float
- the value of the point's x coordinate
y_coordinate
:float
- the value of the point's y coordinate
Returns
None
Expand source code
class Point: """Stores the x and y coordinates of point""" x_coordinate = 0 y_coordinate = 0 def __init__(self, x_coordinate, y_coordinate): """ Calls set_point(), so the x_coordinate and y_coordinate can be set Args: x_coordinate (float): the value of the point's x coordinate y_coordinate (float): the value of the point's y coordinate Returns: None """ self.set_coordinates(x_coordinate, y_coordinate) def set_coordinates(self, x_coordinate, y_coordinate): """ Sets the x_coordinate and y_coordinate can be set Args: x_coordinate (float): the value of the point's x coordinate y_coordinate (float): the value of the point's y coordinate Returns: None """ self.x_coordinate, self.y_coordinate = x_coordinate, y_coordinate def get_copy(self): """ Returns: Point: a copy of this point""" return Point(self.x_coordinate, self.y_coordinate)
Class variables
var x_coordinate
var y_coordinate
Methods
def get_copy(self)
-
Returns
Point
- a copy of this point
Expand source code
def get_copy(self): """ Returns: Point: a copy of this point""" return Point(self.x_coordinate, self.y_coordinate)
def set_coordinates(self, x_coordinate, y_coordinate)
-
Sets the x_coordinate and y_coordinate can be set
Args
x_coordinate
:float
- the value of the point's x coordinate
y_coordinate
:float
- the value of the point's y coordinate
Returns
None
Expand source code
def set_coordinates(self, x_coordinate, y_coordinate): """ Sets the x_coordinate and y_coordinate can be set Args: x_coordinate (float): the value of the point's x coordinate y_coordinate (float): the value of the point's y coordinate Returns: None """ self.x_coordinate, self.y_coordinate = x_coordinate, y_coordinate