unable to determine angle because of points from line
Hi all!!
I have an image from which i have created some lines. I have saved starting and end points of line. Lines are basically long side of rectangle that is bounding a white blob in image. Rectangles are placed in some circle. Image is shown as below
Issue is when rectangle is in formed in the lower part of circle, Starting point is can be thought as the lower most Point ie of the circle i.e near the edge of circle, but when Rectangle is is formed in the upper part, rectangle's line's part of the circle as shown in the last dial of the image it is difficult to find out which point to choose as the starting point to find out the starting point which is near center.center of the dial.
Is there any workaround on how i can swap points of line in upper region of circle. Kindly guide me as i am out of ideas with this now.
Here is code to select longest side of rectangle and printing its points
int maxIndex = 0;
for (int a = 1; a < length.length; a++){
double newnumber = length[a];
if ((newnumber > length[maxIndex])){
maxIndex = a;
}
}
System.out.println("Start= "+pts[maxIndex].toString()+" End= "+pts[(maxIndex+1)%4].toString()+", Length="+length[maxIndex]);
Regards,