static Line perpendicularThroughPoint(Line line, Point point) { var slope = -1 / line.slope; var intercept = point.y - slope * point.x; return Line(slope: slope, intercept: intercept); }