unit

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: LGPL-3.0 Imports: 2 Imported by: 0

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

View Source
const AngularCmPer100M byte = 7

AngularCmPer100M is the value indicating that the angular value is set in centimeters per 100 meters

View Source
const AngularDegree byte = 1

AngularDegree is the value indicating that the angular value is set in degrees

View Source
const AngularInchesPer100Yd byte = 6

AngularInchesPer100Yd is the value indicating that the angular value is set in inches per 100 yard

View Source
const AngularMOA byte = 2

AngularMOA is the value indicating that the angular value is set in minutes of angle

View Source
const AngularMRad byte = 4

AngularMRad is the value indicating that the angular value is set in milliradians

View Source
const AngularMil byte = 3

AngularMil is the value indicating that the angular value is set in mils (1/6400 of circle)

View Source
const AngularRadian byte = 0

AngularRadian is the value indicating that the angular value is set in radians

View Source
const AngularThousand byte = 5

AngularThousand is the value indicating that the angular value is set in thousands (1/6000 of circle)

View Source
const DistanceCentimeter byte = 16

DistanceCentimeter is the value indicating that the distance value is set in centimeters

View Source
const DistanceFoot byte = 11

DistanceFoot is the value indicating that the distance value is set in feet

View Source
const DistanceInch byte = 10

DistanceInch is the value indicating that the distance value is set in inches

View Source
const DistanceKilometer byte = 18

DistanceKilometer is the value indicating that the distance value is set in kilometers

View Source
const DistanceLine byte = 19

DistanceLine is the value indicating that the distance value is set in lines (1/10 of inch)

View Source
const DistanceMeter byte = 17

DistanceMeter is the value indicating that the distance value is set in meters

View Source
const DistanceMile byte = 13

DistanceMile is the value indicating that the distance value is set in miles

View Source
const DistanceMillimeter byte = 15

DistanceMillimeter is the value indicating that the distance value is set in millimeters

View Source
const DistanceNauticalMile byte = 14

DistanceNauticalMile is the value indicating that the distance value is set in nautical miles

View Source
const DistanceYard byte = 12

DistanceYard is the value indicating that the distance value is set in yards

View Source
const EnergyFootPound byte = 30

EnergyFootPound is the value indicating that energy value is expressed in foot-pounds

View Source
const EnergyJoule byte = 31

EnergyJoule is the value indicating that energy value is expressed in joules

View Source
const PressureBar byte = 42

PressureBar is the value indicating that pressure value is expressed in bars

View Source
const PressureHP byte = 43

PressureHP is the value indicating that pressure value is expressed in hectopascals

View Source
const PressureInHg byte = 41

PressureInHg is the value indicating that pressure value is expressed in inches of Mercury

View Source
const PressureMmHg byte = 40

PressureMmHg is the value indicating that pressure value is expressed in millimeters of Mercury

View Source
const PressurePSI byte = 44

PressurePSI is the value indicating that pressure value is expressed in pounds per square inch

View Source
const TemperatureCelsius byte = 51

TemperatureCelsius is the value indicating that temperature value is expressed in degrees of Celsius

View Source
const TemperatureFahrenheit byte = 50

TemperatureFahrenheit is the value indicating that temperature value is expressed in degrees of Fahrenheit

View Source
const TemperatureKelvin byte = 52

TemperatureKelvin is the value indicating that temperature value is expressed in degrees of Kelvin

View Source
const TemperatureRankin byte = 53

TemperatureRankin is the value indicating that temperature value is expressed in degrees of Rankin

View Source
const VelocityFPS byte = 62

VelocityFPS is the value indicating that velocity value is expressed in feet per second

View Source
const VelocityKMH byte = 61

VelocityKMH is the value indicating that velocity value is expressed in kilometers per hour

View Source
const VelocityKT byte = 64

VelocityKT is the value indicating that velocity value is expressed in knots

View Source
const VelocityMPH byte = 63

VelocityMPH is the value indicating that velocity value is expressed in miles per hour

View Source
const VelocityMPS byte = 60

VelocityMPS is the value indicating that velocity value is expressed in meters per second

View Source
const WeightGrain byte = 70

WeightGrain is the value indicating that weight value is expressed in grains

View Source
const WeightGram byte = 72

WeightGram is the value indicating that weight value is expressed in grams

View Source
const WeightKilogram byte = 74

WeightKilogram is the value indicating that weight value is expressed in kilograms

View Source
const WeightNewton byte = 75

WeightNewton is the value indicating that weight value is expressed in newtons of power

View Source
const WeightOunce byte = 71

WeightOunce is the value indicating that weight value is expressed in ounces

View Source
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

func CreateAngular(value float64, units byte) (Angular, error)

CreateAngular creates an angular value.

units are measurement unit and may be any value from unit.Angular_* constants.

func MustCreateAngular

func MustCreateAngular(value float64, units byte) Angular

MustCreateAngular creates an angular value and panics instead of returned the error

func (Angular) Convert

func (v Angular) Convert(units byte) Angular

Convert converts the value into the specified units.

units are measurement unit and may be any value from unit.Angular_* constants.

func (Angular) In

func (v Angular) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Angular) String

func (v Angular) String() string

Prints the value in its default units.

The default unit is the unit used in the CreateAngular function or in Convert method.

func (Angular) Units

func (v Angular) Units() byte

Units return the units in which the value is measured

func (Angular) Value

func (v Angular) Value(units byte) (float64, error)

Value returns the value of the angle in the specified units.

units are measurement unit and may be any value from unit.Angular_* constants.

