import "golang.org/x/mobile/exp/f32"
Package f32 implements some linear algebra and GL helpers for float32s.
Types defined in this package have methods implementing common mathematical operations. The common form for these functions is
func (dst *T) Op(lhs, rhs *T)
which reads in traditional mathematical notation as
dst = lhs op rhs.
It is safe to use the destination address as the left-hand side, that is, dst *= rhs is dst.Mul(dst, rhs).
The interface to this package is not stable. It will change considerably. Only use functions that provide package documentation. Semantics are non-obvious. Be prepared for the package name to change.
affine.go f32.go mat3.go mat4.go table.go vec3.go vec4.go
Bytes returns the byte representation of float32 values in the given byte order. byteOrder must be either binary.BigEndian or binary.LittleEndian.
An Affine is a 3x3 matrix of float32 values for which the bottom row is implicitly always equal to [0 0 1]. Elements are indexed first by row then column, i.e. m[row][column].
Eq reports whether each component of m is within epsilon of the same component in n.
Identity sets m to be the identity transform.
Inverse sets m to be the inverse of p.
Mul sets m to be p × q.
Rotate sets m to a rotation in radians followed by p. It is equivalent to m.Mul(p, affineRotation).
Scale sets m to be a scale followed by p. It is equivalent to m.Mul(p, &Affine{{x,0,0}, {0,y,0}}).
Translate sets m to be a translation followed by p. It is equivalent to m.Mul(p, &Affine{{1,0,x}, {0,1,y}}).
A Mat3 is a 3x3 matrix of float32 values. Elements are indexed first by row then column, i.e. m[row][column].
Mul stores a × b in m.
A Mat4 is a 4x4 matrix of float32 values. Elements are indexed first by row then column, i.e. m[row][column].
Mul stores a × b in m.
Perspective sets m to be the GL perspective matrix.
Rotate sets m to a rotation in radians around a specified axis, followed by p. It is equivalent to m.Mul(p, affineRotation).
Scale sets m to be a scale followed by p. It is equivalent to
m.Mul(p, &Mat4{ {x, 0, 0, 0}, {0, y, 0, 0}, {0, 0, z, 0}, {0, 0, 0, 1}, }).
Translate sets m to be a translation followed by p. It is equivalent to
m.Mul(p, &Mat4{ {1, 0, 0, x}, {0, 1, 0, y}, {0, 0, 1, z}, {0, 0, 0, 1}, }).
Package f32 imports 3 packages (graph) and is imported by 25 packages. Updated 6 days ago. Refresh now. Tools for package owners.