measure

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 4 Imported by: 4 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package measure is typed quantities in natural units: the speed of light, the reduced planck constant and boltzmann's constant are all one, so mass, temperature and energy are one kind of thing, counted in MeV, and length and time are its inverse.

Every quantity is a type, made from the unit it comes in and read back out in the unit it goes out in. A caller hands in si units and reads si units back; the natural units are held inside. A bare number never crosses a package line, so a mass can't be handed in where an age goes.

exact.go turns the si's units into natural units through the si's own defining constants, which are exact. measured.go reads what is measured from celestial's research data. laws.go is what follows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Angle

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

Angle is an angle, held in radians, which have no unit.

func Arcseconds

func Arcseconds(amount float64) Angle

Arcseconds is an angle in arcseconds, the unit positions and their errors on the sky are given in.

func Degrees

func Degrees(amount float64) Angle

Degrees is an angle in degrees.

func Radians

func Radians(amount float64) Angle

Radians is an angle in radians.

func (Angle) InArcseconds

func (angle Angle) InArcseconds() float64

InArcseconds is the angle in arcseconds.

func (Angle) InDegrees

func (angle Angle) InDegrees() float64

InDegrees is the angle in degrees.

func (Angle) InRadians

func (angle Angle) InRadians() float64

InRadians is the angle in radians.

type Area

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

Area is an area, held in one over MeV squared

func Sphere

func Sphere(radius Length) Area

Sphere is the area of a sphere of a radius.

func SquareMetres

func SquareMetres(amount float64) Area

SquareMetres is an area in m2

func Thomson

func Thomson() Area

Thomson is how much of a beam one free electron turns aside: from how strongly light and charge couple, and the electron's mass.

func (Area) InSquareMetres

func (area Area) InSquareMetres() float64

InSquareMetres is the area in m2

type Coord

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

Coord is a place: x, y and z, each a position in natural units.

func At

func At(x, y, z Length) Coord

At is the place at three positions.

func Origin

func Origin() Coord

Origin is the place every frame measures from.

func (Coord) Minus

func (place Coord) Minus(from Coord) Displacement

Minus is how far this place is from another.

func (Coord) Plus

func (place Coord) Plus(by Displacement) Coord

Plus is the place a displacement from this one.

type Direction

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

Direction is a way to point: three parts with no unit, a length of one, so it says only which way.

func NewDirection

func NewDirection(x, y, z float64) (*Direction, error)

NewDirection is the way three numbers point. It refuses no way at all, and any part that is not a number or is endless, and then gives no direction.

func Up

func Up() Direction

Up is the kit's up, y.

func (Direction) Dot

func (way Direction) Dot(other Direction) float64

Dot is how far this way goes along another: one for the same way, nought for square to it, minus one for opposite.

func (Direction) Times

func (way Direction) Times(length Length) Displacement

Times is a displacement of a length this way.

type Displacement

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

Displacement is how far, and which way, one place is from another.

func Offset

func Offset(x, y, z Length) Displacement

Offset is a displacement of three lengths.

func (Displacement) AlongX

func (by Displacement) AlongX() Length

AlongX is the displacement's part along x.

func (Displacement) AlongY

func (by Displacement) AlongY() Length

AlongY is the displacement's part along y, the kit's up.

func (Displacement) AlongZ

func (by Displacement) AlongZ() Length

AlongZ is the displacement's part along z.

func (Displacement) Cross

func (by Displacement) Cross(moving Velocity) Sweep

Cross is the sweep of something this far out moving at a velocity: the plane of its motion, and twice the area it sweeps each moment.

func (Displacement) Direction

func (by Displacement) Direction() (*Direction, error)

Direction is which way the displacement goes; it refuses one that goes nowhere, and then gives no direction.

func (Displacement) Dot

func (by Displacement) Dot(other Displacement) Area

Dot is the displacement against another: their lengths times how far one goes along the other, an area.

func (Displacement) Length

func (by Displacement) Length() Length

Length is how far the displacement goes.

func (Displacement) Minus

func (by Displacement) Minus(other Displacement) Displacement

Minus is this displacement less another.

func (Displacement) Plus

func (by Displacement) Plus(other Displacement) Displacement

Plus is this displacement and another, one after the other.

func (Displacement) Times

func (by Displacement) Times(share float64) Displacement

Times is the displacement scaled by a share.

type Duration

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

Duration is a time, held in one over MeV

func Cosmos

func Cosmos() Duration

Cosmos is how old the universe is.

