public SierpinskiFormation() : base( // Fetch our raw data from the filled wedge formation. We // it as our "blueprint" from which filter out some entries // (the "holes" in the Sierpinski triangle). FilledWedgeBase // Translate coordinates back to be full integers and all positive. .Select(t => Tuple.Create((t.Item1 + t.Item2) / 2, t.Item2)) // Transform to rectangular space (offset y to x axis). .Select(t => Tuple.Create(t.Item1, t.Item2 - t.Item1)) // Because then we can wave our magic wand... .Select(t => (t.Item1 & t.Item2) == 0) // Merge it with our original filled wedge list again, so that we get // the association (bool keep, Vector2 entry). .Zip(FilledWedge, Tuple.Create) // Then filter by that association. .Where(t => t.Item1).Select(t => t.Item2)) { }
public FilledWedgeFormation() : base( FilledWedgeBase.Select(t => new Vector2(0.5f * t.Item1, t.Item2))) { }