for int clustCount int squareMin perimMin double compactMin elongation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
for (int i = 0; i < clustCount; i++)
{
int squareMin = 0, perimMin = 0;
double compactMin = 0, elongationMin = 0, orientMin = 0;
int squareMax = 0, perimMax = 0;
double compactMax = 0, elongationMax = 0, orientMax = 0;
squareMin = squareMax = objects[0].Square;
perimMin = perimMax = objects[0].Perimeter;
compactMin = compactMax = objects[0].Compactness;
elongationMax = elongationMin = objects[numberOfObject].elongation;
foreach (int numberOfObject in (List<int>)table[i])
{
if(objects[numberOfObject].Square > squareMax)
squareMax = objects[numberOfObject].Square;
if(objects[numberOfObject].Square < squareMin)
squareMin = objects[numberOfObject].Square;
if(objects[numberOfObject].Perimeter > perimMax)
perimMax = objects[numberOfObject].Perimeter;
if(objects[numberOfObject].Perimeter < perimMin)
perimMin = objects[numberOfObject].Perimeter;
if(objects[numberOfObject].Compactness > compactMax )
compactMax = objects[numberOfObject].Compactness;
if(objects[numberOfObject].Compactness < compactMin )
compactMin = objects[numberOfObject].Compactness;
if(objects[numberOfObject].elongation > elongationMax)
elongationMax = objects[numberOfObject].elongation;
if(objects[numberOfObject].elongation < elongationMin)
elongationMin = objects[numberOfObject].elongation;
}
int count = ((List<int>)table[i]).Count();
if (count != 0)
{
medians[i].Square = squareMin + squareMax / 2;
medians[i].Perimeter = perimMin + perimMax/ 2;
medians[i].Compactness = compactMin + compactMax / 2;
medians[i].elongation = elongationMin + elongationMax / 2;
// medians[i].OrientationOfMainAxis = orientSum / count;
}
}