Skip to content

@technobuddha > library > Geometry

Line Segment

NameTypeDescription
lineIntersectionFunctionCalculates the intersection point of two line segments.
lineLengthFunctionCalculates the length of a line segment.
LineSegmentTypeRepresents a line segment in 2D space, defined by its start and end points.
midpointFunctionCalculates a point at a given fraction (part) along a line segment. By default it returns the true midpoint of the line segment
normalizeLineSegmentFunctionReturns a LineSegment where the point with the higher y-coordinate is always the starting point (x0, y0). If the original line's y1 is greater than y0, the line is returned as-is. Otherwise, the start and end points are swapped.
OnLineOptionsTypeOptions for the isOnLine function
polygonSidesFunctionGenerate line segments for each side of the polygon.
toLineSegmentFunctionConverts two Cartesian points into a LineSegment object.