示例#1
0
 /// <summary>
 /// 根据旋转计算新的包围盒大小 与 点的位置
 /// </summary>
 public void ResetSize()
 {
     left  = GetPoint(0).x;
     right = GetPoint(0).x;
     up    = GetPoint(0).y;
     down  = GetPoint(0).y;
     for (int i = 0; i < _points.Length; i++)
     {
         var point = GetPoint(i);
         if (point.x < left)
         {
             left = point.x;
         }
         if (point.x > right)
         {
             right = point.x;
         }
         if (point.y < down)
         {
             down = point.y;
         }
         if (point.y > up)
         {
             up = point.y;
         }
     }
     width  = Fixed.Max(Fixed.Abs(left), Fixed.Abs(right)) * 2;
     height = Fixed.Max(Fixed.Abs(up), Fixed.Abs(down)) * 2;
 }
示例#2
0
 public static bool BoxCheck(ShapBase objA, ShapBase objB)
 {
     if (Fixed.Abs((objA.position.x - objB.position.x)) < (objA.width + objB.width) / 2
         &&
         Fixed.Abs((objA.position.y - objB.position.y)) < (objA.height + objB.height) / 2
         )
     {
         return(true);
     }
     return(false);
 }
示例#3
0
 public static Fixed Abs(Fixed ratio)
 {
     return(Fixed.Abs(ratio));
 }
示例#4
0
 public Fixed Abs()
 {
     return(Fixed.Abs(this));
 }