func Seconds

func Seconds(amount float64) Duration

Seconds is a time in s

func Years

func Years(amount float64) Duration

Years is a time in julian years

func (Duration) InSeconds

func (span Duration) InSeconds() float64

InSeconds is the time in s

func (Duration) InYears

func (span Duration) InYears() float64

InYears is the time in julian years

func (Duration) Minus

func (span Duration) Minus(less Duration) Duration

Minus is the time less another. Each side is rounded first, as Mass's Minus says why.

func (Duration) Over

func (span Duration) Over(other Duration) float64

Over is how many of another time this one is

type Energy

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

Energy is an energy, in MeV

func Electronvolts

func Electronvolts(amount float64) Energy

Electronvolts is an energy in eV

func Joules

func Joules(amount float64) Energy

Joules is an energy in J

func MeV

func MeV(amount float64) Energy

MeV is an energy in MeV

func Photon

func Photon(wavelength Length) Energy

Photon is the energy of light of a wavelength: a full turn over the wavelength.

func (Energy) InElectronvolts

func (energy Energy) InElectronvolts() float64

InElectronvolts is the energy in eV

func (Energy) InJoules

func (energy Energy) InJoules() float64

InJoules is the energy in J

func (Energy) InMeV

func (energy Energy) InMeV() float64

InMeV is the energy in MeV

func (Energy) Times

func (energy Energy) Times(share float64) Energy

Times is the energy scaled by a share

type Length

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

Length is a length, held in one over MeV

func GM

func GM(mass Mass) Length

GM is a mass times newton's G: in natural units a length, half the horizon radius of a hole of that mass. Bodies whose GM is measured keep it; this is for a mass known as a mass.

func Metres

func Metres(amount float64) Length

Metres is a length in m

func SolarRadii

func SolarRadii(amount float64) Length

SolarRadii is a length in the sun's radius

func (Length) InMetres

func (length Length) InMetres() float64

InMetres is the length in m

func (Length) InSolarRadii

func (length Length) InSolarRadii() float64

InSolarRadii is the length in the sun's radius

func (Length) Over

func (length Length) Over(other Length) float64

Over is how many of another length this one is

func (Length) Times

func (length Length) Times(share float64) Length

Times is the length scaled by a share

type LightFraction

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

LightFraction is a speed, as a share of light's: with the speed of light one, that is what a speed is, and it has no unit.

func (LightFraction) InKilometresPerSecond

func (speed LightFraction) InKilometresPerSecond() float64

InKilometresPerSecond is the speed in km/s.

func (LightFraction) InLightFraction

func (speed LightFraction) InLightFraction() float64

InLightFraction is the speed as a share of light's.

type Mass

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

Mass is a mass, held as the energy it is at rest

func Daltons

func Daltons(amount float64) Mass

Daltons is a mass in daltons, a twelfth of a carbon 12 atom

func Electron

func Electron() Mass

Electron is the electron's mass.

func Helium4

func Helium4() Mass

Helium4 is the mass of a helium 4 atom, its electrons and all.

func Hydrogen1

func Hydrogen1() Mass

Hydrogen1 is the mass of a hydrogen 1 atom, its electron and all.

func Kilograms

func Kilograms(amount float64) Mass

Kilograms is a mass in kg

func Proton

func Proton() Mass

Proton is the proton's mass.

func SolarMasses

func SolarMasses(amount float64) Mass

SolarMasses is a mass in the sun's masses

func (Mass) Energy

func (mass Mass) Energy() Energy

Energy is the energy the mass is, at rest

func (Mass) InKilograms

func (mass Mass) InKilograms() float64

InKilograms is the mass in kg

func (Mass) InMeV

func (mass Mass) InMeV() float64

InMeV is the mass in MeV, which is its energy at rest

func (Mass) InSolarMasses

func (mass Mass) InSolarMasses() float64

InSolarMasses is the mass in the sun's masses

func (Mass) Minus

func (mass Mass) Minus(less Mass) Mass

Minus is the mass less another. Each side is rounded first, as an explicit float64 conversion does: inlined, a product that made a mass could fuse with the subtraction on arm64, and a mass less itself would leave the product's rounding behind instead of nothing.

func (Mass) Over

func (mass Mass) Over(other Mass) float64

Over is how many of another mass this one is

func (Mass) Positive

func (mass Mass) Positive() bool

Positive is whether the mass is above nothing and finite.

func (Mass) Times

func (mass Mass) Times(share float64) Mass

