angular

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package angle provides types for dealing with angles in planar geometry in a type-safe way. Constants and methods are provided for setting and displaying type values using different units.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acceleration

type Acceleration float64

Acceleration describes an angular acceleration in planar geometry.

Units for Acceleration values. Always multiply with a unit when setting the initial value like you would for time.Time. This prevents you from having to worry about the internal storage format.

func (Acceleration) Abs

func (a Acceleration) Abs() Acceleration

Abs returns the absolute value of a as a copy.

func (Acceleration) DegreeesPerSecondSquared

func (a Acceleration) DegreeesPerSecondSquared() float64

DegreeesPerSecondSquared returns a as a floating point number of degreeespersecondsquared.

func (Acceleration) Div

Div returns the quotient of a / x as a new Acceleration.

func (Acceleration) DivAcceleration

func (a Acceleration) DivAcceleration(x Acceleration) float64

DivAcceleration returns the quotient of a / x as a floating point number.

func (Acceleration) GradiansPerSecondSquared

func (a Acceleration) GradiansPerSecondSquared() float64

GradiansPerSecondSquared returns a as a floating point number of gradianspersecondsquared.

func (Acceleration) MilliradiansPerSecondSquared

func (a Acceleration) MilliradiansPerSecondSquared() float64

MilliradiansPerSecondSquared returns a as a floating point number of milliradianspersecondsquared.

func (Acceleration) Mul

Mul returns the product of a * x as a new Acceleration.

func (Acceleration) MulDuration

func (a Acceleration) MulDuration(t time.Duration) Velocity

MulDuration returns the product of a * t as a Velocity.

func (Acceleration) RadiansPerSecondSquared

func (a Acceleration) RadiansPerSecondSquared() float64

RadiansPerSecondSquared returns a as a floating point number of radianspersecondsquared.

type Angle

type Angle float64

Angle for planar geometry stored as float64 milliradians. An integer representation would give better predictability (under flow), but float64 is more convenient for operatoins that rely on the math library.

const (
	Milliradian Angle = 1
	Radian      Angle = 1e3
	Degree      Angle = 2 * math.Pi * (Radian / 360)
	Gradian     Angle = 2 * math.Pi * (Radian / 400)
)

Units for Angle values. Always multiply with a unit when setting the initial value like you would for time.Time. This prevents you from having to worry about the internal storage format.

func Atan2

func Atan2(y, x float64) Angle

Atan2 returns the arc tangent of y/x as an Angle. See math.Atan2 for details.

func (Angle) Abs

func (ng Angle) Abs() Angle

Abs returns the absolute value of ng as a copy.

func (Angle) Cos

func (a Angle) Cos() float64

Cos returns the cosinus of a as a floating point number.

func (Angle) Degreees

func (ng Angle) Degreees() float64

Degreees returns ng as a floating point number of degreees.

func (Angle) Div

func (ng Angle) Div(x float64) Angle

Div returns the quotient of ng / x as a new Angle.

func (Angle) DivAngle

func (ng Angle) DivAngle(x Angle) float64

DivAngle returns the quotient of ng / x as a floating point number.

func (Angle) DivDuration

func (ng Angle) DivDuration(t time.Duration) Velocity

DivDuration returns the quotient of ng / t as a Velocity.

func (Angle) DivVelocity

func (ng Angle) DivVelocity(x Velocity) time.Duration

DivVelocity returns the quotient of ng / x as a time.Duration.

func (Angle) Gradians

func (ng Angle) Gradians() float64

Gradians returns ng as a floating point number of gradians.

func (Angle) Milliradians

func (ng Angle) Milliradians() float64

Milliradians returns ng as a floating point number of milliradians.

func (Angle) Mul

func (ng Angle) Mul(x float64) Angle

Mul returns the product of ng * x as a new Angle.

func (Angle) Normalize

func (a Angle) Normalize() Angle

Normalize the angle to be between -pi and +pi radians.

func (Angle) Radians

func (ng Angle) Radians() float64

Radians returns ng as a floating point number of radians.

func (Angle) Sin

func (a Angle) Sin() float64

Sin returns the sinus of a as a floating point number.

func (Angle) Tan

func (a Angle) Tan() float64

Tan returns the tangens of a as a floating point number.

type Velocity

type Velocity float64

Velocity describes an angular velocity in planar geometry.

const (
	MilliradianPerSecond Velocity = Velocity(Milliradian) / Velocity(time.Second)
	RadianPerSecond      Velocity = Velocity(Radian) / Velocity(time.Second)
	DegreePerSecond      Velocity = Velocity(Degree) / Velocity(time.Second)
	GradianPerSecond     Velocity = Velocity(Gradian) / Velocity(time.Second)
)

Units for Velocity values. Always multiply with a unit when setting the initial value like you would for time.Time. This prevents you from having to worry about the internal storage format.

func (Velocity) Abs

func (v Velocity) Abs() Velocity

Abs returns the absolute value of v as a copy.

func (Velocity) DegreeesPerSecond

func (v Velocity) DegreeesPerSecond() float64

DegreeesPerSecond returns v as a floating point number of degreeespersecond.

func (Velocity) Div

func (v Velocity) Div(x float64) Velocity

Div returns the quotient of v / x as a new Velocity.

func (Velocity) DivAcceleration

func (v Velocity) DivAcceleration(x Acceleration) time.Duration

DivAcceleration returns the quotient of v / x as a time.Duration.

func (Velocity) DivDuration

func (v Velocity) DivDuration(t time.Duration) Acceleration

DivDuration returns the quotient of v / t as a Acceleration.

func (Velocity) DivVelocity

func (v Velocity) DivVelocity(x Velocity) float64

DivVelocity returns the quotient of v / x as a floating point number.

func (Velocity) GradiansPerSecond

func (v Velocity) GradiansPerSecond() float64

GradiansPerSecond returns v as a floating point number of gradianspersecond.

func (Velocity) MilliradiansPerSecond

func (v Velocity) MilliradiansPerSecond() float64

MilliradiansPerSecond returns v as a floating point number of milliradianspersecond.

func (Velocity) Mul

func (v Velocity) Mul(x float64) Velocity

Mul returns the product of v * x as a new Velocity.

func (Velocity) MulDuration

func (v Velocity) MulDuration(t time.Duration) Angle

MulDuration returns the product of v * t as a Angle.

func (Velocity) RadiansPerSecond

func (v Velocity) RadiansPerSecond() float64

RadiansPerSecond returns v as a floating point number of radianspersecond.

Jump to

Keyboard shortcuts

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