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
- func Binomial(n, i int) int
- func F32Anglelerp(rad1, rad2, beta float32) float32
- func F32DegMod(deg float32) float32
- func F32DegToRad(deg float32) float32
- func F32Derivative(f func(float32) float32, t, dt float32) float32
- func F32DerivativeFunc(f func(float32) float32, dt float32) func(float32) float32
- func F32Lerp(f1, f2, beta float32) float32
- func F32Lerp2(p [2][2]float32, u, v float32) float32
- func F32RadMod(rad float32) float32
- func F32RadToDeg(rad float32) float32
- func F32Unlerp(f1, f2, f float32) float32
- func F64Anglelerp(rad1, rad2, beta float64) float64
- func F64DegMod(deg float64) float64
- func F64DegToRad(deg float64) float64
- func F64Derivative(f func(float64) float64, t, dt float64) float64
- func F64DerivativeFunc(f func(float64) float64, dt float64) func(float64) float64
- func F64Lerp(f1, f2, beta float64) float64
- func F64Lerp2(p [2][2]float64, u, v float64) float64
- func F64RadMod(rad float64) float64
- func F64RadToDeg(rad float64) float64
- func F64Unlerp(f1, f2, f float64) float64
- func Fact(n int) int
- func LookupJoin(sizes, indexes []int) int
- func LookupSize(indexes []int) int
- func LookupSplit(sizes []int, id int) []int
- func X32Anglelerp(rad1, rad2, beta vpnumber.X32) vpnumber.X32
- func X32Atan(x vpnumber.X32) vpnumber.X32
- func X32Cos(x vpnumber.X32) vpnumber.X32
- func X32DegMod(deg vpnumber.X32) vpnumber.X32
- func X32DegToRad(deg vpnumber.X32) vpnumber.X32
- func X32Derivative(f func(vpnumber.X32) vpnumber.X32, t, dt vpnumber.X32) vpnumber.X32
- func X32DerivativeFunc(f func(vpnumber.X32) vpnumber.X32, dt vpnumber.X32) func(vpnumber.X32) vpnumber.X32
- func X32Lerp(x1, x2, beta vpnumber.X32) vpnumber.X32
- func X32Lerp2(p [2][2]vpnumber.X32, u, v vpnumber.X32) vpnumber.X32
- func X32RadMod(rad vpnumber.X32) vpnumber.X32
- func X32RadToDeg(rad vpnumber.X32) vpnumber.X32
- func X32Sin(x vpnumber.X32) vpnumber.X32
- func X32Sqrt(x vpnumber.X32) vpnumber.X32
- func X32Tan(x vpnumber.X32) vpnumber.X32
- func X32Unlerp(x1, x2, x vpnumber.X32) vpnumber.X32
- func X64Anglelerp(rad1, rad2, beta vpnumber.X64) vpnumber.X64
- func X64Atan(x vpnumber.X64) vpnumber.X64
- func X64Cos(x vpnumber.X64) vpnumber.X64
- func X64DegMod(deg vpnumber.X64) vpnumber.X64
- func X64DegToRad(deg vpnumber.X64) vpnumber.X64
- func X64Derivative(f func(vpnumber.X64) vpnumber.X64, t, dt vpnumber.X64) vpnumber.X64
- func X64DerivativeFunc(f func(vpnumber.X64) vpnumber.X64, dt vpnumber.X64) func(vpnumber.X64) vpnumber.X64
- func X64Lerp(x1, x2, beta vpnumber.X64) vpnumber.X64
- func X64Lerp2(p [2][2]vpnumber.X64, u, v vpnumber.X64) vpnumber.X64
- func X64RadMod(rad vpnumber.X64) vpnumber.X64
- func X64RadToDeg(rad vpnumber.X64) vpnumber.X64
- func X64Sin(x vpnumber.X64) vpnumber.X64
- func X64Sqrt(x vpnumber.X64) vpnumber.X64
- func X64Tan(x vpnumber.X64) vpnumber.X64
- func X64Unlerp(x1, x2, x vpnumber.X64) vpnumber.X64
Constants ¶
const F32Const180 float32 = 180.0
F32Const180 stores 180 degrees as a float32.
const F32Const360 float32 = 360.0
F32Const360 stores 360 degrees as a float32.
const F32Const90 float32 = 90.0
F32Const90 stores 90 degrees as a float32.
const F64Const180 float64 = 180.0
F64Const180 stores 180 degrees as a float64.
const F64Const360 float64 = 360.0
F64Const360 stores 360 degrees as a float64.
const F64Const90 float64 = 90.0
F64Const90 stores 90 degrees as a float64.
const PackageCopyright = "Copyright (C) 2015, 2016 Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh
PackageCopyright contains a short copyright notice.
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh
PackageEmail contains a contact email for the package.
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh
PackageLicense contains a short license information.
const PackageName = "Vapor Toolkit" // PackageName set by version.sh
PackageName contains a readable name of the package, suitable for display.
const PackageTarname = "vapor" // PackageTarname set by version.sh
PackageTarname contains a short name of the package, suitable for a filename.
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh
PackageURL contains the address of the project homepage.
const VersionMajor = 0 // VersionMajor set by version.sh
VersionMajor is the project major version.
const VersionMinor = 3 // VersionMinor set by version.sh
VersionMinor is the project minor version.
const VersionStamp = "c6a4298" // VersionStamp set by version.sh
VersionStamp is the project stamp, possibly changes for each build.
const X32Const180 vpnumber.X32 = 180 * vpnumber.X32Const1
X32Const180 stores 180 degrees as a 32-bit fixed point number..
const X32Const2Pi vpnumber.X32 = 411775
X32Const2Pi contains 2*PI, that is, about 6.28, as a fixed point integer on 32 bits.
const X32Const360 vpnumber.X32 = 360 * vpnumber.X32Const1
X32Const360 stores 360 degrees as a 32-bit fixed point number..
const X32Const90 vpnumber.X32 = 90 * vpnumber.X32Const1
X32Const90 stores 90 degrees as a 32-bit fixed point number..
const X32ConstPi vpnumber.X32 = 205887
X32ConstPi contains PI, that is, about 3.14, as a fixed point integer on 32 bits.
const X32ConstPi2 vpnumber.X32 = 102944
X32ConstPi2 contains PI/2, that is, about 1.57, as a fixed point integer on 32 bits.
const X32ConstPi4 vpnumber.X32 = 51472
X32ConstPi4 contains PI/4, that is, about 0.78, as a fixed point integer on 32 bits.
const X64Const180 vpnumber.X64 = 180 * vpnumber.X64Const1
X64Const180 stores 180 degrees as a 64-bit fixed point number..
const X64Const2Pi vpnumber.X64 = 26986075409
X64Const2Pi contains 2*PI, that is, about 6.28, as a fixed point integer on 64 bits.
const X64Const360 vpnumber.X64 = 360 * vpnumber.X64Const1
X64Const360 stores 360 degrees as a 64-bit fixed point number..
const X64Const90 vpnumber.X64 = 90 * vpnumber.X64Const1
X64Const90 stores 90 degrees as a 64-bit fixed point number..
const X64ConstPi vpnumber.X64 = 13493037705
X64ConstPi contains PI, that is, about 3.14, as a fixed point integer on 64 bits.
const X64ConstPi2 vpnumber.X64 = 6746518852
X64ConstPi2 contains PI/2, that is, about 1.57, as a fixed point integer on 64 bits.
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 ¶
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 ¶
F32Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.
func F32DegToRad ¶
F32DegToRad converts an angle from degrees to radians.
func F32Derivative ¶
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 ¶
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 F32RadToDeg ¶
F32RadToDeg converts an angle from radians to degrees.
func F64Anglelerp ¶
F64Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.
func F64DegToRad ¶
F64DegToRad converts an angle from degrees to radians.
func F64Derivative ¶
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 ¶
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 F64RadToDeg ¶
F64RadToDeg converts an angle from radians to degrees.
func Fact ¶
Fact returns the factorial of an integer. Operates on standard default int, caches small values for speed.
func LookupJoin ¶
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 ¶
LookupSize returns the size (maximum index + 1) for a given lookup table.
func LookupSplit ¶
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 ¶
X32Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.
func X32Atan ¶
X32Atan is a lookup table based implementation of the arctangent function, working with fixed point numbers on 32 bits.
func X32Cos ¶
X32Cos is a lookup table based implementation of the cosinus function, working with fixed point numbers on 32 bits.
func X32DegToRad ¶
X32DegToRad converts an angle from degrees to radians.
func X32Derivative ¶
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 X32RadToDeg ¶
X32RadToDeg converts an angle from radians to degrees.
func X32Sin ¶
X32Sin is a lookup table based implementation of the sinus function, working with fixed point numbers on 32 bits.
func X32Sqrt ¶
X32Sqrt is a lookup table based implementation of the square root function, working with fixed point numbers on 32 bits.
func X32Tan ¶
X32Tan is a lookup table based implementation of the tangent function, working with fixed point numbers on 32 bits.
func X64Anglelerp ¶
X64Anglelerp performs a linear interpolation between two angles. Angles need a special lerp as they wrap arround.
func X64Atan ¶
X64Atan is a lookup table based implementation of the arctangent function, working with fixed point numbers on 64 bits.
func X64Cos ¶
X64Cos is a lookup table based implementation of the cosinus function, working with fixed point numbers on 64 bits.
func X64DegToRad ¶
X64DegToRad converts an angle from degrees to radians.
func X64Derivative ¶
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 X64RadToDeg ¶
X64RadToDeg converts an angle from radians to degrees.
func X64Sin ¶
X64Sin is a lookup table based implementation of the sinus function, working with fixed point numbers on 64 bits.
func X64Sqrt ¶
X64Sqrt is a lookup table based implementation of the square root function, working with fixed point numbers on 64 bits.
Types ¶
This section is empty.