Example #1
0
        static void Main(string[] args)
        {
            var rifleInfo = new RifleInfo
            {
                Name              = "My Rifle",
                BarrelTwist       = Length.FromInches(11.25), //1:11.25
                ZeroingConditions = new WeatherCondition
                {
                    Altitude         = Length.FromMeters(0),   //sea level
                    Barometer        = Pressure.FromPsi(14.7), //sea level
                    RelativeHumidity = 0.5,                    //in percentage from 0.0 to 1.0 (0% - 100%)
                    Temperature      = Temperature.FromDegreesCelsius(30)
                }
            };

            var ammoInfo = new Cartridge
            {
                MuzzleVelocity = Speed.FromMetersPerSecond(790),
                BC             = 0.505,
                DragFunction   = DragFunction.G1,
                Name           = "My Ammo",
                WeightGrains   = 175,
                Length         = Length.FromInches(1.240),
                Caliber        = Length.FromInches(0.308)
            };

            var scopeInfo = new Scope
            {
                Name                  = "My Scope",
                Height                = Length.FromCentimeters(4),
                ZeroDistance          = Length.FromMeters(100),
                ElevationClicksPerMOA = 1,
                WindageClicksPerMOA   = 0.5
            };

            var locationInfo = new ShotLocationInfo
            {
                Latitude    = 45, //degrees
                ShotAzimuth = 270 //degrees -> west
            };

            var currentWeatherConditions = new WeatherCondition
            {
                Altitude         = Length.FromMeters(0),   //sea level
                Barometer        = Pressure.FromPsi(14.7), //sea level
                RelativeHumidity = 0.5,                    //in percentage from 0.0 to 1.0 (0% - 100%)
                Temperature      = Temperature.FromDegreesCelsius(30)
            };

            var rifle = new Rifle(rifleInfo, scopeInfo, ammoInfo);

            var solution = rifle.Solve(
                0.0, //shooting angle
                Speed.FromKilometersPerHour(10),
                90,  //wind direction angle (degrees)
                Length.FromMeters(500),
                currentWeatherConditions,
                locationInfo);
        }
Example #2
0
 public MultipleCalculationResultsViewModel(ShotInfo shotInfo,
                                            Rifle selectedRifle,
                                            Cartridge selectedCartridge,
                                            bool isUsingDifferentWeather,
                                            bool isUsingCoriolis,
                                            ShotLocationInfo shotLocationInfo)
 {
     this.shotInfo                = shotInfo;
     this.selectedRifle           = selectedRifle;
     this.selectedCartridge       = selectedCartridge;
     this.isUsingDifferentWeather = isUsingDifferentWeather;
     this.isUsingCoriolis         = isUsingCoriolis;
     this.shotLocationInfo        = shotLocationInfo;
 }
Example #3
0
 public SingleCalculationResultViewModel(GNUBallistics.Rifle rifleCalculator,
                                         ShotInfo shotInfo,
                                         Rifle selectedRifle,
                                         Cartridge selectedCartridge,
                                         bool isUsingDifferentWeather,
                                         bool isUsingCoriolis,
                                         ShotLocationInfo shotLocationInfo,
                                         WeatherCondition currentWeather,
                                         ConfigurationModel configurationModel)
 {
     this.rifleCalculator         = rifleCalculator;
     this.shotInfo                = shotInfo;
     this.selectedRifle           = selectedRifle;
     this.selectedCartridge       = selectedCartridge;
     this.isUsingDifferentWeather = isUsingDifferentWeather;
     this.isUsingCoriolis         = isUsingCoriolis;
     this.shotLocationInfo        = shotLocationInfo;
     this.currentWeather          = currentWeather;
     this.configurationModel      = configurationModel;
 }