//
//  GeometryUtilities.h
//  BoringMaze
//
//

#import <Foundation/Foundation.h>

/* Function - CGRectByConstrainingRectMovingToOrigin
 *
 * Parameters
 *
 *     initialRect - Initial position of a rectangle that is moving
 *      goalOrigin - Proposed final location of initialRect
 *   containerRect - Rectangle the final rectangle will be inside
 *
 * Discussion
 *
 *   Returns a rectangle whose size is initialRect.size and origin is either the goalOrigin
 *   (if that leads to the rectangle being completely contained inside of 'containerRect'), 
 *   or the point where the rectangle makes contact with 'containerRect'.  If the starting
 *   rect is outside of the container the resulting rectangle be forced to be inside containerRect.
 */
CGRect CGRectByConstrainingRectMovingToOrigin(CGRect containerRect, CGRect startRect, CGPoint goalOrigin);
