Exemplo n.º 1
0
        private RTCf.Canvas GenerateProjectile(int width, int height)
        {
            var canvas = new RTCf.Canvas(width, height, black);

            var m   = double.Parse(Magnetude.Text);
            var vel = new Tuple <double, double, double>(
                double.Parse(VelocityX.Text),
                double.Parse(VelocityY.Text),
                double.Parse(VelocityZ.Text));

            var proj = new obj.Projectile(
                RTCf.PointType.Point(0, 1, 0),
                RTCf.PointType.Vector(vel.Item1, vel.Item2, vel.Item3).Normalize() * m);
            var env = new obj.Environment(
                RTCf.PointType.Vector(0, -0.1, 0),
                RTCf.PointType.Vector(-0.01, 0, 0));

            canvas.WritePixel((int)proj.Position.X, (height - 1) - (int)proj.Position.Y, red);

            foreach (var coord in obj.Projectile.GetTick(env, proj))
            {
                canvas.WritePixel((int)coord.X, (height - 1) - (int)coord.Y, red);
            }

            return(canvas);
        }
Exemplo n.º 2
0
        private void CalculatePath()
        {
            DrawCanvas.Children.Clear();

            var proj = new obj.Projectile(
                PointType.Point(0, 1, 0),
                PointType.Vector(1, 1, 0).Normalize() * inc);
            var env = new obj.Environment(
                PointType.Vector(0, -0.1, 0),
                PointType.Vector(-0.01, 0, 0));

            foreach (var coord in obj.Projectile.GetTick(env, proj))
            {
                DrawCircle(coord.X, coord.Y);
            }
        }