line calculation