move angle,length calculation to general_functions