Esempio n. 1
0
 public void Reset(RectClass rin)
 {
     Id        = false;
     Rectangle = new RectLtrb
     {
         Top     = 0,
         Left    = 0,
         FRight  = rin.Width,
         FBottom = rin.Height
     };
     DelCheck();
 }
 public int Fits(RectClass bigger)
 {
     if (RectPackHelper.EqE(Width(), bigger.Width(), 0.00001) && RectPackHelper.EqE(Height(), bigger.Height(), 0.00001))
     {
         return(3);
     }
     if (RectPackHelper.EqE(Width(), bigger.Height(), 0.00001) && RectPackHelper.EqE(Height(), bigger.Width(), 0.00001))
     {
         return(4);
     }
     if (Width() <= bigger.Width() && Height() <= bigger.Height())
     {
         return(1);
     }
     if (Width() <= bigger.Height() && Height() <= bigger.Width())
     {
         return(2);
     }
     return(0);
 }
Esempio n. 3
0
 public int Fits(RectClass bigger, bool allowflip)
 {
     if (RectPackHelper.EqE(Width, bigger.Width, 0.00001) && RectPackHelper.EqE(Height, bigger.Height, 0.00001))
     {
         return(3);
     }
     if (allowflip && RectPackHelper.EqE(Width, bigger.Height, 0.00001) && RectPackHelper.EqE(Height, bigger.Width, 0.00001))
     {
         return(4);
     }
     if (Width <= bigger.Width && Height <= bigger.Height)
     {
         return(1);
     }
     if (allowflip && Width <= bigger.Height && Height <= bigger.Width)
     {
         return(2);
     }
     return(0);
 }
Esempio n. 4
0
 public static int RectFits(this Vector2D vin, RectClass bigger)
 {
     return(RectFits(vin, new Vector2D(bigger.Width, bigger.Height)));
 }
Esempio n. 5
0
 public static int CompMaxHeight(RectClass a, RectClass b)
 {
     return(a.Height.CompareTo(b.Height));
 }
Esempio n. 6
0
 public static int CompMaxWidth(RectClass a, RectClass b)
 {
     return(a.Width.CompareTo(b.Width));
 }
Esempio n. 7
0
 public static int CompMaxSide(RectClass a, RectClass b)
 {
     return(Math.Max(a.Width, a.Height).CompareTo(Math.Max(b.Width, b.Height)));
 }
Esempio n. 8
0
 public static int CompPerimeter(RectClass a, RectClass b)
 {
     return(a.Perimeter().CompareTo(b.Perimeter()));
 }
Esempio n. 9
0
 public static int CompArea(RectClass a, RectClass b)
 {
     return(a.Area().CompareTo(b.Area()));
 }