orbcore

package
v0.0.0-...-3fecada Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package orbcore provides functions to work out orbital details for an asronomical object.

Index

Constants

View Source
const (
	AxisX Axis = 0
	AxisY      = 1
	AxisZ      = 2
)

Constants for three major axis

Variables

This section is empty.

Functions

func Identity

func Identity(size int) *mat.DiagDense

Identity creates an identity matrix (square, with ones on the diag)

func MeanMotionSteppedChannel

func MeanMotionSteppedChannel(orbit *Orbit, timeStep time.Duration, count int64, output chan *Orbit)

MeanMotionSteppedChannel works like MeanMotionStepped except it puts the results down a channel rather than returning a list

func OrbitToVecPerifocal

func OrbitToVecPerifocal(orbit *Orbit) (*mat.VecDense, *mat.VecDense)

OrbitToVecPerifocal converts a MinorPlanet object into r and v vectors in the perifocal frame

func OrbitToVector

func OrbitToVector(orbit *Orbit) (mat.Vector, mat.Vector)

OrbitToVector creates a vector representation from a MinorPlanet object

func OrbitalPeriod

func OrbitalPeriod(orbit *Orbit) time.Duration

OrbitalPeriod returns the time taken for a complete orbit.

func QuickerRotationMatrixForOrbit

func QuickerRotationMatrixForOrbit(angleZ1, angleX, angleZ2 float64) *mat.Dense

QuickerRotationMatrixForOrbit builds a rotation matrix for an orbit by manually doing the matrix multiplication This is a lot faster than the RotationMatrixForOrbit.

func Rotate

func Rotate(vec *mat.VecDense, angle float64, axis Axis) *mat.VecDense

Rotate rotates the vector around the given axis

func RotationMatrix

func RotationMatrix(angle float64, axis Axis) *mat.Dense

RotationMatrix returns a rotation matrix for the given angle and axis Will panic if the axis is not one of AxisX, AxisY, AxisZ

func RotationMatrixForOrbit

func RotationMatrixForOrbit(angleZ1, angleX, angleZ2 float64) *mat.Dense

RotationMatrixForOrbit creates a rotation matrix that is the three rotations we need for sorting out an orbit vector Using this means we have to 4 matrix multiplications rather than 6

If this is in the hot path of your code consider using QuickerRotationMatrixForOrbit instead.

func VectorToHelocentric

func VectorToHelocentric(r mat.Vector, v mat.Vector) (mat.Vector, mat.Vector)

VectorToHelocentric converts to helocentric reference frame from the default used by the MPC

Types

type Axis

type Axis int

Axis represents one of the cartisen axis

type BoundingBox

type BoundingBox struct {
	MinX    float64
	MinY    float64
	MinZ    float64
	MinTime time.Time
	MaxX    float64
	MaxY    float64
	MaxZ    float64
	MaxTime time.Time
}

BoundingBox defines a four dimensional bounding box in space and time.

func PositionsToBoundingBox

func PositionsToBoundingBox(positions []*Position) *BoundingBox

PositionsToBoundingBox creates a bounding box around a set of positions.

func (*BoundingBox) Center

func (bb *BoundingBox) Center() Position

Center returns the point in the center of this bounding box.

func (*BoundingBox) Contains

func (bb *BoundingBox) Contains(pos *Position) bool

Contains returns true if the provided position is inside the box.

func (*BoundingBox) Corners

func (bb *BoundingBox) Corners() [16]Position

Corners returns the 16 corners of our 4 dimensional bounding box.

func (*BoundingBox) Overlaps

func (bb *BoundingBox) Overlaps(other *BoundingBox) bool

Overlaps returns true if the other bounding box overlaps this one.

func (*BoundingBox) String

func (bb *BoundingBox) String() string

type BoundingBoxSplitter

type BoundingBoxSplitter struct {
	Box    *BoundingBox
	Center Position
	// contains filtered or unexported fields
}

func NewBoundingBoxSplitter

func NewBoundingBoxSplitter(box *BoundingBox) BoundingBoxSplitter

func (BoundingBoxSplitter) At

func (BoundingBoxSplitter) HasNext

func (bs BoundingBoxSplitter) HasNext() bool

func (BoundingBoxSplitter) Next

func (bs BoundingBoxSplitter) Next() *BoundingBox

type Orbit

type Orbit struct {
	ID                          string
	ParentGrav                  float64
	Epoch                       time.Time
	MeanAnomalyEpoch            float64 // nu
	ArgumentOfPerihelion        float64 // w argp
	LongitudeOfTheAscendingNode float64 // omega raan
	InclinationToTheEcliptic    float64 // i inc
	OrbitalEccentricity         float64 // e ecc
	MeanDailyMotion             float64
	SemimajorAxis               float64 // a p
}

Orbit holds required information for orbit calculations

func MeanMotion

func MeanMotion(orbit *Orbit, t time.Duration) *Orbit

MeanMotion uses the mean motion method to propagate [orbit] through [t] seconds .

func MeanMotionFullOrbit

func MeanMotionFullOrbit(orbit *Orbit, count int64) []*Orbit

MeanMotionFullOrbit will calculate a number of entries for a full orbit, divided into [count] steps

func MeanMotionStepped

func MeanMotionStepped(orbit *Orbit, timeStep time.Duration, count int64) []*Orbit

MeanMotionStepped calculates a mean motion value for [count] [timeStep]s and returns a list of orbits. Note: The first entry in the returned list will always be the starting orbit object.

func MeanMotionToDate

func MeanMotionToDate(orbit *Orbit, d time.Time) *Orbit

MeanMotionToDate calculates the mean motion value for a defined date.

func (*Orbit) Clone

func (o *Orbit) Clone() *Orbit

Clone makes a copy of this orbit object

func (*Orbit) String

func (o *Orbit) String() string

type Position

type Position struct {
	ID    string
	Epoch time.Time
	X     float64
	Y     float64
	Z     float64
}

Position contains information about the location in space of an object

func OrbitToPosition

func OrbitToPosition(orb *Orbit) *Position

OrbitToPosition converts an object object to its position on day 0

func ParsePositionLine

func ParsePositionLine(line string) (*Position, error)

ParsePositionLine takes a CSV formatted line representing a possition and returns the object or an error

func ReadPositionFile

func ReadPositionFile(path string) (pos []*Position, err error)

ReadPositionFile opens a path an loads in a CSV formatted list of Positions

func ReadPositions

func ReadPositions(input io.Reader) ([]*Position, error)

ReadPositions takes a reader and parses a CSV formatted list of positions.

func (*Position) String

func (p *Position) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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