Source code for src.Vec.geom.line_segment

from src.Vec import VecE2
import math
from src.Roadway.utils import mod2pi2


[docs]class LineSegment: ''' line segment class ''' def __init__(self, A: VecE2.VecE2, B: VecE2.VecE2): ''' :param A: start vec of the line segment :param B: end vec of the line segment ''' self.A = A self.B = B
[docs]def get_polar_angle(seg: LineSegment): return mod2pi2(math.atan2(seg.B.y - seg.A.y, seg.B.x - seg.A.x))