The method returns a error in case the unit is not supported.

type Distance

type Distance struct {
	// contains filtered or unexported fields
}

Distance structure keeps the The distance value

func CreateDistance

func CreateDistance(value float64, units byte) (Distance, error)

CreateDistance creates a distance value.

units are measurement unit and may be any value from unit.Distance_* constants.

func MustCreateDistance

func MustCreateDistance(value float64, units byte) Distance

MustCreateDistance creates the distance value but panics instead of returned a error

func (Distance) Convert

func (v Distance) Convert(units byte) Distance

Convert converts the value into the specified units.

units are measurement unit and may be any value from unit.Distance_* constants.

func (Distance) In

func (v Distance) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Distance) String

func (v Distance) String() string

func (Distance) Units

func (v Distance) Units() byte

Units return the units in which the value is measured

func (Distance) Value

func (v Distance) Value(units byte) (float64, error)

Value returns the value of the distance in the specified units.

units are measurement unit and may be any value from unit.Distance_* constants.

The method returns a error in case the unit is not supported.

type Energy

type Energy struct {
	// contains filtered or unexported fields
}

Energy structure keeps information about kinetic energy

func CreateEnergy

func CreateEnergy(value float64, units byte) (Energy, error)

CreateEnergy creates a energy value.

units are measurement unit and may be any value from unit.Energy_* constants.

func MustCreateEnergy

func MustCreateEnergy(value float64, units byte) Energy

MustCreateEnergy creates the energy value but panics instead of returned a error

func (Energy) Convert

func (v Energy) Convert(units byte) Energy

Convert converts the value into the specified units.

units are measurement unit and may be any value from unit.Energy_* constants.

func (Energy) In

func (v Energy) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Energy) String

func (v Energy) String() string

func (Energy) Units

func (v Energy) Units() byte

Units return the units in which the value is measured

func (Energy) Value

func (v Energy) Value(units byte) (float64, error)

Value returns the value of the energy in the specified units.

units are measurement unit and may be any value from unit.Energy_* constants.

The method returns a error in case the unit is not supported.

type Pressure

type Pressure struct {
	// contains filtered or unexported fields
}

Pressure structure keeps information about atmospheric pressure

func CreatePressure

func CreatePressure(value float64, units byte) (Pressure, error)

CreatePressure creates a pressure value.

units are measurement unit and may be any value from unit.Pressure_* constants.

func MustCreatePressure

func MustCreatePressure(value float64, units byte) Pressure

MustCreatePressure creates the pressure value but panics instead of returned a error

func (Pressure) Convert

func (v Pressure) Convert(units byte) Pressure

Convert converts the value into the specified units.

units are measurement unit and may be any value from unit.Pressure_* constants.

func (Pressure) In

func (v Pressure) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Pressure) String

func (v Pressure) String() string

func (Pressure) Units

func (v Pressure) Units() byte

Units return the units in which the value is measured

func (Pressure) Value

func (v Pressure) Value(units byte) (float64, error)

Value returns the value of the pressure in the specified units.

units are measurement unit and may be any value from unit.Pressure_* constants.

The method returns a error in case the unit is not supported.

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

func (Temperature) Value

func (v Temperature) Value(units byte) (float64, error)

Value returns the value of the temperature in the specified units.

units are measurement unit and may be any value from unit.Temperature_* constants.

The method returns a error in case the unit is not supported.

type Velocity

type Velocity struct {
	// contains filtered or unexported fields
}

Velocity struct keeps velocity or speed values

func CreateVelocity

func CreateVelocity(value float64, units byte) (Velocity, error)

CreateVelocity creates a velocity value.

units are measurement unit and may be any value from unit.Velocity_* constants.

func MustCreateVelocity

func MustCreateVelocity(value float64, units byte) Velocity

MustCreateVelocity creates the velocity value but panics instead of returned a error

func (Velocity) Convert

func (v Velocity) Convert(units byte) Velocity

Convert converts the value into the specified units.

units are measurement unit and may be any value from unit.Velocity_* constants.

func (Velocity) In

func (v Velocity) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Velocity) String

func (v Velocity) String() string

func (Velocity) Units

func (v Velocity) Units() byte

Units return the units in which the value is measured

func (Velocity) Value

func (v Velocity) Value(units byte) (float64, error)

Value returns the value of the velocity in the specified units.

units are measurement unit and may be any value from unit.Velocity_* constants.

The method returns a error in case the unit is not supported.

type Weight

type Weight struct {
	// contains filtered or unexported fields
}

Weight structure keeps data about weight

func CreateWeight

func CreateWeight(value float64, units byte) (Weight, error)

CreateWeight creates a weight value.

units are measurement unit and may be any value from unit.Weight_* constants.

func MustCreateWeight

func MustCreateWeight(value float64, units byte) Weight

MustCreateWeight creates the weight value but panics instead of return error

func (Weight) Convert

func (v Weight) Convert(units byte) Weight

Convert returns the value into the specified units.

units are measurement unit and may be any value from unit.Weight_* constants.

func (Weight) In

func (v Weight) In(units byte) float64

In converts the value in the specified units. Returns 0 if unit conversion is not possible.

func (Weight) String

func (v Weight) String() string

func (Weight) Units

func (v Weight) Units() byte

Units return the units in which the value is measured

func (Weight) Value

func (v Weight) Value(units byte) (float64, error)

Value returns the value of the weight in the specified units.

units are measurement unit and may be any value from unit.Weight_* constants.

The method returns a error in case the unit is not supported.

Jump to

Keyboard shortcuts

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