double sx, sy, fx, fy, k, px, py; k = (fy-sy)/(fx-sx); for(int i = sx; i <= fx; i++) { if(px == i && py == round(i*k)) return true; } return false;