Distancing
Occupying seats while maintaining minimum separation distance
Social Distancing
1
def TooClose (elm:var[]..[],min)
2
{
3
pnt1 = List.FirstItem(elm.GetLocation());
4
elm2 = List.RestOfItems(elm);
5
pnt2 = elm2.GetLocation();
6
bln1 = pnt1.DistanceTo(pnt2) < min;
7
elm3 = List.FilterByBoolMask(elm2,bln1)["out"];
8
return elm3;
9
};
10
11
def Distancing (elm:var[]..[],min)
12
{
13
return = [Imperative]
14
{
15
if (List.Count(elm)>1)
16
{
17
elm1 = [List.FirstItem(elm)];
18
c = 1;
19
while (List.Count(elm) > 1)
20
{
21
elm2 = TooClose (elm,min);
22
elm1[c] = List.FirstItem(elm2);
23
elm = elm2;
24
c = c + 1;
25
}
26
return elm1;
27
}
28
else
29
{
30
return elm;
31
}
32
}
33
};
Copied!
distancing.zip
3KB
Binary
Dynamo 2.8
Copy link