/// <summary> /// 根据旋转计算新的包围盒大小 与 点的位置 /// </summary> public void ResetSize() { left = _points[0].Rotate(rotation).x; right = _points[0].Rotate(rotation).x; up = _points[0].Rotate(rotation).y; down = _points[0].Rotate(rotation).y; for (int i = 0; i < _points.Length; i++) { if (_points[i].Rotate(rotation).x < left) { left = _points[i].Rotate(rotation).x; } if (_points[i].Rotate(rotation).x > right) { right = _points[i].Rotate(rotation).x; } if (_points[i].Rotate(rotation).y < down) { down = _points[i].Rotate(rotation).y; } if (_points[i].Rotate(rotation).y > up) { up = _points[i].Rotate(rotation).y; } } width = FixedNumber.Max(FixedNumber.Abs(left), FixedNumber.Abs(right)) * 2; height = FixedNumber.Max(FixedNumber.Abs(up), FixedNumber.Abs(down)) * 2; }
public static bool BoxCheck(ShapBase objA, ShapBase objB) { if (FixedNumber.Abs((objA.position.x - objB.position.x)) < (objA.width + objB.width) / 2 && FixedNumber.Abs((objA.position.y - objB.position.y)) < (objA.height + objB.height) / 2 ) { return(true); } return(false); }
public static bool BoxCheck(NetData objA, NetData objB) { if (FixedNumber.Abs((objA.transform.Position.x - objB.transform.Position.x)) < (objA.Width + objB.Width) / 2 && FixedNumber.Abs((objA.transform.Position.y - objB.transform.Position.y)) < (objA.Height + objB.Height) / 2 ) { return(true); } return(false); }
public FixedNumber Abs() { return(FixedNumber.Abs(this)); }
public static FixedNumber Abs(FixedNumber ratio) { return(FixedNumber.Abs(ratio)); }