vpmath

package
v0.0.0-...-bf055c7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package vpmath contains mathematical functions, including fixed point implementations of typical floating point operations such as square root, sinus, and cosinus.

Index

Constants

View Source
const F32Const180 float32 = 180.0

F32Const180 stores 180 degrees as a float32.

View Source
const F32Const360 float32 = 360.0

F32Const360 stores 360 degrees as a float32.

View Source
const F32Const90 float32 = 90.0

F32Const90 stores 90 degrees as a float32.

View Source
const F64Const180 float64 = 180.0

F64Const180 stores 180 degrees as a float64.

View Source
const F64Const360 float64 = 360.0

F64Const360 stores 360 degrees as a float64.

View Source
const F64Const90 float64 = 90.0

F64Const90 stores 90 degrees as a float64.

View Source
const PackageCopyright = "Copyright (C)  2015, 2016  Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh

PackageCopyright contains a short copyright notice.

View Source
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh

PackageEmail contains a contact email for the package.

View Source
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh

PackageLicense contains a short license information.

View Source
const PackageName = "Vapor Toolkit" // PackageName set by version.sh

PackageName contains a readable name of the package, suitable for display.

View Source
const PackageTarname = "vapor" // PackageTarname set by version.sh

PackageTarname contains a short name of the package, suitable for a filename.

View Source
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh

PackageURL contains the address of the project homepage.

View Source
const VersionMajor = 0 // VersionMajor set by version.sh

VersionMajor is the project major version.

View Source
const VersionMinor = 3 // VersionMinor set by version.sh

VersionMinor is the project minor version.

View Source
const VersionStamp = "c6a4298" // VersionStamp set by version.sh

VersionStamp is the project stamp, possibly changes for each build.

View Source
const X32Const180 vpnumber.X32 = 180 * vpnumber.X32Const1

X32Const180 stores 180 degrees as a 32-bit fixed point number..

View Source
const X32Const2Pi vpnumber.X32 = 411775

X32Const2Pi contains 2*PI, that is, about 6.28, as a fixed point integer on 32 bits.

View Source
const X32Const360 vpnumber.X32 = 360 * vpnumber.X32Const1

X32Const360 stores 360 degrees as a 32-bit fixed point number..

View Source
const X32Const90 vpnumber.X32 = 90 * vpnumber.X32Const1

X32Const90 stores 90 degrees as a 32-bit fixed point number..

View Source
const X32ConstPi vpnumber.X32 = 205887

X32ConstPi contains PI, that is, about 3.14, as a fixed point integer on 32 bits.

View Source
const X32ConstPi2 vpnumber.X32 = 102944

X32ConstPi2 contains PI/2, that is, about 1.57, as a fixed point integer on 32 bits.

View Source
const X32ConstPi4 vpnumber.X32 = 51472

X32ConstPi4 contains PI/4, that is, about 0.78, as a fixed point integer on 32 bits.

View Source
const X64Const180 vpnumber.X64 = 180 * vpnumber.X64Const1

X64Const180 stores 180 degrees as a 64-bit fixed point number..

View Source
const X64Const2Pi vpnumber.X64 = 26986075409

X64Const2Pi contains 2*PI, that is, about 6.28, as a fixed point integer on 64 bits.

View Source
const X64Const360 vpnumber.X64 = 360 * vpnumber.X64Const1

X64Const360 stores 360 degrees as a 64-bit fixed point number..

View Source
const X64Const90 vpnumber.X64 = 90 * vpnumber.X64Const1

X64Const90 stores 90 degrees as a 64-bit fixed point number..

View Source
const X64ConstPi vpnumber.X64 = 13493037705

X64ConstPi contains PI, that is, about 3.14, as a fixed point integer on 64 bits.

View Source
const X64ConstPi2 vpnumber.X64 = 6746518852

X64ConstPi2 contains PI/2, that is, about 1.57, as a fixed point integer on 64 bits.

View Source
const X64ConstPi4 vpnumber.X64 = 3373259426

X64ConstPi4 contains PI/4, that is, about 0.78, as a fixed point integer on 64 bits.

Variables

This section is empty.

Functions

func Binomial

func Binomial(n, i int) int

Binomial calculates the binomial for (n,i). This is typically used as a coefficient for Bertein polynomials. https://en.wikipedia.org/wiki/Bernstein_polynomial

func F32Anglelerp

func F32Anglelerp(rad1, rad2, beta float32) float32

F32Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.

