# Calculating points distance (application freezes)

Hello people...!

Got a rather odd question but it is really stooping my development.

I am calculating a distance between two points for two separate center points of a bounding box. My application works fine after I put the code to calculate the distance between points of the first center.

When I add the code to my application to calculate the distance between points of the second center point my application freezes completely.

There are no compiler errors neither run time errors the application just stops (freezes) after a second or 2 and stays like this forever.....

```
vector<Point> Rightarm;
vector<Point> Leftarm;
vector<Point> Left_Arm_xy;
vector<Point> Right_Arm_xy;
vector<double> Left_Point_distance;
vector<double> Right_Point_distance;
Left_Arm_xy.push_back(cv::Point(center.x,center.y));
Right_Arm_xy.push_back(cv::Point(center1.x,center1.y));
double Pt1;
double Pt2;
for(vector<Point>::iterator iter_a = Left_Arm_xy.begin()+1; iter_a != Left_Arm_xy.end(); ++iter_a)
{
Pt1 = pow((double) iter_a->x - (iter_a -1)->x,2);
Pt2 = pow((double) iter_a->y - (iter_a -1)->y,2);
double result_a;
result_a = (Pt1 + Pt2);
Left_Point_distance.push_back(sqrt(result_a));
}
//----------------------------------------------------------------------------->
double Pt3;
double Pt4;
for(vector<Point>::iterator iter_b = Right_Arm_xy.begin()+1; iter_b != Right_Arm_xy.end(); iter_b)
{
Pt3 = pow((double) iter_b->x - (iter_b -1)->x,2);
Pt4 = pow((double) iter_b->y - (iter_b -1)->y,2);
double result_b;
result_b = (Pt3 + Pt4);
Right_Point_distance.push_back(sqrt(result_b));
}
```

Really have no idea of why this could be happening....could anyone possibly suggest an issue that exists withing the code....? Regards