Documentation ¶
Overview ¶
package bearings contains functions for working with absolute and magnetic compass bearings.
Index ¶
- func Declination(p orb.Point, t time.Time) (unit.Angle, error)
- type Bearing
- type Magnetic
- func (b *Magnetic) Degrees() float64
- func (b *Magnetic) IsMagnetic() bool
- func (b *Magnetic) IsTrue() bool
- func (b *Magnetic) Magnetic(declination unit.Angle) Bearing
- func (b *Magnetic) Reciprocal() Bearing
- func (b *Magnetic) Rounded() unit.Angle
- func (b *Magnetic) RoundedDegrees() float64
- func (b *Magnetic) String() string
- func (b *Magnetic) True(declination unit.Angle) Bearing
- func (b *Magnetic) Value() unit.Angle
- type True
- func (b True) Degrees() float64
- func (b True) IsMagnetic() bool
- func (b True) IsTrue() bool
- func (b True) Magnetic(declination unit.Angle) Bearing
- func (b True) Reciprocal() Bearing
- func (b True) Rounded() unit.Angle
- func (b True) RoundedDegrees() float64
- func (b True) String() string
- func (b True) True(declination unit.Angle) Bearing
- func (b True) Value() unit.Angle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bearing ¶
type Bearing interface { // Value returns the compass heading, normalized in range (0, 360]. Value() unit.Angle // Rounded returns the compass heading, normalized in range (0, 360] rounded to the nearest degree. Rounded() unit.Angle // Degrees returns the compass heading in degrees, normalized in range (0, 360]. Degrees() float64 // RoundedDegrees returns the compass heading in degrees, normalized in range (0, 360] rounded to the nearest degree. RoundedDegrees() float64 // True bearing conversion computed with the given declination. True(declination unit.Angle) Bearing // Magnetic bearing conversion computed with the given declination. Magnetic(declination unit.Angle) Bearing // Reciprocal bearing. Reciprocal() Bearing // IsTrue returns true if the bearing is a true bearing. IsTrue() bool // IsMagnetic returns true if the bearing is a magnetic bearing. IsMagnetic() bool // String returns the value formatted as a three-digit string. String() string }
Bearing is a compass bearing that can be converted to true or magnetic bearing. Use either True or Magnetic immediately before use to assert which kind is used.
type Magnetic ¶
type Magnetic struct {
// contains filtered or unexported fields
}
Magnetic is a magnetic bearing, pointing at the magnetic north pole.
func NewMagneticBearing ¶
NewMagneticBearing creates a new magnetic bearing from the given value.
func (*Magnetic) IsMagnetic ¶
IsMagnetic returns true for a magnetic bearing.
func (*Magnetic) Reciprocal ¶
Reciprocal returns a magnetic reciprocal.
func (*Magnetic) RoundedDegrees ¶
RoundedDegrees returns the magnetic bearing in degrees, rounded to the nearest degree.
type True ¶
type True struct {
// contains filtered or unexported fields
}
True is a bearing pointing to geographic north.
func NewTrueBearing ¶
NewTrueBearing creates a new bearing from the given value.
func (True) IsMagnetic ¶
IsMagnetic returns false for a true bearing.
func (True) Magnetic ¶
Magnetic converts this true bearing to a magnetic bearing by subtracting the given declination.
func (True) Reciprocal ¶
Reciprocal returns a reciprocal true bearing.
func (True) RoundedDegrees ¶
RoundedDegrees returns the bearing in degrees, rounded to the nearest degree.