Commit 51427375 authored by Michael Büsch's avatar Michael Büsch

geo2d: Add properties to get start/end of an intersection

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 2b0d438e
......@@ -119,9 +119,24 @@ class Inter2D(Base2D):
Returns None, if self.point is None.
"""
if self.point:
return LineSeg2D(self.point,
Point2D(self.point.x + self.vect.x,
self.point.y + self.vect.y))
return LineSeg2D(self.pointA, self.pointB)
return None
@property
def pointA(self):
"""Get the starting point of the intersection.
Returns None, if there is no starting point.
"""
return self.point
@property
def pointB(self):
"""Get the end point of the intersection.
Returns None, if there is no end point.
"""
if self.point:
return Point2D(self.point.x + self.vect.x,
self.point.y + self.vect.y)
return None
def __repr__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment