Update linesegment.py
All checks were successful
continuous-integration/drone/push Build is passing

Don't sort start and endpoint by x coordinate
This commit is contained in:
2020-03-16 19:46:36 +01:00
parent 91d3dcd9e9
commit 94ad6def57

View File

@@ -9,12 +9,8 @@ class LineSegment:
starting at a startpoint and ending at a endpoint.""" starting at a startpoint and ending at a endpoint."""
def __init__(self, startpoint=point.Point(), endpoint=point.Point()): def __init__(self, startpoint=point.Point(), endpoint=point.Point()):
"""Initialize the line segment.""" """Initialize the line segment."""
if startpoint.get_x() <= endpoint.get_x(): self.set_startpoint(startpoint)
self.set_startpoint(startpoint) self.set_endpoint(endpoint)
self.set_endpoint(endpoint)
else:
self.set_startpoint(endpoint)
self.set_endpoint(startpoint)
def set_startpoint(self, new_startpoint): def set_startpoint(self, new_startpoint):
"""Set or change the startpoint of the line segment. If not a Point object is given """Set or change the startpoint of the line segment. If not a Point object is given
the startpoint gets set to a default value of Point(0,0).""" the startpoint gets set to a default value of Point(0,0)."""