Documentation
¶
Index ¶
- Constants
- func Abs32(value float32) float32
- func Atan32(value float32) float32
- func Cos32(angle float32) float32
- func Signum32(value float32) float32
- func Sin32(angle float32) float32
- func Sqrt32(value float32) float32
- func Vec2DotProduct(a, b Vec2) float32
- func Vec3DotProduct(a, b Vec3) float32
- type Mat4x4
- func IdentityMat4x4() Mat4x4
- func MakeMat4x4RowOrder(...) Mat4x4
- func Mat4x4MulMany(matrices ...Mat4x4) Mat4x4
- func NullMat4x4() Mat4x4
- func OrthoMat4x4(left, right, top, bottom, near, far float32) Mat4x4
- func PerspectiveMat4x4(left, right, bottom, top, near, far float32) Mat4x4
- func RotationMat4x4(angle, x, y, z float32) Mat4x4
- func ScaleMat4x4(x, y, z float32) Mat4x4
- func TranslationMat4x4(x, y, z float32) Mat4x4
- func VectorMat4x4(vecX, vecY, vecZ, position Vec3) Mat4x4
- func (m Mat4x4) DirectionX() Vec3
- func (m Mat4x4) DirectionY() Vec3
- func (m Mat4x4) DirectionZ() Vec3
- func (m Mat4x4) GoString() string
- func (m Mat4x4) Inverse() Mat4x4
- func (m Mat4x4) Mul(value float32) Mat4x4
- func (m Mat4x4) MulMat4x4(other Mat4x4) Mat4x4
- func (m Mat4x4) MulVec3(vec Vec3) Vec3
- func (m Mat4x4) MulVec4(vec Vec4) Vec4
- func (m Mat4x4) QuickInverse() Mat4x4
- func (m Mat4x4) Translation() Vec3
- type Vec2
- func (v Vec2) DecCoords(x, y float32) Vec2
- func (v Vec2) DecVec2(other Vec2) Vec2
- func (v Vec2) DistanceToCoords(x, y float32) float32
- func (v Vec2) DistanceToVec2(other Vec2) float32
- func (v Vec2) Div(amount float32) Vec2
- func (v Vec2) GoString() string
- func (v Vec2) IncCoords(x, y float32) Vec2
- func (v Vec2) IncVec2(other Vec2) Vec2
- func (v Vec2) Inverse() Vec2
- func (v Vec2) Length() float32
- func (v Vec2) LengthSquared() float32
- func (v Vec2) Mul(amount float32) Vec2
- func (v Vec2) Null() bool
- func (v Vec2) Resize(desiredLength float32) Vec2
- type Vec3
- func (v Vec3) DecCoords(x, y, z float32) Vec3
- func (v Vec3) DecVec3(other Vec3) Vec3
- func (v Vec3) DistanceToCoords(x, y, z float32) float32
- func (v Vec3) DistanceToVec3(other Vec3) float32
- func (v Vec3) Div(amount float32) Vec3
- func (v Vec3) GoString() string
- func (v Vec3) IncCoords(x, y, z float32) Vec3
- func (v Vec3) IncVec3(other Vec3) Vec3
- func (v Vec3) Inverse() Vec3
- func (v Vec3) Length() float32
- func (v Vec3) LengthSquared() float32
- func (v Vec3) Mul(amount float32) Vec3
- func (v Vec3) Null() bool
- func (v Vec3) Resize(desiredLength float32) Vec3
- type Vec4
Constants ¶
const Pi = float32(gomath.Pi)
Variables ¶
This section is empty.
Functions ¶
func Vec2DotProduct ¶
func Vec3DotProduct ¶
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 Mat4x4MulMany ¶
func NullMat4x4 ¶
func NullMat4x4() Mat4x4
func OrthoMat4x4 ¶
func PerspectiveMat4x4 ¶
func RotationMat4x4 ¶
func ScaleMat4x4 ¶
func TranslationMat4x4 ¶
func VectorMat4x4 ¶
func (Mat4x4) DirectionX ¶
func (Mat4x4) DirectionY ¶
func (Mat4x4) DirectionZ ¶
func (Mat4x4) GoString ¶
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 ¶
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) QuickInverse ¶
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.