Don't sort start and endpoint by x coordinate
This commit is contained in:
@@ -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)."""
|
||||||
|
|||||||
Reference in New Issue
Block a user