func F32DegMod

func F32DegMod(deg float32) float32

F32DegMod returns the angle modulo 2*Pi, and always as a positive value.

func F32DegToRad

func F32DegToRad(deg float32) float32

F32DegToRad converts an angle from degrees to radians.

func F32Derivative

func F32Derivative(f func(float32) float32, t, dt float32) float32

F32Derivative returns a numerical derivative value at a given point. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func F32DerivativeFunc

func F32DerivativeFunc(f func(float32) float32, dt float32) func(float32) float32

F32DerivativeFunc returns a numerical derivative function. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func F32Lerp

func F32Lerp(f1, f2, beta float32) float32

F32Lerp performs a linear interpolation between a and b.

func F32Lerp2

func F32Lerp2(p [2][2]float32, u, v float32) float32

F32Lerp2 performs a linear interpolation between 4 points.

func F32RadMod

func F32RadMod(rad float32) float32

F32RadMod returns the angle modulo 2*Pi, and always as a positive value.

func F32RadToDeg

func F32RadToDeg(rad float32) float32

F32RadToDeg converts an angle from radians to degrees.

func F32Unlerp

func F32Unlerp(f1, f2, f float32) float32

F32Unlerp performs the inverse of a linear interpolation between a and b.

func F64Anglelerp

func F64Anglelerp(rad1, rad2, beta float64) float64

F64Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.

func F64DegMod

func F64DegMod(deg float64) float64

F64DegMod returns the angle modulo 2*Pi, and always as a positive value.

func F64DegToRad

func F64DegToRad(deg float64) float64

F64DegToRad converts an angle from degrees to radians.

func F64Derivative

func F64Derivative(f func(float64) float64, t, dt float64) float64

F64Derivative returns a numerical derivative value at a given point. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func F64DerivativeFunc

func F64DerivativeFunc(f func(float64) float64, dt float64) func(float64) float64

F64DerivativeFunc returns a numerical derivative function. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func F64Lerp

func F64Lerp(f1, f2, beta float64) float64

F64Lerp performs a linear interpolation between a and b.

func F64Lerp2

func F64Lerp2(p [2][2]float64, u, v float64) float64

F64Lerp2 performs a linear interpolation between 4 points.

func F64RadMod

func F64RadMod(rad float64) float64

F64RadMod returns the angle modulo 2*Pi, and always as a positive value.

func F64RadToDeg

func F64RadToDeg(rad float64) float64

F64RadToDeg converts an angle from radians to degrees.

func F64Unlerp

func F64Unlerp(f1, f2, f float64) float64

F64Unlerp performs the inverse of a linear interpolation between a and b.

func Fact

func Fact(n int) int

Fact returns the factorial of an integer. Operates on standard default int, caches small values for speed.

func LookupJoin

func LookupJoin(sizes, indexes []int) int

LookupJoin builds an index from a list of sub indexes for a given lookup table. The idea is to consider the id is a sequence number within a N-dimension space.

func LookupSize

func LookupSize(indexes []int) int

LookupSize returns the size (maximum index + 1) for a given lookup table.

func LookupSplit

func LookupSplit(sizes []int, id int) []int

LookupSplit builds an array of integers containing indices for a given lookup table. The idea is to consider the id is a sequence number within a N-dimension space. It arranges the indices so that items with minor (last parameters) values that are closed together are closed together in memory.

func X32Anglelerp

func X32Anglelerp(rad1, rad2, beta vpnumber.X32) vpnumber.X32

X32Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.

func X32Atan

func X32Atan(x vpnumber.X32) vpnumber.X32

X32Atan is a lookup table based implementation of the arctangent function, working with fixed point numbers on 32 bits.

func X32Cos

func X32Cos(x vpnumber.X32) vpnumber.X32

X32Cos is a lookup table based implementation of the cosinus function, working with fixed point numbers on 32 bits.

func X32DegMod

func X32DegMod(deg vpnumber.X32) vpnumber.X32

X32DegMod returns the angle modulo 2*Pi, and always as a positive value.

func X32DegToRad

func X32DegToRad(deg vpnumber.X32) vpnumber.X32

X32DegToRad converts an angle from degrees to radians.

func X32Derivative

func X32Derivative(f func(vpnumber.X32) vpnumber.X32, t, dt vpnumber.X32) vpnumber.X32

X32Derivative returns a numerical derivative value at a given point. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func X32DerivativeFunc

