Documentation
¶
Overview ¶
Package unit consists of the helper classes for all measurement unit that are used in trajectory calculation - e.g. angular units, distance, velocity, energy and so on.
Index ¶
Constants ¶
const AngularCmPer100M byte = 7
AngularCmPer100M is the value indicating that the angular value is set in centimeters per 100 meters
const AngularDegree byte = 1
AngularDegree is the value indicating that the angular value is set in degrees
const AngularInchesPer100Yd byte = 6
AngularInchesPer100Yd is the value indicating that the angular value is set in inches per 100 yard
const AngularMOA byte = 2
AngularMOA is the value indicating that the angular value is set in minutes of angle
const AngularMRad byte = 4
AngularMRad is the value indicating that the angular value is set in milliradians
const AngularMil byte = 3
AngularMil is the value indicating that the angular value is set in mils (1/6400 of circle)
const AngularRadian byte = 0
AngularRadian is the value indicating that the angular value is set in radians
const AngularThousand byte = 5
AngularThousand is the value indicating that the angular value is set in thousands (1/6000 of circle)
const DistanceCentimeter byte = 16
DistanceCentimeter is the value indicating that the distance value is set in centimeters
const DistanceFoot byte = 11
DistanceFoot is the value indicating that the distance value is set in feet
const DistanceInch byte = 10
DistanceInch is the value indicating that the distance value is set in inches
const DistanceKilometer byte = 18
DistanceKilometer is the value indicating that the distance value is set in kilometers
const DistanceLine byte = 19
DistanceLine is the value indicating that the distance value is set in lines (1/10 of inch)
const DistanceMeter byte = 17
DistanceMeter is the value indicating that the distance value is set in meters
const DistanceMile byte = 13
DistanceMile is the value indicating that the distance value is set in miles
const DistanceMillimeter byte = 15
DistanceMillimeter is the value indicating that the distance value is set in millimeters
const DistanceNauticalMile byte = 14
DistanceNauticalMile is the value indicating that the distance value is set in nautical miles
const DistanceYard byte = 12
DistanceYard is the value indicating that the distance value is set in yards
const EnergyFootPound byte = 30
EnergyFootPound is the value indicating that energy value is expressed in foot-pounds
const EnergyJoule byte = 31
EnergyJoule is the value indicating that energy value is expressed in joules
const PressureBar byte = 42
PressureBar is the value indicating that pressure value is expressed in bars
const PressureHP byte = 43
PressureHP is the value indicating that pressure value is expressed in hectopascals
const PressureInHg byte = 41
PressureInHg is the value indicating that pressure value is expressed in inches of Mercury
const PressureMmHg byte = 40
PressureMmHg is the value indicating that pressure value is expressed in millimeters of Mercury
const PressurePSI byte = 44
PressurePSI is the value indicating that pressure value is expressed in pounds per square inch
const TemperatureCelsius byte = 51
TemperatureCelsius is the value indicating that temperature value is expressed in degrees of Celsius
const TemperatureFahrenheit byte = 50
TemperatureFahrenheit is the value indicating that temperature value is expressed in degrees of Fahrenheit
const TemperatureKelvin byte = 52
TemperatureKelvin is the value indicating that temperature value is expressed in degrees of Kelvin
const TemperatureRankin byte = 53
TemperatureRankin is the value indicating that temperature value is expressed in degrees of Rankin
const VelocityFPS byte = 62
VelocityFPS is the value indicating that velocity value is expressed in feet per second
const VelocityKMH byte = 61
VelocityKMH is the value indicating that velocity value is expressed in kilometers per hour
const VelocityKT byte = 64
VelocityKT is the value indicating that velocity value is expressed in knots
const VelocityMPH byte = 63
VelocityMPH is the value indicating that velocity value is expressed in miles per hour
const VelocityMPS byte = 60
VelocityMPS is the value indicating that velocity value is expressed in meters per second
const WeightGrain byte = 70
WeightGrain is the value indicating that weight value is expressed in grains
const WeightGram byte = 72
WeightGram is the value indicating that weight value is expressed in grams
const WeightKilogram byte = 74
WeightKilogram is the value indicating that weight value is expressed in kilograms
const WeightNewton byte = 75
WeightNewton is the value indicating that weight value is expressed in newtons of power
const WeightOunce byte = 71
WeightOunce is the value indicating that weight value is expressed in ounces
const WeightPound byte = 73
WeightPound is the value indicating that weight value is expressed in pounds
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Angular ¶
type Angular struct {
// contains filtered or unexported fields
}
Angular structure keeps information about angular units
func CreateAngular ¶
CreateAngular creates an angular value.
units are measurement unit and may be any value from unit.Angular_* constants.
func MustCreateAngular ¶
MustCreateAngular creates an angular value and panics instead of returned the error
func (Angular) Convert ¶
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Angular_* constants.
func (Angular) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.
func (Angular) String ¶
Prints the value in its default units.
The default unit is the unit used in the CreateAngular function or in Convert method.
type Distance ¶
type Distance struct {
// contains filtered or unexported fields
}
Distance structure keeps the The distance value
func CreateDistance ¶
CreateDistance creates a distance value.
units are measurement unit and may be any value from unit.Distance_* constants.
func MustCreateDistance ¶
MustCreateDistance creates the distance value but panics instead of returned a error
func (Distance) Convert ¶
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Distance_* constants.
func (Distance) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.
type Energy ¶
type Energy struct {
// contains filtered or unexported fields
}
Energy structure keeps information about kinetic energy
func CreateEnergy ¶
CreateEnergy creates a energy value.
units are measurement unit and may be any value from unit.Energy_* constants.
func MustCreateEnergy ¶
MustCreateEnergy creates the energy value but panics instead of returned a error
func (Energy) Convert ¶
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Energy_* constants.
func (Energy) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.
type Pressure ¶
type Pressure struct {
// contains filtered or unexported fields
}
Pressure structure keeps information about atmospheric pressure
func CreatePressure ¶
CreatePressure creates a pressure value.
units are measurement unit and may be any value from unit.Pressure_* constants.
func MustCreatePressure ¶
MustCreatePressure creates the pressure value but panics instead of returned a error
func (Pressure) Convert ¶
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Pressure_* constants.
func (Pressure) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.
type Temperature ¶
type Temperature struct {
// contains filtered or unexported fields
}
Temperature struct keeps information about the temperature
func CreateTemperature ¶
func CreateTemperature(value float64, units byte) (Temperature, error)
CreateTemperature creates a temperature value.
units are measurement unit and may be any value from unit.Temperature_* constants.
func MustCreateTemperature ¶
func MustCreateTemperature(value float64, units byte) Temperature
MustCreateTemperature creates the temperature value but panics instead of returned a error
func (Temperature) Convert ¶
func (v Temperature) Convert(units byte) Temperature
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Temperature_* constants.
func (Temperature) In ¶
func (v Temperature) In(units byte) float64
In convert the value in the specified units. Returns 0 if unit conversion is not possible.
func (Temperature) String ¶
func (v Temperature) String() string
func (Temperature) Units ¶
func (v Temperature) Units() byte
Units return the units in which the value is measured
type Velocity ¶
type Velocity struct {
// contains filtered or unexported fields
}
Velocity struct keeps velocity or speed values
func CreateVelocity ¶
CreateVelocity creates a velocity value.
units are measurement unit and may be any value from unit.Velocity_* constants.
func MustCreateVelocity ¶
MustCreateVelocity creates the velocity value but panics instead of returned a error
func (Velocity) Convert ¶
Convert converts the value into the specified units.
units are measurement unit and may be any value from unit.Velocity_* constants.
func (Velocity) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.
type Weight ¶
type Weight struct {
// contains filtered or unexported fields
}
Weight structure keeps data about weight
func CreateWeight ¶
CreateWeight creates a weight value.
units are measurement unit and may be any value from unit.Weight_* constants.
func MustCreateWeight ¶
MustCreateWeight creates the weight value but panics instead of return error
func (Weight) Convert ¶
Convert returns the value into the specified units.
units are measurement unit and may be any value from unit.Weight_* constants.
func (Weight) In ¶
In converts the value in the specified units. Returns 0 if unit conversion is not possible.