post
poster: Mathematics
description: none
language: plain text
[download]
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
44
45
46
47
48
49
50
51
52
53
54
55
for i := 0 to points do   //loop thru all points
{

  if sorted[i] = false then    //if the point is already sorted skip it
  {

    sorted[i] := true;         //if not then it will be
    checklist[0] := i;         //add the point to a new region
    checkcount := 1;

    j := 0;

    while j < checkcount do 
    {

      for k := 0 to ushifts do
      {

        if sorted[k] = false then
        {

          x := (p[j].x - p[k].x)^2;
          y := (p[j].y - p[k].y)^2;


          if (p.x + p.y) <= r^2 then 
          {
            checklist[checkcount] := k;
            inc(checkcount);
            sorted[k] := true;
          }

        }

      }

    inc(j);

    }

  for j := 0 to (checkcount - 1) do
  {
      region[regions].point[j] := checklist[j];
      inc(region[uregions].points);
  }

  inc(regions);

  }

}

dec(regions);

}