### 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.....

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` `````` vector Rightarm; vector Leftarm; vector Left_Arm_xy; vector Right_Arm_xy; vector Left_Point_distance; vector 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::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::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
line 36 is causing your infinite loop

should be:
` for(vector<Point>::iterator iter_b = Right_Arm_xy.begin()+1; iter_b != Right_Arm_xy.end(); ++iter_b)`
goshhhhhhhhh HEHE thank you so much Not to sure how i didn't spot this but but once again THANKS. regards
Topic archived. No new replies allowed.