horizon

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

README

Horizon version

Package of the Sunangel Project

Provides:

  • Data formats for horizons used in the project
  • Utilities to calculate natural horizons
Refactoring arc(r) in circle.go

Before rewriting loop:

goos: linux
goarch: amd64
pkg: github.com/sunangel-project/horizon
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
BenchmarkArc-16    	 121483	    27358 ns/op
PASS
ok  	github.com/sunangel-project/horizon	3.429s

After rewriting loop:

goos: linux
goarch: amd64
pkg: github.com/sunangel-project/horizon
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
BenchmarkArc-16    	 171518	    14977 ns/op
PASS
ok  	github.com/sunangel-project/horizon	2.645s

After preallocating memory:

goos: linux
goarch: amd64
pkg: github.com/sunangel-project/horizon
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
BenchmarkArc-16    	 236554	     8541 ns/op
PASS
ok  	github.com/sunangel-project/horizon	2.076s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AltitudeArray

type AltitudeArray [horizonAngleResolution]float64

func AltitudeFromBytes

func AltitudeFromBytes(bytes []byte) (AltitudeArray, error)

AltitudeFromBytes returns an altitude array from a byte slice

type Horizon

type Horizon struct {
	Place *location.Location
	// contains filtered or unexported fields
}

func NewHorizon

func NewHorizon(place *location.Location, startRadius int) *Horizon

NewHorizon returns the computed horizon for a given location. The computation starts at the given startRadius

func NewHorizonWithAltitude

func NewHorizonWithAltitude(place *location.Location, r int, a AltitudeArray) *Horizon

NewHorizonWithAltitude returns a horizon with a given startRadius and altitude

func (*Horizon) AltitudeToBytes

func (hor *Horizon) AltitudeToBytes() []byte

AltitudeToBytes returns the altitude array of a horizon into a byte slice

func (Horizon) GetAltitude

func (horizon Horizon) GetAltitude(tgtAzimutAngle float64) float64

GetHorizonAngleAt returns the altitude angle of the horizon of a given location at a given azimut angle.

func (Horizon) GetAltitudeArray

func (hor Horizon) GetAltitudeArray() AltitudeArray

GetAltitudeArray returns the altitude array of the given horizon. Only use for testing!

func (Horizon) GetStartRadius

func (hor Horizon) GetStartRadius() int

GetStartRadius returns the start radius of the given horizon. Only use for testing!

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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