package
0.0.0-20241019203012-a2ad2ed164c2
Repository: https://github.com/soypat/glgl.git
Documentation: pkg.go.dev
# Functions
AbsElem returns the vector with components set to their absolute value.
Add returns the vector sum of p and q.
AddMat3 adds two 3x3 matrices together.
AddScalar adds f to all of v's components and returns the result.
AnglesToQuat performs a rotation in the specified order.
AppendGrid splits the argument bounds [Box] x,y,z axes by nx,ny,nz, respectively and generates points on the vertices generated by the division and appends them to dst, returning the result.
CeilElem returns a with Ceil applied to each component.
Clamp returns v with its elements clamped to Min and Max's components.
Cos returns the cosine of the opening angle between p and q.
CosElem returns cos(a) component-wise.
Cross returns the cross product p×q.
DivElem returns the Hadamard product between vector a and the inverse components of vector b.
Divergence returns the divergence of the vector field at the point p, approximated using finite differences with the given step sizes.
Dot returns the dot product p·q.
EqualElem checks equality between vector elements to within a tolerance.
EqualMat3 tests the equality of 3x3 matrices.
EqualMat4 tests the equality of 4x4 matrices.
FloorElem returns a with Floor applied to each component.
Gradient returns the gradient of the scalar field at the point p, approximated using finite differences with the given step sizes.
IdentityMat3 returns the 3x3 identity matrix.
IdentityMat4 returns the identity 4x4 matrix.
InterpElem performs a linear interpolation between x and y's elements, mapping with a's values in interval [0,1].
MaxElem return a vector with the maximum components of two vectors.
MinElem return a vector with the minimum components of two vectors.
MulElem returns the Hadamard product between vectors a and b.
MulMat3 multiplies two 3x3 matrices.
MulMat4 multiplies two 4x4 matrices and returns the result.
MulMatVec performs matrix multiplication on v:
result = M * v.
MulMatVecTrans Performs transposed matrix multiplication on v:
result = Mᵀ * v.
NewBox is shorthand for Box{Min:Vec{x0,y0,z0}, Max:Vec{x1,y1,z1}}.
NewCenteredBox returns a box centered around center with size dimensions.
NewMat3 instantiates a new matrix from the first 9 floats, row major order.
NewMat4 instantiates a new 4x4 Mat4 matrix from the first 16 values in row major order.
Norm returns the Euclidean norm of p
|p| = sqrt(p_x^2 + p_y^2 + p_z^2).
Norm2 returns the Euclidean squared norm of p
|p|^2 = p_x^2 + p_y^2 + p_z^2.
Prod performs vector multiplication as if they were matrices
m = v1 * v2ᵀ.
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.
QuatLookAt creates a rotation from an eye point to a center point.
QuatNlerp is a *Normalized* *L*inear Int*erp*olation between two Quaternions.
QuatSlerp is Spherical Linear intERPolation, a method of interpolating between two quaternions.
RotationBetweenVecsMat4 returns the rotation matrix that transforms "start" onto the same direction as "dest".
RotationBetweenVecsQuat calculates the rotation between start and dest.
RotationMat3 returns a 3×3 rotation matrix corresponding to the receiver.
RotationMat4 returns an orthographic 4x4 rotation matrix (right hand rule).
RotationQuat creates a rotation quaternion that rotates an angle relative an axis.
Round rounds the individual elements of a vector.
Scale returns the vector p scaled by f.
ScaleMat3 multiplies each 3x3 matrix component by a scalar.
ScaleMat4 returns a 4x4 scaling matrix.
Sign returns sign function applied to each individual component of a.
SincosElem returns (sin(a), cos(a)).
SinElem returns sin(a) component-wise.
Skew returns the 3×3 skew symmetric matrix (right hand system) of v.
SmoothStepElem performs element-wise smooth cubic hermite interpolation between 0 and 1 when e0 < x < e1.
Sort performs the sort-3 algorithm and returns l1, l2, l3 such that l1 ≤ l2 ≤ l3.
Sub returns the vector sum of p and -q.
TranslateMat4 returns a 4x4 translation matrix.
Unit returns the unit vector colinear to p.
# 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.
# Type aliases
Line is an infinite 3D line defined by two points on the line.
RotationOrder is the order in which rotations will be transformed for the purposes of AnglesToQuat.
Triangle represents a triangle in 3D space and is composed by 3 vectors corresponding to the position of each of the vertices.