i want to create a function that helps calculate the speed of a detected and tracked object , the idea is to calculate the distance between two points p1 and p2 the problem