Times is the mass scaled by a share

type Nominal

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

Nominal is a star's measures as the IAU fixes them for reference: its GM, radius and luminosity, and the mass that follows.

func Sun

func Sun() Nominal

Sun is the IAU's nominal sun: its GM, radius and luminosity as the IAU fixes them, and its mass from its GM over G.

func (Nominal) GM

func (star Nominal) GM() Length

GM is the star's mass times G, as the IAU fixes it.

func (Nominal) Luminosity

func (star Nominal) Luminosity() Power

Luminosity is the star's luminosity.

func (Nominal) Mass

func (star Nominal) Mass() Mass

Mass is the star's mass, its GM over G.

func (Nominal) Radius

func (star Nominal) Radius() Length

Radius is the star's radius.

type Power

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

Power is energy given off over time, held in MeV squared

func BlackBody

func BlackBody(heat Temperature, area Area) Power

BlackBody is the power a black surface of an area gives off at a temperature.

func Eddington

func Eddington(mass Mass) Power

Eddington is the brightest a mass can shine before its own light pushes its gas away: gravity pulling on each proton against light pushing on each electron, for gas of pure hydrogen.

Past it, a star sheds itself, and a hole's food is blown back out.

func SolarLuminosities

func SolarLuminosities(amount float64) Power

SolarLuminosities is a power in the sun's luminosity

func Watts

func Watts(amount float64) Power

Watts is a power in W

func (Power) InSolarLuminosities

func (power Power) InSolarLuminosities() float64

InSolarLuminosities is the power in the sun's luminosity

func (Power) InWatts

func (power Power) InWatts() float64

InWatts is the power in W

func (Power) Over

func (power Power) Over(other Power) float64

Over is how many of another power this one is

func (Power) Spending

func (power Power) Spending(energy Energy) Duration

Spending is how long the power takes to give off an energy

func (Power) Times

func (power Power) Times(share float64) Power

Times is the power scaled by a share

type Sweep

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

Sweep is a distance crossed with a velocity: the north of the plane a body moves in, and twice the area it sweeps each moment, which kepler's second law says an orbit keeps.

func (Sweep) North

func (sweep Sweep) North() (*Direction, error)

North is the way the plane of the motion faces. It refuses a sweep of nought, which is motion straight toward or away, with no plane, and then gives no direction.

func (Sweep) Size

func (sweep Sweep) Size() Length

Size is how much the sweep is: in natural units a length.

type Temperature

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

Temperature is a temperature, held as the energy k T

func Kelvin

func Kelvin(amount float64) Temperature

Kelvin is a temperature in K

func SurfaceTemperature

func SurfaceTemperature(power Power, area Area) Temperature

SurfaceTemperature is how hot a black surface of an area must be to give off a power: the fourth root of stefan's law, undone.

func (Temperature) InKelvin

func (heat Temperature) InKelvin() float64

InKelvin is the temperature in K

func (Temperature) InMeV

func (heat Temperature) InMeV() float64

InMeV is the temperature as the energy k T, in MeV

type Velocity

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

Velocity is how fast and which way, each part a share of light's speed. Velocities here add the way slow things add; near light's speed that is wrong, and nothing here moves that fast.

func KilometresPerSecond

func KilometresPerSecond(x, y, z float64) (*Velocity, error)

KilometresPerSecond is a velocity of three parts in km/s. It refuses a part that is not a number, and a speed at light's or past it, and then gives no velocity.

func (Velocity) AlongX

func (moving Velocity) AlongX() LightFraction

AlongX is the velocity's part along x.

func (Velocity) AlongY

func (moving Velocity) AlongY() LightFraction

AlongY is the velocity's part along y, the kit's up.

func (Velocity) AlongZ

func (moving Velocity) AlongZ() LightFraction

AlongZ is the velocity's part along z.

func (Velocity) Dot

func (moving Velocity) Dot(other Velocity) float64

Dot is the velocity against another, with no unit.

func (Velocity) Minus

func (moving Velocity) Minus(other Velocity) Velocity

Minus is this velocity seen from something moving at another.

func (Velocity) Plus

func (moving Velocity) Plus(other Velocity) Velocity

Plus is this velocity and another together.

func (Velocity) Speed

func (moving Velocity) Speed() LightFraction

Speed is how fast, whichever way.

func (Velocity) Times

func (moving Velocity) Times(share float64) Velocity

Times is the velocity scaled by a share.

Jump to

Keyboard shortcuts

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