public TRect LimitInside2(TRect rect) { float newWidth = Mathf.Max(0, width - rect.width); float newHeight = Mathf.Max(0, height - rect.height); TRect newRect = new TRect(x, y, newWidth, newHeight); Vector2 circlePos = newRect.LimitInside2(rect.center); return(new TRect(circlePos, rect.size)); }
public TCircle LimitInside2(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.LimitInside2(circle.center); return(new TCircle(circlePos, circle.radius)); }