stars

package
v0.0.0-...-03ab727 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Gravitational constant
	G = 0.05
)

Simulation variables dt is set to 1

Variables

View Source
var StarList []*Star

StarList is a global slice of stars

Functions

func Move

func Move()

Move updates position for all stars

func Read

func Read(file string, simdata *SimData) error

Read simdata from file

func StartValues

func StartValues(nstars int) (int error)

StartValues set starting position and velocity Forms a circle with start velocities approx tangential counterclockwise

func VelocityBarnesHut

func VelocityBarnesHut()

VelocityBarnesHut updates position and velocity of all stars Velocity update is based on Barnes Hut approximation

func VelocityBarnesHutGR

func VelocityBarnesHutGR()

VelocityBarnesHutGR updates position and velocity of all stars Velocity update is based on Barnes Hut approximation with go-routines

func VelocityExact

func VelocityExact()

VelocityExact updates position and velocity of all stars Velocity update is based on exact calculation

func VelocityExactGR

func VelocityExactGR()

VelocityExactGR updates position and velocity of all stars Velocity update is based on exact calculation with go routines

func Write

func Write(file string) error

Write simdata to file

Types

type Pixel

type Pixel struct {
	Px []uint16
	Py []uint16
}

Pixel is internal data of pixel Maximum grid size is 2^16 x 2^16

type Quad

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

Quad is a rectangle that contains four smaller rectangles Values are total mass, center of gravity and depth

type SimData

type SimData struct {
	Width    int
	Height   int
	Steps    int
	Model    string
	Velocity float64
	Time     time.Duration
	Summary  string
	Stars    []Pixel
}

SimData contains simulation data Written by star-calc Read by star-sim

var (
	// Data is storage for simulation data
	Data SimData

	// White is ... the color white
	White = color.RGBA{
		byte(255),
		byte(255),
		byte(255),
		byte(0xff),
	}
)

type Star

type Star struct {
	X, Y float64
	// contains filtered or unexported fields
}

Star is a simple position and velocity coordinate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