Good afternoon,
I’m trying to create a definition that given a list of points, and a list of seeds, return a list of selected Locations for each of the towers. For each iteration the list of Points is reduced by the surface of the Located Tower.
This is what I have currently, not sure about the nested Associative code.
def ExcludingPoints (listOfPoints:var[],listOfSeeds:var[])
{
return = [Imperative]
{
count = 0;
ReturnedList = [];
totalseeds = List.Count(listOfSeeds);
posiblePoints = listOfPoints;
maximum = List.Count(listOfPoints)-1;
while(totalseeds > count)
{
RandomNumber = Sequence.RandomNumbers(0, maximum, 1, listOfSeeds[count]);
SelectedPoint = List.GetItemAtIndex(posiblePoints,RandomNumber);
TowerBase = Circle.ByCenterPointRadius(SelectedPoint, 23);
OccupiedSurface = Surface.ByPatch(TowerBase);
[Associative]
{
Boolean = Geometry.DoesIntersect
(posiblePoints<1>, OccupiedSurface<2>);
FlattenBoolean = List.Flatten(Boolean, -1);
FilterPosiblePoints = List.FilterByBoolMask
(posiblePoints, FlattenBoolean);
NewPosiblePoints = Dictionary.ValueAtKey
(FilterPosiblePoints, "out");
NumberOfPoints = List.Count(NewPosiblePoints);
NewMaximum = NumberOfPoints - 1;
}
posiblePoints = NewPosiblePoints;
maximum = NewMaximum;
ReturnedList = List.AddItemToEnd(SelectedPoint, ReturnedList);
count = count + 1;
}
return = ReturnedList;
}
};
I hope this makes sense
Thank you very much.