func X32DerivativeFunc(f func(vpnumber.X32) vpnumber.X32, dt vpnumber.X32) func(vpnumber.X32) vpnumber.X32

X32DerivativeFunc returns a numerical derivative function. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func X32Lerp

func X32Lerp(x1, x2, beta vpnumber.X32) vpnumber.X32

X32Lerp performs a linear interpolation between a and b.

func X32Lerp2

func X32Lerp2(p [2][2]vpnumber.X32, u, v vpnumber.X32) vpnumber.X32

X32Lerp2 performs a linear interpolation between 4 points.

func X32RadMod

func X32RadMod(rad vpnumber.X32) vpnumber.X32

X32RadMod returns the angle modulo 2*Pi, and always as a positive value.

func X32RadToDeg

func X32RadToDeg(rad vpnumber.X32) vpnumber.X32

X32RadToDeg converts an angle from radians to degrees.

func X32Sin

func X32Sin(x vpnumber.X32) vpnumber.X32

X32Sin is a lookup table based implementation of the sinus function, working with fixed point numbers on 32 bits.

func X32Sqrt

func X32Sqrt(x vpnumber.X32) vpnumber.X32

X32Sqrt is a lookup table based implementation of the square root function, working with fixed point numbers on 32 bits.

func X32Tan

func X32Tan(x vpnumber.X32) vpnumber.X32

X32Tan is a lookup table based implementation of the tangent function, working with fixed point numbers on 32 bits.

func X32Unlerp

func X32Unlerp(x1, x2, x vpnumber.X32) vpnumber.X32

X32Unlerp performs the inverse of a linear interpolation between a and b.

func X64Anglelerp

func X64Anglelerp(rad1, rad2, beta vpnumber.X64) vpnumber.X64

X64Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.

func X64Atan

func X64Atan(x vpnumber.X64) vpnumber.X64

X64Atan is a lookup table based implementation of the arctangent function, working with fixed point numbers on 64 bits.

func X64Cos

func X64Cos(x vpnumber.X64) vpnumber.X64

X64Cos is a lookup table based implementation of the cosinus function, working with fixed point numbers on 64 bits.

func X64DegMod

func X64DegMod(deg vpnumber.X64) vpnumber.X64

X64DegMod returns the angle modulo 2*Pi, and always as a positive value.

func X64DegToRad

func X64DegToRad(deg vpnumber.X64) vpnumber.X64

X64DegToRad converts an angle from degrees to radians.

func X64Derivative

func X64Derivative(f func(vpnumber.X64) vpnumber.X64, t, dt vpnumber.X64) vpnumber.X64

X64Derivative returns a numerical derivative value at a given point. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func X64DerivativeFunc

func X64DerivativeFunc(f func(vpnumber.X64) vpnumber.X64, dt vpnumber.X64) func(vpnumber.X64) vpnumber.X64

X64DerivativeFunc returns a numerical derivative function. The dt arg is here to give the interval on which to test. Function will never fail unless the called function itself fails. But... it only returns an approximation.

func X64Lerp

func X64Lerp(x1, x2, beta vpnumber.X64) vpnumber.X64

X64Lerp performs a linear interpolation between a and b.

func X64Lerp2

func X64Lerp2(p [2][2]vpnumber.X64, u, v vpnumber.X64) vpnumber.X64

X64Lerp2 performs a linear interpolation between 4 points.

func X64RadMod

func X64RadMod(rad vpnumber.X64) vpnumber.X64

X64RadMod returns the angle modulo 2*Pi, and always as a positive value.

func X64RadToDeg

func X64RadToDeg(rad vpnumber.X64) vpnumber.X64

X64RadToDeg converts an angle from radians to degrees.

func X64Sin

func X64Sin(x vpnumber.X64) vpnumber.X64

X64Sin is a lookup table based implementation of the sinus function, working with fixed point numbers on 64 bits.

func X64Sqrt

func X64Sqrt(x vpnumber.X64) vpnumber.X64

X64Sqrt is a lookup table based implementation of the square root function, working with fixed point numbers on 64 bits.

func X64Tan

func X64Tan(x vpnumber.X64) vpnumber.X64

X64Tan is a lookup table based implementation of the tangent function, working with fixed point numbers on 64 bits.

func X64Unlerp

func X64Unlerp(x1, x2, x vpnumber.X64) vpnumber.X64

X64Unlerp performs the inverse of a linear interpolation between a and b.

Types

This section is empty.

Jump to

Keyboard shortcuts

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