public void AddInnerFill(Transform root, Vector3[] points, float pathLength) { Polygon poly = new Polygon(points); Bounds b = points.GetBounds(); float s = size * 2 * spacing; int index = 0; for (float x = b.min.x; x < b.max.x; x += s) { for (float y = b.min.y; y < b.max.y; y += s) { Vector3 p = new Vector3(x, y, 0); if (poly.Contains(p)) { AddObject(root, p, Vector3.right, ref index, 0); } } } root.DestroyChildrenAfter(index); }
public void AddScatterFill(Vector3[] points, float pathLength) { Polygon poly = new Polygon(points); Bounds b = points.GetBounds(); float s = size * 2 * spacing; if (allowOverflow) { poly = poly.GetOffset(2 * s); b.Expand(s); } int index = 0; for (float x = b.min.x; x < b.max.x; x += s) { for (float y = b.min.y; y < b.max.y; y += s) { Vector3 p = new Vector3(x, y, 0); if (poly.Contains(p)) { AddScatterQuad (p, Vector3.right, ref index, 0); } } } }