/// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     BallisticCalculator.Ammunition ammunition1 = new BallisticCalculator.Ammunition();
     this.windControl1 = new BallisticCalculatorNet.InputPanels.WindControl();
     this.button1      = new System.Windows.Forms.Button();
     this.ammoControl1 = new BallisticCalculatorNet.InputPanels.AmmoControl();
     this.SuspendLayout();
     //
     // windControl1
     //
     this.windControl1.Location          = new System.Drawing.Point(12, 61);
     this.windControl1.MeasurementSystem = BallisticCalculatorNet.InputPanels.MeasurementSystem.Metric;
     this.windControl1.Name     = "windControl1";
     this.windControl1.Size     = new System.Drawing.Size(432, 111);
     this.windControl1.TabIndex = 2;
     this.windControl1.Wind     = null;
     //
     // button1
     //
     this.button1.Location = new System.Drawing.Point(13, 13);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(94, 29);
     this.button1.TabIndex = 1;
     this.button1.Text     = "button1";
     this.button1.UseVisualStyleBackColor = true;
     this.button1.Click += new System.EventHandler(this.button1_Click);
     //
     // ammoControl1
     //
     ammunition1.BulletDiameter          = null;
     ammunition1.BulletLength            = null;
     this.ammoControl1.Ammunition        = ammunition1;
     this.ammoControl1.Location          = new System.Drawing.Point(12, 168);
     this.ammoControl1.MeasurementSystem = BallisticCalculatorNet.InputPanels.MeasurementSystem.Metric;
     this.ammoControl1.Name     = "ammoControl1";
     this.ammoControl1.Size     = new System.Drawing.Size(416, 255);
     this.ammoControl1.TabIndex = 3;
     //
     // MyTestForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(800, 450);
     this.Controls.Add(this.ammoControl1);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.windControl1);
     this.Name = "MyTestForm";
     this.Text = "TestForm";
     this.ResumeLayout(false);
 }
Пример #2
0
        public static void Do(String[] _)
        {
            var ammo = new BallisticCalculator.Ammunition(
                weight: new Measurement <WeightUnit>(168, WeightUnit.Grain),
                ballisticCoefficient: new BallisticCalculator.BallisticCoefficient(0.262, BallisticCalculator.DragTableId.G7),
                muzzleVelocity: new Measurement <VelocityUnit>(2580, VelocityUnit.FeetPerSecond),
                bulletDiameter: new Measurement <DistanceUnit>(0.308, DistanceUnit.Inch),
                bulletLength: new Measurement <DistanceUnit>(1.272, DistanceUnit.Inch));

            //define ACOG scope
            var sight = new BallisticCalculator.Sight(
                sightHeight: new Measurement <DistanceUnit>(1.5, DistanceUnit.Inch),
                verticalClick: new Measurement <AngularUnit>(0.1, AngularUnit.Mil),
                horizontalClick: new Measurement <AngularUnit>(0.1, AngularUnit.Mil)
                );

            //M16 rifling
            var rifling = new BallisticCalculator.Rifling(
                riflingStep: new Measurement <DistanceUnit>(10, DistanceUnit.Inch),
                direction: BallisticCalculator.TwistDirection.Right);

            //standard 100 yard ACOG zeroing
            var zero = new BallisticCalculator.ZeroingParameters(
                distance: new Measurement <DistanceUnit>(100, DistanceUnit.Meter),
                ammunition: null,
                atmosphere: null
                );

            //define rifle by sight, zeroing and rifling parameters
            var rifle = new BallisticCalculator.Rifle(sight: sight, zero: zero, rifling: rifling);

            //define atmosphere
            var atmosphere = new BallisticCalculator.Atmosphere(
                altitude: new Measurement <DistanceUnit>(0, DistanceUnit.Meter),
                pressure: new Measurement <PressureUnit>(25.52, PressureUnit.InchesOfMercury),
                pressureAtSeaLevel: false,
                temperature: new Measurement <TemperatureUnit>(21, TemperatureUnit.Celsius),
                humidity: 0.2);

            var calc = new BallisticCalculator.TrajectoryCalculator();
            //shot parameters
            var shot = new BallisticCalculator.ShotParameters()
            {
                MaximumDistance = new Measurement <DistanceUnit>(1000, DistanceUnit.Meter),
                Step            = DistanceUnit.Meter.New(50),
                //calculate sight angle for the specified zero distance
                SightAngle = calc.SightAngle(ammo, rifle, atmosphere),
                ShotAngle  = new Measurement <AngularUnit>(9, AngularUnit.Degree)
            };

            //define winds
            BallisticCalculator.Wind[] wind = null;

            //calculate trajectory
            var trajectory = calc.Calculate(ammo, rifle, atmosphere, shot, wind);

            foreach (var point in trajectory)
            {
                Console.WriteLine($"{point.Time} {point.Distance.In(DistanceUnit.Meter):N0} {point.Velocity.In(VelocityUnit.FeetPerSecond):N0} {point.DropAdjustment.In(AngularUnit.Mil):N2} {point.WindageAdjustment.In(AngularUnit.Mil):N2}");
            }
        }