Exemplo n.º 1
0
        public void Can_create()
        {
            var(x, y) = (1, 2);
            var point = new Cartesian2D(x, y);

            Assert.Equal(x, point.X);
            Assert.Equal(y, point.Y);
        }
Exemplo n.º 2
0
        private static void CartesianCoordinates()
        {
            var coordinates = new Cartesian2D(1, 1);

            coordinates += Math.Sqrt(2.0);

            Console.WriteLine(coordinates.ToString());
        }
Exemplo n.º 3
0
        public void Can_rotate_about_origin(double initialX, double initialY, double rotationAngleDegrees, double expectedX, double expectedY)
        {
            var point         = new Cartesian2D(initialX, initialY);
            var rotationAngle = Angle.From(Degrees.FromRaw(rotationAngleDegrees));

            var result = point.Rotate(Angle.From(Degrees.FromRaw(rotationAngleDegrees)));

            Assert.Equal(new Cartesian2D(expectedX, expectedY), result);
        }
Exemplo n.º 4
0
        public void Can_transform_y(double initialY, double transform, double expectedY)
        {
            var point = new Cartesian2D(1, initialY);

            var result = point.TransformY(transform);

            var expectedPoint = new Cartesian2D(1, expectedY);

            Assert.Equal(expectedPoint, result);
        }
Exemplo n.º 5
0
        public void Can_transform_x(double initialX, double transform, double expectedX)
        {
            var point = new Cartesian2D(initialX, 1);

            var result = point.TransformX(transform);

            var expectedPoint = new Cartesian2D(expectedX, 1);

            Assert.Equal(expectedPoint, result);
        }
Exemplo n.º 6
0
        public static bool RenderLoop(Cartesian2D cartesian)
        {
            Renderer.IsRunning = true;

            while (Renderer.IsRunning)
            {
                Console.Clear();
                Renderer.Render(cartesian);
            }

            Console.WriteLine();

            return(true);
        }
Exemplo n.º 7
0
        public static void Render(Cartesian2D cartesian)
        {
            for (double y = cartesian.Resolution.Y; y >= -cartesian.Resolution.Y; y -= 0.1f)                    //	Y-axis
            {
                for (double x = -cartesian.Resolution.X; x <= cartesian.Resolution.X; x += 0.1f)                //	X - Axis
                {
                    for (int i = 0; i < cartesian.Characters.Length; i++)
                    {
                        if (cartesian.Characters[i].Position.X == x && cartesian.Characters[i].Position.Y == y) //	Checks if the current loop postion is same as one of the vectors.
                        {
                            Console.ForegroundColor = cartesian.Characters[i].Color;                            //	Changes the foreground color
                            Console.BackgroundColor = cartesian.Characters[i].BackgroundColor;                  //	Changes the foreground color

                            Console.Write(cartesian.Characters[i].CharacterValue);                              //	Prints the value
                        }
                    }
                }

                Console.WriteLine();
            }

            Console.WriteLine();                //	temporary
        }