Engines/FlatRedBallXNA/FlatRedBall/Math/Geometry/Circle.cs
/// <summary>
/// Adjusts the calling Circle's position (or its parent if attached) so that the circle is fully-contained
/// in the argument AxisAlignedRectangle.
/// </summary>
/// <param name="otherAxisAlignedRectangle">The rectangle to keep the circle inside of.</param>
Adjusts the calling Circle's position (or its parent if attached) so that the circle is fully-contained
in the argument AxisAlignedRectangle.
Adjusts the calling Circle ' s position ( or its parent if attached ) so that the circle is fully - contained in the argument AxisAlignedRectangle .
public void KeepThisInsideOf(AxisAlignedRectangle otherAxisAlignedRectangle)
        {
            Vector2 repositionVector;
            repositionVector.X = 0;
            repositionVector.Y = 0;
            this.ForceUpdateDependencies();
            if (this.X - this.Radius < otherAxisAlignedRectangle.X - otherAxisAlignedRectangle.ScaleX)
            {
                repositionVector.X = (otherAxisAlignedRectangle.X - otherAxisAlignedRectangle.ScaleX + this.Radius) - this.X;
            }
            if (this.X + this.Radius > otherAxisAlignedRectangle.X + otherAxisAlignedRectangle.ScaleX)
            {
                repositionVector.X = (otherAxisAlignedRectangle.X + otherAxisAlignedRectangle.ScaleX - this.Radius) - this.X;
            }
            if (this.Y - this.Radius < otherAxisAlignedRectangle.Y - otherAxisAlignedRectangle.ScaleY)
            {
                repositionVector.Y = (otherAxisAlignedRectangle.Y - otherAxisAlignedRectangle.ScaleY + this.Radius) - this.Y;
            }
            if (this.Y + this.Radius > otherAxisAlignedRectangle.Y + otherAxisAlignedRectangle.ScaleY)
            {
                repositionVector.Y = (otherAxisAlignedRectangle.Y + otherAxisAlignedRectangle.ScaleY - this.Radius) - this.Y;
            }
            PositionedObject topParent = this.TopParent;
            topParent.Position.X += repositionVector.X;
            topParent.Position.Y += repositionVector.Y;
        }
public void KeepThisInsideOf ( AxisAlignedRectangle otherAxisAlignedRectangle ) { Vector2 repositionVector ; repositionVector . X = 0 ; repositionVector . Y = 0 ; this . ForceUpdateDependencies ( ) ; if ( this . X - this . Radius < otherAxisAlignedRectangle . X - otherAxisAlignedRectangle . ScaleX ) { repositionVector . X = ( otherAxisAlignedRectangle . X - otherAxisAlignedRectangle . ScaleX + this . Radius ) - this . X ; } if ( this . X + this . Radius > otherAxisAlignedRectangle . X + otherAxisAlignedRectangle . ScaleX ) { repositionVector . X = ( otherAxisAlignedRectangle . X + otherAxisAlignedRectangle . ScaleX - this . Radius ) - this . X ; } if ( this . Y - this . Radius < otherAxisAlignedRectangle . Y - otherAxisAlignedRectangle . ScaleY ) { repositionVector . Y = ( otherAxisAlignedRectangle . Y - otherAxisAlignedRectangle . ScaleY + this . Radius ) - this . Y ; } if ( this . Y + this . Radius > otherAxisAlignedRectangle . Y + otherAxisAlignedRectangle . ScaleY ) { repositionVector . Y = ( otherAxisAlignedRectangle . Y + otherAxisAlignedRectangle . ScaleY - this . Radius ) - this . Y ; } PositionedObject topParent = this . TopParent ; topParent . Position . X += repositionVector . X ; topParent . Position . Y += repositionVector . Y ; }
Adjusts the calling Circle's position (or its parent if attached) so that the circle is fully-contained
in the argument AxisAlignedRectangle.
Adjusts the calling Circle ' s position ( or its parent if attached ) so that the circle is fully - contained in the argument AxisAlignedRectangle .
otherAxisAlignedRectangle
AxisAlignedRectangle
The rectangle to keep the circle inside of.
The rectangle to keep the circle inside of .