ballistic

package module
v0.0.0-...-e758291 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 2 Imported by: 0

README

ballistic

Ballistic Calculation library in Go

NOTE

This library is a work in progress.

Install

Install with go get -u github.com/linuxfreak003/ballistic

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingData = fmt.Errorf("missing rifle, environment, or target")

Functions

This section is empty.

Types

type Bullet

type Bullet struct {
	Caliber float64 // Diameter of bullet in inches
	Weight  float64 // Weight of bullet in grains
	BC      *Coefficient
	Length  float64 // bullet length in inches
}

type Coefficient

type Coefficient struct {
	Value      float64 // BC value
	FormFactor string  // FormFactor "G1" or "G7"
}

type Environment

type Environment struct {
	Temperature      float64 // In Fahrenheit
	Altitude         int     // in ft
	Pressure         float64 // in Hg
	Humidity         float64 // Himidity percentage
	WindAngle        float64 // Wind direction in degrees (0 to 360)
	WindSpeed        float64 // Wind speed in mph
	PressureAbsolute bool    // If true, only Pressure will be used
}

type Load

type Load struct {
	Bullet         *Bullet
	MuzzleVelocity *float64 // in ft/s (default 3000)
	ChronoDistance *float64 // Distanct to chonograph in ft (default 10 ft)
}

type Rifle

type Rifle struct {
	Name           string
	Load           *Load
	SightHeight    *float64 // Sight height in inches (default 1.5)
	BarrelTwist    *float64 // Barrel twist rate (default 7)
	TwistDirection string   // Twist direction "left" or "right" (default "right")
	ZeroRange      *float64 // Zero range of rifle in yrds (default 100)
}

func NewRifle

func NewRifle(name string, load *Load, sightH float64, twist float64, twistDir string, zero float64) *Rifle

type Scenario

type Scenario struct {
	Rifle            *Rifle
	Environment      *Environment
	Target           *Target
	IncludeSpinDrift bool
}

func NewScenario

func NewScenario(r *Rifle, e *Environment, t *Target, drift bool) *Scenario

func (*Scenario) Calculate

func (s *Scenario) Calculate(r float64) (float64, error)

func (*Scenario) SetEnvironment

func (s *Scenario) SetEnvironment(env *Environment)

func (*Scenario) SetIncludeSpinDrift

func (s *Scenario) SetIncludeSpinDrift(includeSpinDrift bool)

func (*Scenario) SetRifle

func (s *Scenario) SetRifle(rifle *Rifle)

Scvenario Set methods.

func (*Scenario) SetTarget

func (s *Scenario) SetTarget(target *Target)

func (*Scenario) String

func (s *Scenario) String() string

type Target

type Target struct {
	Speed  float64 // Target speed in mph
	Angle  float64 // Target direction in degrees
	Height float64 // Target size/height in inches
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL