private static void Main(string[] args)
        {
            try
            {
                File.Delete("output.txt");
            }
            catch
            {
            }
            var plane = new CartesianPlane(new CartesianConfiguration
            {
                Height = 10,
                Width  = 10
            });

            plane.InsertPositions(CartesianPosition.CreateFunction(x => x ^ 2, plane));
            Console.WriteLine(string.Join(Environment.NewLine, plane.Render()));
            File.WriteAllText("output.txt", string.Join(Environment.NewLine, plane.Render()));
            Console.ReadKey();
        }
        /// <inheritdoc />
        public RenderedMap Render(CartesianPlane plane)
        {
            var rows = new List <string>();

            foreach (var rowIndex in Enumerable.Range(0, plane.Configuration.Height))
            {
                var positions = plane.GetPositions();
                var row       = new StringBuilder();
                row.Append(plane.Configuration.Height - rowIndex - 1 + " ");
                foreach (var rowPosition in Enumerable.Range(0, plane.Configuration.Width))
                {
                    var cart = positions.Any(p => p.GetPositionX(plane) == rowPosition && p.GetPositionY(plane) == plane.Configuration.Height - rowIndex - 1);
                    row.Append(cart ? "+" : "-");
                }

                rows.Add(row.ToString());
            }
            rows.Add("YX" + string.Join("", Enumerable.Range(0, plane.Configuration.Width)));

            return(new RenderedMap(rows));
        }
 /// <inheritdoc />
 public bool CanRenderPlane(CartesianPlane plane)
 {
     return(!(plane.Configuration.Width > MaxMapWidth ||
              plane.Configuration.Height > MaxMapHeight));
 }
 public int GetPositionX(CartesianPlane plane)
 {
     throw new NotImplementedException();
 }
 public (int, int) GetPositionXY(CartesianPlane plane)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 ///     Creates a reversed line of Cartesian points descending using the mathematical function <code>y = -x</code>.
 ///     <note>
 ///     This line is currently unable to be displayed on CartesianTools 0.1.0.
 ///     </note>
 /// </summary>
 /// <param name="plane"></param>
 /// <returns></returns>
 public static IEnumerable <ICartesianPosition> CreateReverseLine(CartesianPlane plane) =>
 CreateFunction(x => 0 - x, plane);
        /// <summary>
        ///     Creates a map of Cartesian points by resolving using an algebraic function. For each <code>x</code> position
        ///     (calculated from the width of the provided plane), a <code>y</code> position will be generated using <code>yResolve</code>.
        /// </summary>
        /// <param name="yResolve"></param>
        /// <param name="plane"></param>
        /// <returns></returns>
        public static IEnumerable <ICartesianPosition> CreateFunction(Func <int, int> yResolve, CartesianPlane plane)
        {
            var xLimit = plane.Configuration.Width;

            return((from x in Enumerable.Range(0, xLimit)
                    let y = yResolve(x)
                            where y <= plane.Configuration.Height
                            select new CartesianPosition(x, y)).ToList());
        }
 public (int, int) GetPositionXY(CartesianPlane plane)
 {
     return(PositionX, PositionY);
 }
 public int GetPositionY(CartesianPlane plane)
 {
     return(PositionY);
 }