/// <summary> /// Allocates points in the grid falling within the supplied Polygons. /// </summary> /// <param name="polygon">The Polygon bounding the points to be allocated.</param> /// <returns> /// None. /// </returns> public void Allocate(List <Polygon> polygons) { if (polygons.Count == 0) { return; } var index = 0; var allocate = new List <Vector3>(); foreach (Vector3 point in Available) { foreach (Polygon polygon in polygons) { if (polygon.Covers(point)) { allocate.Add(point); } index++; } } foreach (Vector3 point in allocate) { Available.Remove(point); Allocated.Add(point); } }
/// <summary> /// Allocates the points in the grid falling within or on the supplied Polygon. /// </summary> /// <param name="polygon">The Polygon bounding the points to be allocated.</param> /// <returns> /// None. /// </returns> public void Allocate(Polygon polygon) { var rmvPoints = new List <int>(); var index = 0; foreach (Vector3 point in Available) { if (polygon.Covers(point)) { rmvPoints.Add(index); Allocated.Add(point); } index++; } rmvPoints.Reverse(); foreach (int rmv in rmvPoints) { Available.RemoveAt(rmv); } }
/// <summary> /// Allocates points in the grid falling within the supplied Polygons. /// </summary> /// <param name="polygon">The Polygon bounding the points to be allocated.</param> /// <returns> /// None. /// </returns> public void Allocate(IList <Polygon> polygons) { var rmvPoints = new List <int>(); var index = 0; var allocate = new List <Vector3>(); foreach (Vector3 point in Available) { foreach (Polygon polygon in polygons) { if (polygon.Covers(point)) { allocate.Add(point); } index++; } } foreach (Vector3 point in allocate) { Available.Remove(point); Allocated.Add(point); } }