math

package
v0.0.0-...-4db4b9c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

Variables

This section is empty.

Functions

func Abs32

func Abs32(value float32) float32

func Atan32

func Atan32(value float32) float32

func Cos32

func Cos32(angle float32) float32

func Signum32

func Signum32(value float32) float32

func Sin32

func Sin32(angle float32) float32

func Sqrt32

func Sqrt32(value float32) float32

func Vec2DotProduct

func Vec2DotProduct(a, b Vec2) float32

func Vec3DotProduct

func Vec3DotProduct(a, b Vec3) float32

Types

type Mat4x4

type Mat4x4 struct {
	M11, M12, M13, M14 float32
	M21, M22, M23, M24 float32
	M31, M32, M33, M34 float32
	M41, M42, M43, M44 float32
}

func IdentityMat4x4

func IdentityMat4x4() Mat4x4

func MakeMat4x4RowOrder

func MakeMat4x4RowOrder(
	m11, m12, m13, m14,
	m21, m22, m23, m24,
	m31, m32, m33, m34,
	m41, m42, m43, m44 float32) Mat4x4

func Mat4x4MulMany

func Mat4x4MulMany(matrices ...Mat4x4) Mat4x4

func NullMat4x4

func NullMat4x4() Mat4x4

func OrthoMat4x4

func OrthoMat4x4(left, right, top, bottom, near, far float32) Mat4x4

func PerspectiveMat4x4

func PerspectiveMat4x4(left, right, bottom, top, near, far float32) Mat4x4

func RotationMat4x4

func RotationMat4x4(angle, x, y, z float32) Mat4x4

func ScaleMat4x4

func ScaleMat4x4(x, y, z float32) Mat4x4

func TranslationMat4x4

func TranslationMat4x4(x, y, z float32) Mat4x4

func VectorMat4x4

func VectorMat4x4(vecX, vecY, vecZ, position Vec3) Mat4x4

func (Mat4x4) DirectionX

func (m Mat4x4) DirectionX() Vec3

func (Mat4x4) DirectionY

func (m Mat4x4) DirectionY() Vec3

func (Mat4x4) DirectionZ

func (m Mat4x4) DirectionZ() Vec3

func (Mat4x4) GoString

func (m Mat4x4) GoString() string

GoString returns a string representation of this matrix allowing values of Mat4x4 type to be nicely fmt printed with the %#v flag. Note that the matrix is printed in column-major order as a sequence of 4D vectors.

func (Mat4x4) Inverse

func (m Mat4x4) Inverse() Mat4x4

Inverse calculates the inverse of the matrix.

The behavior is undefined if the matrix is not reversible (i.e. has a zero determinant).

func (Mat4x4) Mul

func (m Mat4x4) Mul(value float32) Mat4x4

func (Mat4x4) MulMat4x4

func (m Mat4x4) MulMat4x4(other Mat4x4) Mat4x4

func (Mat4x4) MulVec3

func (m Mat4x4) MulVec3(vec Vec3) Vec3

func (Mat4x4) MulVec4

func (m Mat4x4) MulVec4(vec Vec4) Vec4

func (Mat4x4) QuickInverse

func (m Mat4x4) QuickInverse() Mat4x4

QuickInverse calculates the inverse of the matrix with a few caveats.

The matrix should be a transformation one that was constructed through the multiplication of one or more of the following transformations: identity, translation, rotation.

For all other scenarios (e.g. a scale transformation was used), the Inverse method should be used instead. However, the Inverse method can be more costly, as it involves more float32 multiplications than the QuickInverse approach.

func (Mat4x4) Translation

func (m Mat4x4) Translation() Vec3

type Vec2

type Vec2 struct {
	X float32
	Y float32
}

func BaseVec2X

func BaseVec2X() Vec2

func BaseVec2Y

func BaseVec2Y() Vec2

func MakeVec2

func MakeVec2(x, y float32) Vec2

func NullVec2

func NullVec2() Vec2

func (Vec2) DecCoords

func (v Vec2) DecCoords(x, y float32) Vec2

func (Vec2) DecVec2

func (v Vec2) DecVec2(other Vec2) Vec2

func (Vec2) DistanceToCoords

func (v Vec2) DistanceToCoords(x, y float32) float32

func (Vec2) DistanceToVec2

func (v Vec2) DistanceToVec2(other Vec2) float32

func (Vec2) Div

func (v Vec2) Div(amount float32) Vec2

func (Vec2) GoString

func (v Vec2) GoString() string

func (Vec2) IncCoords

func (v Vec2) IncCoords(x, y float32) Vec2

func (Vec2) IncVec2

func (v Vec2) IncVec2(other Vec2) Vec2

func (Vec2) Inverse

func (v Vec2) Inverse() Vec2

func (Vec2) Length

func (v Vec2) Length() float32

func (Vec2) LengthSquared

func (v Vec2) LengthSquared() float32

func (Vec2) Mul

func (v Vec2) Mul(amount float32) Vec2

func (Vec2) Null

func (v Vec2) Null() bool

func (Vec2) Resize

func (v Vec2) Resize(desiredLength float32) Vec2

type Vec3

type Vec3 struct {
	X float32
	Y float32
	Z float32
}

func BaseVec3X

func BaseVec3X() Vec3

func BaseVec3Y

func BaseVec3Y() Vec3

func BaseVec3Z

func BaseVec3Z() Vec3

func MakeVec3

func MakeVec3(x, y, z float32) Vec3

func NullVec3

func NullVec3() Vec3

func Vec3CrossProduct

func Vec3CrossProduct(a, b Vec3) Vec3

func (Vec3) DecCoords

func (v Vec3) DecCoords(x, y, z float32) Vec3

func (Vec3) DecVec3

func (v Vec3) DecVec3(other Vec3) Vec3

func (Vec3) DistanceToCoords

func (v Vec3) DistanceToCoords(x, y, z float32) float32

func (Vec3) DistanceToVec3

func (v Vec3) DistanceToVec3(other Vec3) float32

func (Vec3) Div

func (v Vec3) Div(amount float32) Vec3

func (Vec3) GoString

func (v Vec3) GoString() string

func (Vec3) IncCoords

func (v Vec3) IncCoords(x, y, z float32) Vec3

func (Vec3) IncVec3

func (v Vec3) IncVec3(other Vec3) Vec3

func (Vec3) Inverse

func (v Vec3) Inverse() Vec3

func (Vec3) Length

func (v Vec3) Length() float32

func (Vec3) LengthSquared

func (v Vec3) LengthSquared() float32

func (Vec3) Mul

func (v Vec3) Mul(amount float32) Vec3

func (Vec3) Null

func (v Vec3) Null() bool

func (Vec3) Resize

func (v Vec3) Resize(desiredLength float32) Vec3

type Vec4

type Vec4 struct {
	X float32
	Y float32
	Z float32
	W float32
}

func MakeVec4

func MakeVec4(x, y, z, w float32) Vec4

func NullVec4

func NullVec4() Vec4

func (Vec4) Div

func (v Vec4) Div(amount float32) Vec4

func (Vec4) GoString

func (v Vec4) GoString() string

func (Vec4) Mul

func (v Vec4) Mul(amount float32) Vec4

func (Vec4) Null

func (v Vec4) Null() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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