An Algorithm for Straightness Calculation from Geometrical Viewpoint