Example #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);
 }
Example #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);
 }
Example #4
0
 public static int RectFits(this Vector2D vin, RectClass bigger)
 {
     return(RectFits(vin, new Vector2D(bigger.Width, bigger.Height)));
 }
Example #5
0
 public static int CompMaxHeight(RectClass a, RectClass b)
 {
     return(a.Height.CompareTo(b.Height));
 }
Example #6
0
 public static int CompMaxWidth(RectClass a, RectClass b)
 {
     return(a.Width.CompareTo(b.Width));
 }
Example #7
0
 public static int CompMaxSide(RectClass a, RectClass b)
 {
     return(Math.Max(a.Width, a.Height).CompareTo(Math.Max(b.Width, b.Height)));
 }
Example #8
0
 public static int CompPerimeter(RectClass a, RectClass b)
 {
     return(a.Perimeter().CompareTo(b.Perimeter()));
 }
Example #9
0
 public static int CompArea(RectClass a, RectClass b)
 {
     return(a.Area().CompareTo(b.Area()));
 }