/// <summary> /// Checks and returns true or false based on if the coordinate provided falls within the bounds of the plateau, with the boundaries themselves being inclusive. /// </summary> /// <param name="coordinate"></param> /// <returns></returns> public bool IsPointWithinPlateauBounds(MarsCoordinate coordinate) { if (coordinate == null) { return(false); } return(coordinate.X >= MinX && coordinate.X <= MaxX && coordinate.Y >= MinY && coordinate.Y <= MaxY); }
/// <summary> /// This method creates the rectangular plateau based on the coordinate provided. /// The corner provided is expected to be the northeast corner of the plateau. /// </summary> /// <param name="northEastCornerCoordinate"></param> /// <exception cref="System.ArgumentOutOfRangeException">Thrown if X or Y coordinate provided is less than 0.</exception> public void CreatePlateau(MarsCoordinate northEastCornerCoordinate) { if (northEastCornerCoordinate == null) { throw new ArgumentNullException(nameof(northEastCornerCoordinate)); } if (northEastCornerCoordinate.X < 0) { throw new ArgumentOutOfRangeException("The X coordinate for the northeast corner cannot be less than 0."); } if (northEastCornerCoordinate.Y < 0) { throw new ArgumentOutOfRangeException("The Y coordinate for the northeast corner cannot be less than 0."); } plateau = new MarsPlateau(northEastCornerCoordinate.X, northEastCornerCoordinate.Y); }