double math::Distance(std::vector line, std::vector point) { double dist; double SQ_x = point[0].x - line[0].x; double SQ_y = point[0].y - line[0].y; double SQ_2 = SQ_x*SQ_x + SQ_y*SQ_y; double QS_x = SQ_x * line[1].x; double QS_y = SQ_y * line[1].y; double QSV_2 = QS_x * QS_x + QS_y * QS_y; double V_2 = line[1].x * line[1].x + line[1].y + line[1].y; dist = sqrt(SQ_2 - QSV_2/V_2); return dist; }