public TRect LimitInside(TRect rect) { TRect _rect = new TRect(x, y, width - rect.width * 0.5f, height - rect.height * 0.5f); var pos = _rect.LimitInside(new Vector2(rect.x, rect.y)); return(new TRect(pos, rect.size)); }
public TCircle LimitInside(TCircle circle) { float newWidth = Mathf.Max(0, width - circle.radius * 2); float newHeight = Mathf.Max(0, height - circle.radius * 2); TRect newRect = new TRect(x, y, newWidth, newHeight); Vector2 circlePos = newRect.LimitInside(circle.center); return(new TCircle(circlePos, circle.radius)); }