Equations of lines and midsegments