public void CalculateCorners() { topleftpixel = corners.First(p => p.GetX() < centerx && p.GetY() < centery); toprightpixel = corners.First(p => p.GetX() >= centerx && p.GetY() < centery); bottomleftpixel = corners.First(p => p.GetX() < centerx && p.GetY() >= centery); bottomrightpixel = corners.First(p => p.GetX() >= centerx && p.GetY() >= centery); }
public Shape(List<Pixel> pixels, Pixel[] corners) { this.pixels = pixels; this.corners = corners; centerx = corners.Sum(p => p.GetX()) / corners.Length; centery = corners.Sum(p => p.GetY()) / corners.Length; topleftpixel = corners[0]; toprightpixel = corners[1]; bottomrightpixel = corners[2]; bottomleftpixel = corners[3]; }