package
1.2.0
Repository: https://github.com/go-gl/mathgl.git
Documentation: pkg.go.dev

# Packages

# Functions

Abs is a direct copy of the math package's Abs.
AnglesToQuat performs a rotation in the specified order.
BezierCurve2D returns the point at point t along an n-control point Bezier curve t must be in the range 0.0 and 1.0 or this function will panic.
BezierCurve3D same as the 2D version, except the line is in 3D space.
BezierSplineInterpolate2D does interpolation over a spline of several bezier curves.
BezierSplineInterpolate3D does interpolation over a spline of several bezier curves.
BezierSurface creates a 2-dimensional Bezier surface of arbitrary degree in 3D Space Like the curve functions, if u or v are not in the range [0.0,1.0] the function will panic, use Clamp[f|d] to ensure it is correct.
CartesianToCylindical converts 3-dimensional cartesian coordinates (x,y,z) to cylindrical coordinates with radial distance r, azimuth phi, and height z.
CartesianToSpherical converts 3-dimensional cartesian coordinates (x,y,z) to spherical coordinates with radius r, inclination theta, and azimuth phi.
Circle generates a circle centered at (0,0) with a given radius.
Clamp takes in a value and two thresholds.
ClampFunc generates a closure that returns its parameter clamped to the range [low,high].
CopyMatMN copies src into dst.
CubicBezierCurve2D interpolates the point t on the given bezier curve.
CubicBezierCurve3D interpolates the point t on the given bezier curve.
CylindircalToSpherical converts cylindrical coordinates with radial distance r, azimuth phi, and height z to spherical coordinates with radius r, inclination theta, and azimuth phi.
CylindricalToCartesian converts cylindrical coordinates with radial distance r, azimuth phi, and height z to cartesian coordinates (x,y,z) Angles are in radians.
DegToRad converts degrees to radians.
Diag2 creates a diagonal matrix from the entries of the input vector.
Diag3 creates a diagonal matrix from the entries of the input vector.
Diag4 creates a diagonal matrix from the entries of the input vector.
DiagN creates an NxN diagonal matrix seeded by the diagonal vector diag.
Extract3DScale extracts the 3d scaling from a homogeneous matrix.
ExtractMaxScale extracts the maximum scaling from a homogeneous matrix.
FloatEqual is a safe utility function to compare floats.
FloatEqualFunc is a utility closure that will generate a function that always approximately compares floats like FloatEqualThreshold with a different threshold.
FloatEqualThreshold is a utility function to compare floats.
Frustum generates a Frustum Matrix.
GLToScreenCoords transforms from GL's proportional system to pixel coordinates.
HomogRotate2D is the same as Rotate2D, except homogeneous (3x3 with the extra row/col being all zeroes with a one in the bottom right).
HomogRotate3D creates a 3D rotation Matrix that rotates by (radian) angle about some arbitrary axis given by a normalized Vector.
HomogRotate3DX is the same as Rotate3DX, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right).
HomogRotate3DY is the same as Rotate3DY, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right).
HomogRotate3DZ is the same as Rotate3DZ, except homogeneous (4x4 with the extra row/col being all zeroes with a one in the bottom right).
Ident2 returns the 2x2 identity matrix.
Ident3 returns the 3x3 identity matrix.
Ident4 returns the 4x4 identity matrix.
IdentN stores the NxN identity matrix in dst, reallocating as necessary.
IsClamped checks if a is clamped between low and high as if Clamp(a, low, high) had been called.
LookAt generates a transform matrix from world space to the given eye space.
LookAtV generates a transform matrix from world space into the specific eye space.
MakeBezierCurve2D generates a bezier curve with controlPoints cPoints.
MakeBezierCurve3D same as the 2D version, except with the line in 3D space.
Mat2FromCols builds a new matrix from column vectors.
Mat2x3FromCols builds a new matrix from column vectors.
Mat2x4FromCols builds a new matrix from column vectors.
Mat3FromCols builds a new matrix from column vectors.
Mat3x2FromCols builds a new matrix from column vectors.
Mat3x4FromCols builds a new matrix from column vectors.
Mat4FromCols builds a new matrix from column vectors.
Mat4Normal calculates the Normal of the Matrix (aka the inverse transpose).
Mat4ToQuat converts a pure rotation matrix into a quaternion.
Mat4x2FromCols builds a new matrix from column vectors.
Mat4x3FromCols builds a new matrix from column vectors.
NewMatrix creates a matrix backed by a new slice of size m*n.
NewMatrixFromData returns a matrix with data specified by the data in src For instance, to create a 3x3 MatMN from a Mat3 m1 := mgl32.Rotate3DX(3.14159) mat := mgl32.NewBackedMatrix(m1[:],3,3) will create an MN matrix matching the data in the original rotation matrix.
NewVecN creates a new vector with a backing slice of 2^p where p = Ceil(log_2(n)).
NewVecNFromData creates a new vector with a backing slice filled with the contents of initial.
Ortho generates an Ortho Matrix.
Ortho2D is equivalent to Ortho with the near and far planes being -1 and 1, respectively.
Perspective generates a Perspective Matrix.
Project transforms a set of coordinates from object space (in obj) to window coordinates (with depth).
QuadraticBezierCurve2D interpolates the point t on the given bezier curve.
QuadraticBezierCurve3D interpolates the point t on the given bezier curve.
QuatBetweenVectors calculates the rotation between two vectors.
QuatIdent returns the quaternion identity: W=1; V=(0,0,0).
QuatLerp is a *L*inear Int*erp*olation between two Quaternions, cheap and simple.
QuatLookAtV creates a rotation from an eye vector to a center vector It assumes the front of the rotated object at Z- and up at Y+.
QuatNlerp is a *Normalized* *L*inear Int*erp*olation between two Quaternions.
QuatRotate creates an angle from an axis and an angle relative to that axis.
QuatSlerp is *S*pherical *L*inear Int*erp*olation, a method of interpolating between two quaternions.
RadToDeg converts radians to degrees.
Rect generates a 2-triangle rectangle for use with GL_TRIANGLES.
ReticulateSplines reticulates ALL the Splines.
Rotate2D returns a rotation Matrix about a angle in 2-D space.
Rotate3DX returns a 3x3 (non-homogeneous) Matrix that rotates by angle about the X-axis Where c is cos(angle) and s is sin(angle) [1 0 0] [0 c -s] [0 s c ].
Rotate3DY returns a 3x3 (non-homogeneous) Matrix that rotates by angle about the Y-axis Where c is cos(angle) and s is sin(angle) [c 0 s] [0 1 0] [s 0 c ].
Rotate3DZ returns a 3x3 (non-homogeneous) Matrix that rotates by angle about the Z-axis Where c is cos(angle) and s is sin(angle) [c -s 0] [s c 0] [0 0 1 ].
Round shortens a float32 value to a specified precision (number of digits after the decimal point) with "round half up" tie-braking rule.
Scale2D creates a homogeneous 2D scaling matrix [[ scaleX, 0 , 0 ]] [[ 0 , scaleY, 0 ]] [[ 0 , 0 , 1 ]].
Scale3D creates a homogeneous 3D scaling matrix [[ scaleX, 0 , 0 , 0 ]] [[ 0 , scaleY, 0 , 0 ]] [[ 0 , 0 , scaleZ, 0 ]] [[ 0 , 0 , 0 , 1 ]].
ScreenToGLCoords transforms from pixel coordinates to GL coordinates.
SetMax sets a to b if a < b.
SetMin sets a to b if a > b.
ShearX2D creates a homogeneous 2D shear matrix along the X-axis.
ShearX3D creates a homogeneous 3D shear matrix along the X-axis.
ShearY2D creates a homogeneous 2D shear matrix along the Y-axis.
ShearY3D creates a homogeneous 3D shear matrix along the Y-axis.
ShearZ3D creates a homogeneous 3D shear matrix along the Z-axis.
SphericalToCartesian converts spherical coordinates with radius r, inclination theta, and azimuth phi to cartesian coordinates (x,y,z).
SphericalToCylindrical converts spherical coordinates with radius r, inclination theta, and azimuth phi to cylindrical coordinates with radial distance r, azimuth phi, and height z.
TransformCoordinate multiplies a 3D vector by a transformation given by the homogeneous 4D matrix m, applying any translation.
TransformNormal multiplies a 3D vector by a transformation given by the homogeneous 4D matrix m, NOT applying any translations.
Translate2D returns a homogeneous (3x3 for 2D-space) Translation matrix that moves a point by Tx units in the x-direction and Ty units in the y-direction [[1, 0, Tx]] [[0, 1, Ty]] [[0, 0, 1 ]].
Translate3D returns a homogeneous (4x4 for 3D-space) Translation matrix that moves a point by Tx units in the x-direction, Ty units in the y-direction, and Tz units in the z-direction [[1, 0, 0, Tx]] [[0, 1, 0, Ty]] [[0, 0, 1, Tz]] [[0, 0, 0, 1 ]].
UnProject transforms a set of window coordinates to object space.

# Constants

The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.
The RotationOrder constants represent a series of rotations along the given axes for the use of AnglesToQuat.

# Variables

Epsilon is some tiny value that determines how precisely equal we want our floats to be This is exported and left as a variable in case you want to change the default threshold for the purposes of certain methods (e.g.
Various useful constants.
Various useful constants.
Various useful constants.
1 / 2**(127 - 1).
Various useful constants.
Various useful constants.

# Structs

InferMatrixError may be returned by InferMatrix.
MatMxN is an arbitrary mxn matrix backed by a slice of floats.
NilMatrixError is returned when an operand to a function was unexpectedly 'nil'.
Quat represents a Quaternion, which is an extension of the imaginary numbers; there's all sorts of interesting theory behind it.
RectangularMatrixError is returned when a rectangular matrix was expected but not given.
VecN represents a vector of N elements backed by a slice.

# Type aliases

RotationOrder is the order in which rotations will be transformed for the purposes of AnglesToQuat.