Пример #1
0
 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);
 }
Пример #2
0
        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];
        }