Skip to content

Various ballistic calculation related apps, based on .Net port of a GNU Ballistics Library

License

Notifications You must be signed in to change notification settings

myarichuk/Sharp.Ballistics

Repository files navigation

Sharp.Ballistics

This repository contains a .Net port of an excellent GNU Ballistics Library, which can be found here :
http://sourceforge.net/projects/ballisticslib/
Also, there are apps that use this ported library.

  • Sharp.Ballistics.Calculator - Desktop ballistic calculator
  • Sharp.Ballistics.Training - Shooting range "simulator" for practicing long-range shooting calculations

Show me some code! Below is an example of how GnuBallisticsLibrary.Net can be used

            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 Ammunition
            {
                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);

Where rifle.Solve() result is defined as

public class BallisticSolution
    {
        public Length BulletDrop { get; set; }

        public Length WindDrift { get; set; }

        public Length SpinDrift { get; set; }

        public double VerticalMOA { get; set; }

        public double VerticalMils => VerticalMOA / 0.290888;

        public double VerticalClicks { get; set; }

        public double HorizontalMOA { get; set; }

        public double HorizontalMils => HorizontalMOA / 0.290888;

        public double HorizontalClicks { get; set; }

        public double TimeToTargetSec { get; set; }

        public Speed ImpactVelocity { get; set; }

        public Length Range { get; set; }

    }

Also, kudos to https://icons8.com/ and https://www.iconfinder.com/ websites for their excellent free icon collection

About

Various ballistic calculation related apps, based on .Net port of a GNU Ballistics Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published