Documentation ¶
Index ¶
- type FloatingPoint
- type Mat2Row
- type Mat2x2
- func (m *Mat2x2[T]) Equal(other *Mat2x2[T], epsilon T) bool
- func (m *Mat2x2[T]) IsNormalized(epsilon T) bool
- func (m *Mat2x2[T]) IsNull(epsilon T) bool
- func (m *Mat2x2[T]) MultMat2x2(other *Mat2x2[T])
- func (m *Mat2x2[T]) SetColMajor(c1, c2 *Vec2[T])
- func (m *Mat2x2[T]) SetDiagonalScalar(s T)
- func (m *Mat2x2[T]) SetDiagonalVector(v *Vec2[T])
- func (m *Mat2x2[T]) SetIdentity()
- func (m *Mat2x2[T]) SetMat2x2(other *Mat2x2[T])
- func (m *Mat2x2[T]) SetMat3x3(other *Mat3x3[T])
- func (m *Mat2x2[T]) SetMat4x4(other *Mat4x4[T])
- func (m *Mat2x2[T]) SetMultMat2x2(lhs, rhs *Mat2x2[T])
- func (m *Mat2x2[T]) SetRowMajor(r1, r2 *Vec2[T])
- type Mat3Row
- type Mat3x3
- func (m *Mat3x3[T]) ApplyTransform(other *Mat3x3[T])
- func (m *Mat3x3[T]) Equal(other *Mat3x3[T], epsilon T) bool
- func (m *Mat3x3[T]) GetAxisAngle(outAxis *Vec3[T], outAngleRad *float64)
- func (m *Mat3x3[T]) Inverse()
- func (m *Mat3x3[T]) IsNormalized(epsilon T) bool
- func (m *Mat3x3[T]) IsNull(epsilon T) bool
- func (m *Mat3x3[T]) MultMat3x3(other *Mat3x3[T])
- func (m *Mat3x3[T]) Orthonormalize()
- func (m *Mat3x3[T]) Proj2D(normal *Vec3[T])
- func (m *Mat3x3[T]) RotateAroundAxis(axis *Vec3[T], angleRad float64)
- func (m *Mat3x3[T]) RotateX(angleRad float64)
- func (m *Mat3x3[T]) RotateY(angleRad float64)
- func (m *Mat3x3[T]) RotateZ(angleRad float64)
- func (m *Mat3x3[T]) Scale(x, y, z T)
- func (m *Mat3x3[T]) SetApplyTransform(lhs, rhs *Mat3x3[T])
- func (m *Mat3x3[T]) SetColMajor(c1, c2, c3 *Vec3[T])
- func (m *Mat3x3[T]) SetDiagonalScalar(s T)
- func (m *Mat3x3[T]) SetDiagonalVector(v *Vec3[T])
- func (m *Mat3x3[T]) SetIdentity()
- func (m *Mat3x3[T]) SetMat2x2(other *Mat3x3[T])
- func (m *Mat3x3[T]) SetMat3x3(other *Mat3x3[T])
- func (m *Mat3x3[T]) SetMat4x4(other *Mat4x4[T])
- func (m *Mat3x3[T]) SetMultMat3x3(lhs, rhs *Mat3x3[T])
- func (m *Mat3x3[T]) SetQuaternion(other *Quaternion[T])
- func (m *Mat3x3[T]) SetRotationAroundAxis(axis *Vec3[T], angleRad float64)
- func (m *Mat3x3[T]) SetRotationEulers(yawRad, pitchRad, rollRad float64)
- func (m *Mat3x3[T]) SetRotationX(pitchRad float64)
- func (m *Mat3x3[T]) SetRotationY(yawRad float64)
- func (m *Mat3x3[T]) SetRotationZ(rollRad float64)
- func (m *Mat3x3[T]) SetRowMajor(r1, r2, r3 *Vec3[T])
- func (m *Mat3x3[T]) SetScale(x, y, z T)
- func (m *Mat3x3[T]) SetShearX(y, z T)
- func (m *Mat3x3[T]) SetShearY(x, z T)
- func (m *Mat3x3[T]) SetShearZ(x, y T)
- func (m *Mat3x3[T]) ShearX(y, z T)
- func (m *Mat3x3[T]) ShearY(x, z T)
- func (m *Mat3x3[T]) ShearZ(x, y T)
- func (m *Mat3x3[T]) Transpose()
- type Mat4Row
- type Mat4x4
- func (m *Mat4x4[T]) ApplyTransform(transform *Mat4x4[T])
- func (m *Mat4x4[T]) Equal(other *Mat4x4[T], epsilon T) bool
- func (m *Mat4x4[T]) GetAxisAngle(outAxis *Vec3[T], outAngleRad *float64)
- func (m *Mat4x4[T]) InterpolateMat4x4(otherMatrix *Mat4x4[T], delta T)
- func (m *Mat4x4[T]) Inverse()
- func (m *Mat4x4[T]) IsNormalized(epsilon T) bool
- func (m *Mat4x4[T]) IsNull(epsilon T) bool
- func (m *Mat4x4[T]) MultMat4x4(other *Mat4x4[T])
- func (m *Mat4x4[T]) Proj3D(normal *Vec3[T])
- func (m *Mat4x4[T]) RotateAroundAxis(axis *Vec3[T], angleRad float64)
- func (m *Mat4x4[T]) RotateX(angleRad float64)
- func (m *Mat4x4[T]) RotateY(angleRad float64)
- func (m *Mat4x4[T]) RotateZ(angleRad float64)
- func (m *Mat4x4[T]) Scale(x, y, z T)
- func (m *Mat4x4[T]) SetAffineMat4x4(other *Mat4x4[T])
- func (m *Mat4x4[T]) SetApplyTransform(lhs, rhs *Mat4x4[T])
- func (m *Mat4x4[T]) SetColMajor(c1, c2, c3, c4 *Vec4[T])
- func (m *Mat4x4[T]) SetDiagonalScalar(s T)
- func (m *Mat4x4[T]) SetDiagonalVector(v *Vec4[T])
- func (m *Mat4x4[T]) SetFrustum(left, right, bottom, top, nearVal, farVal T)
- func (m *Mat4x4[T]) SetIdentity()
- func (m *Mat4x4[T]) SetInfinitePerspective(fovYRad float64, aspectRatio, zNear T)
- func (m *Mat4x4[T]) SetInterpolateMat4x4(lhs, rhs *Mat4x4[T], delta T)
- func (m *Mat4x4[T]) SetLookAt(eyePosition *Vec3[T], target *Vec3[T], up *Vec3[T])
- func (m *Mat4x4[T]) SetMat2x2(other *Mat2x2[T])
- func (m *Mat4x4[T]) SetMat3x3(other *Mat3x3[T])
- func (m *Mat4x4[T]) SetMat4x4(other *Mat4x4[T])
- func (m *Mat4x4[T]) SetMultMat4x4(lhs, rhs *Mat4x4[T])
- func (m *Mat4x4[T]) SetOrientation(origin *Vec3[T], target *Vec3[T])
- func (m *Mat4x4[T]) SetOrthographic(left, right, bottom, top, zNear, zFar T)
- func (m *Mat4x4[T]) SetOrthographic2D(left, right, bottom, top T)
- func (m *Mat4x4[T]) SetPerspective(fovYRad float64, aspectRatio, zNear, zFar T)
- func (m *Mat4x4[T]) SetQuaternion(other *Quaternion[T])
- func (m *Mat4x4[T]) SetRotationAroundAxis(axis *Vec3[T], angleRad float64)
- func (m *Mat4x4[T]) SetRotationEulers(yawRad, pitchRad, rollRad float64)
- func (m *Mat4x4[T]) SetRotationX(pitchRad float64)
- func (m *Mat4x4[T]) SetRotationY(yawRad float64)
- func (m *Mat4x4[T]) SetRotationZ(rollRad float64)
- func (m *Mat4x4[T]) SetRowMajor(r1, r2, r3, r4 *Vec4[T])
- func (m *Mat4x4[T]) SetScale(x, y, z T)
- func (m *Mat4x4[T]) SetShearX(y, z T)
- func (m *Mat4x4[T]) SetShearY(x, z T)
- func (m *Mat4x4[T]) SetShearZ(x, y T)
- func (m *Mat4x4[T]) SetTranslation(x, y, z T)
- func (m *Mat4x4[T]) ShearX(y, z T)
- func (m *Mat4x4[T]) ShearY(x, z T)
- func (m *Mat4x4[T]) ShearZ(x, y T)
- func (m *Mat4x4[T]) Translate(x, y, z T)
- func (m *Mat4x4[T]) Transpose()
- type Quaternion
- func (q *Quaternion[T]) Angle() T
- func (q *Quaternion[T]) Conjugate()
- func (q *Quaternion[T]) DotProduct(other *Quaternion[T]) T
- func (q *Quaternion[T]) Equal(other *Quaternion[T], epsilon T) bool
- func (q *Quaternion[T]) EulerAngles() (yaw, pitch, roll T)
- func (q *Quaternion[T]) Exp()
- func (q *Quaternion[T]) GetAxis(outAxis *Vec3[T])
- func (q *Quaternion[T]) Inverse()
- func (q *Quaternion[T]) Len() T
- func (q *Quaternion[T]) LenSqr() T
- func (q *Quaternion[T]) Lerp(other *Quaternion[T], delta T)
- func (q *Quaternion[T]) Log()
- func (q *Quaternion[T]) Mix(other *Quaternion[T], delta T)
- func (q *Quaternion[T]) MultQuaternion(other *Quaternion[T])
- func (q *Quaternion[T]) Normalize()
- func (q *Quaternion[T]) Pitch() T
- func (q *Quaternion[T]) Pow(y T)
- func (q *Quaternion[T]) Roll() T
- func (q *Quaternion[T]) RotateAroundAxis(axis *Vec3[T], angleRad float64)
- func (q *Quaternion[T]) RotateX(angleRad float64)
- func (q *Quaternion[T]) RotateY(angleRad float64)
- func (q *Quaternion[T]) RotateZ(angleRad float64)
- func (q *Quaternion[T]) SetConjugate(other *Quaternion[T])
- func (q *Quaternion[T]) SetIdentity()
- func (q *Quaternion[T]) SetIntermediate(prev *Quaternion[T], current *Quaternion[T], next *Quaternion[T])
- func (q *Quaternion[T]) SetLerp(lhs, rhs *Quaternion[T], delta T)
- func (q *Quaternion[T]) SetMat3x3(m *Mat3x3[T])
- func (q *Quaternion[T]) SetMat4x4(m *Mat4x4[T])
- func (q *Quaternion[T]) SetMix(lhs, rhs *Quaternion[T], delta T)
- func (q *Quaternion[T]) SetMultQuaternion(lhs, rhs *Quaternion[T])
- func (q *Quaternion[T]) SetOrientation(origin *Vec3[T], target *Vec3[T])
- func (q *Quaternion[T]) SetQuaternion(other *Quaternion[T])
- func (q *Quaternion[T]) SetRotationAroundAxis(axis *Vec3[T], angle T)
- func (q *Quaternion[T]) SetRotationEulers(rollRad, yawRad, pitchRad float64)
- func (q *Quaternion[T]) SetRotationX(angle T)
- func (q *Quaternion[T]) SetRotationY(angle T)
- func (q *Quaternion[T]) SetRotationZ(angle T)
- func (q *Quaternion[T]) SetSlerp(lhs, rhs *Quaternion[T], delta T)
- func (q *Quaternion[T]) SetSquad(keyframe1, keyframe2, control1, control2 *Quaternion[T], delta T)
- func (q *Quaternion[T]) Slerp(other *Quaternion[T], delta T)
- func (q *Quaternion[T]) Yaw() T
- type Vec2
- func (v *Vec2[T]) AddVec2(other *Vec2[T])
- func (v *Vec2[T]) DotProduct(other *Vec2[T]) T
- func (v *Vec2[T]) Equal(other *Vec2[T], epsilon T) bool
- func (v *Vec2[T]) Len() T
- func (v *Vec2[T]) LenSqr() T
- func (v *Vec2[T]) Lerp(other *Vec2[T], delta T)
- func (v *Vec2[T]) Normalize()
- func (v *Vec2[T]) Rotate(angleRad float64)
- func (v *Vec2[T]) Scale(scale T)
- func (v *Vec2[T]) SetHomogenousVec3(in *Vec3[T])
- func (v *Vec2[T]) SetHomogenousVec4(in *Vec4[T])
- func (v *Vec2[T]) SetVec2(in *Vec2[T])
- func (v *Vec2[T]) SetVec3(in *Vec3[T])
- func (v *Vec2[T]) SetVec4(in *Vec4[T])
- func (v *Vec2[T]) SubtractVec2(other *Vec2[T])
- func (v *Vec2[T]) Transform(m *Mat2x2[T])
- func (v *Vec2[T]) TransformHomogenous(m *Mat3x3[T])
- type Vec3
- func (v *Vec3[T]) AddVec3(other *Vec3[T])
- func (v *Vec3[T]) CrossProduct(other *Vec3[T])
- func (v *Vec3[T]) DotProduct(other *Vec3[T]) T
- func (v *Vec3[T]) Equal(other *Vec3[T], epsilon T) bool
- func (v *Vec3[T]) Len() T
- func (v *Vec3[T]) LenSqr() T
- func (v *Vec3[T]) Lerp(other *Vec3[T], delta T)
- func (v *Vec3[T]) Normalize()
- func (v *Vec3[T]) Orthonormalize(other *Vec3[T])
- func (v *Vec3[T]) Rotate(angleRad float64, axis *Vec3[T])
- func (v *Vec3[T]) RotateWithQuaternion(q *Quaternion[T])
- func (v *Vec3[T]) RotateX(angleRad float64)
- func (v *Vec3[T]) RotateY(angleRad float64)
- func (v *Vec3[T]) RotateZ(angleRad float64)
- func (v *Vec3[T]) Scale(scale T)
- func (v *Vec3[T]) SetAddVec3(lhs, rhs *Vec3[T])
- func (v *Vec3[T]) SetClosestPointOnLine(point, endpoint1, endpoint2 *Vec3[T])
- func (v *Vec3[T]) SetCrossProduct(lhs, rhs *Vec3[T])
- func (v *Vec3[T]) SetHomogenousVec4(in *Vec4[T])
- func (v *Vec3[T]) SetLerp(lhs, rhs *Vec3[T], delta T)
- func (v *Vec3[T]) SetNormalizeVec3(input *Vec3[T])
- func (v *Vec3[T]) SetRotate(input *Vec3[T], angleRad float64, axis *Vec3[T])
- func (v *Vec3[T]) SetRotateWithQuaternion(input *Vec3[T], q *Quaternion[T])
- func (v *Vec3[T]) SetRotateX(input *Vec3[T], angleRad float64)
- func (v *Vec3[T]) SetRotateY(input *Vec3[T], angleRad float64)
- func (v *Vec3[T]) SetRotateZ(input *Vec3[T], angleRad float64)
- func (v *Vec3[T]) SetScale(input *Vec3[T], scale T)
- func (v *Vec3[T]) SetSubtractVec3(lhs, rhs *Vec3[T])
- func (v *Vec3[T]) SetTransform(input *Vec3[T], m *Mat3x3[T])
- func (v *Vec3[T]) SetTransformHomogenous(input *Vec3[T], m *Mat4x4[T])
- func (v *Vec3[T]) SetTriangleNormal(point1, point2, point3 *Vec3[T])
- func (v *Vec3[T]) SetVec2(in *Vec2[T])
- func (v *Vec3[T]) SetVec3(in *Vec3[T])
- func (v *Vec3[T]) SetVec4(in *Vec4[T])
- func (v *Vec3[T]) SubtractVec3(other *Vec3[T])
- func (v *Vec3[T]) Transform(m *Mat3x3[T])
- func (v *Vec3[T]) TransformHomogenous(m *Mat4x4[T])
- type Vec4
- func (v *Vec4[T]) AddVec4(other *Vec4[T])
- func (v *Vec4[T]) DotProduct(other *Vec4[T]) T
- func (v *Vec4[T]) Equal(other *Vec4[T], epsilon T) bool
- func (v *Vec4[T]) Len() T
- func (v *Vec4[T]) LenSqr() T
- func (v *Vec4[T]) Lerp(other *Vec4[T], delta T)
- func (v *Vec4[T]) Normalize()
- func (v *Vec4[T]) Rotate(angleRad float64, normal *Vec3[T])
- func (v *Vec4[T]) RotateWithQuaternion(q *Quaternion[T])
- func (v *Vec4[T]) RotateX(angleRad float64)
- func (v *Vec4[T]) RotateY(angleRad float64)
- func (v *Vec4[T]) RotateZ(angleRad float64)
- func (v *Vec4[T]) Scale(scale T)
- func (v *Vec4[T]) SetAddVec4(lhs *Vec4[T], rhs *Vec4[T])
- func (v *Vec4[T]) SetLerp(lhs *Vec4[T], rhs *Vec4[T], delta T)
- func (v *Vec4[T]) SetNormalizeVec4(input *Vec4[T])
- func (v *Vec4[T]) SetRotate(input *Vec4[T], angleRad float64, normal *Vec3[T])
- func (v *Vec4[T]) SetRotateWithQuaternion(input *Vec4[T], q *Quaternion[T])
- func (v *Vec4[T]) SetRotateX(input *Vec4[T], angleRad float64)
- func (v *Vec4[T]) SetRotateY(input *Vec4[T], angleRad float64)
- func (v *Vec4[T]) SetRotateZ(input *Vec4[T], angleRad float64)
- func (v *Vec4[T]) SetScale(input *Vec4[T], scale T)
- func (v *Vec4[T]) SetSubtractVec4(lhs *Vec4[T], rhs *Vec4[T])
- func (v *Vec4[T]) SetTransform(input *Vec4[T], m *Mat4x4[T])
- func (v *Vec4[T]) SetTransformHomogenous(input *Vec4[T], m *Mat4x4[T])
- func (v *Vec4[T]) SetVec2(in *Vec2[T])
- func (v *Vec4[T]) SetVec3(in *Vec3[T])
- func (v *Vec4[T]) SetVec4(in *Vec4[T])
- func (v *Vec4[T]) SubtractVec4(other *Vec4[T])
- func (v *Vec4[T]) Transform(m *Mat4x4[T])
- func (v *Vec4[T]) TransformHomogenous(m *Mat4x4[T])
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FloatingPoint ¶
type Mat2Row ¶
type Mat2Row[T FloatingPoint] [2]T
type Mat2x2 ¶
type Mat2x2[T FloatingPoint] [2]Mat2Row[T]
Mat2x2 is a two-dimensional array of floating point-compatible values that can be used for 2x2 matrix arithmetic
func (*Mat2x2[T]) Equal ¶
Equal returns true if every entry in this matrix is equal to every entry in the provided matrix
other - The matrix to compare this matrix to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat2x2[T]) IsNormalized ¶
IsNormalized returns true if every row and every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat2x2[T]) IsNull ¶
IsNull returns true if every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat2x2[T]) MultMat2x2 ¶ added in v1.1.0
MultMat2x2 multiplies this matrix against the provided matrix and updates this matrix with the results
other - The right operand of the multiplication operation
func (*Mat2x2[T]) SetColMajor ¶
SetColMajor overwrites the current contents of the matrix with 2 matrix columns passed in as 2-element vectors
c1 - The first column of the matrix c2 - The second column of the matrix
func (*Mat2x2[T]) SetDiagonalScalar ¶
func (m *Mat2x2[T]) SetDiagonalScalar(s T)
SetDiagonalScalar overwrites the current contents of the matrix with an identity matrix, multiplied by the provided scalar value
s - The scalar value to multiply the matrix entries by
func (*Mat2x2[T]) SetDiagonalVector ¶
SetDiagonalVector overwrites the current contents of the matrix with an identity matrix, in which the 1 values are replaced with the contents of a provided vector, with each vector element corresponding to a column in the matrix
v - The vector containing the diagonal entries that will be populated into the matrix
func (*Mat2x2[T]) SetIdentity ¶
func (m *Mat2x2[T]) SetIdentity()
SetIdentity overwrites the current contents of the matrix with the identity matrix
func (*Mat2x2[T]) SetMat2x2 ¶
SetMat2x2 overwrites the current contents of the matrix with the contents of the provided matrix
other - The matrix to initialize from
func (*Mat2x2[T]) SetMat3x3 ¶
SetMat3x3 overwrites the current contents of the matrix with the upper left 2x2 area of a 3x3 matrix
other - The 3x3 matrix to initialize from
func (*Mat2x2[T]) SetMat4x4 ¶
SetMat4x4 overwrites the current contents of the matrix with the upper left 2x2 area of a 4x4 matrix
other - The 4x4 matrix to initialize from
func (*Mat2x2[T]) SetMultMat2x2 ¶ added in v1.1.0
SetMultMat2x2 multiplies two 2x2 matrices together and overwrites the current contents of this matrix with the results.
lhs - The left operand of the multiplication operation rhs - The right operand of the multiplication operation
func (*Mat2x2[T]) SetRowMajor ¶
SetRowMajor overwrites the current contents of the matrix with 2 matrix rows passed in as 2-element vectors
r1 - The first row of the matrix r2 - The second row of the matrix
type Mat3Row ¶
type Mat3Row[T FloatingPoint] [3]T
type Mat3x3 ¶
type Mat3x3[T FloatingPoint] [3]Mat3Row[T]
Mat3x3 is a two-dimensional array of floating point-compatible values that can be used for 3x3 matrix arithmetic and affine 3d matrix transformations
func (*Mat3x3[T]) ApplyTransform ¶
ApplyTransform applies the provided transform matrix to this transform matrix. "Apply Transform" is just a matrix multiply with the operands reversed.
other - The transform matrix to apply
func (*Mat3x3[T]) Equal ¶
Equal returns true if every entry in this matrix is equal to every entry in the provided matrix
other - The matrix to compare this matrix to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat3x3[T]) GetAxisAngle ¶
GetAxisAngle retrieves the axis and angle of rotation for this matrix, if it is a rotation matrix. If it is not a rotation matrix, the results are undefined.
outAxis - A pointer to a 3-element vector that will be populated with a unit vector normal to the angle of rotation.
outAngleRad - A pointer to a float64 that will be populated with the amount to rotate in radians
func (*Mat3x3[T]) Inverse ¶
func (m *Mat3x3[T]) Inverse()
Inverse inverts this matrix. If this matrix has no valid inverse, some entries will be set to NaN
func (*Mat3x3[T]) IsNormalized ¶
IsNormalized returns true if every row and every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat3x3[T]) IsNull ¶
IsNull returns true if every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat3x3[T]) MultMat3x3 ¶ added in v1.1.0
MultMat3x3 multiplies this matrix with the provided matrix and updates this matrix with the results. In Matrix Multiplication between transform matrices, the left matrix is unintuitively applied to the right matrix rather than the other way around. You may prefer to use ApplyTransform.
other - The right hand side of the multiplication operation.
func (*Mat3x3[T]) Orthonormalize ¶
func (m *Mat3x3[T]) Orthonormalize()
Orthonormalize this matrix. All 3 columns will be normalized and made to lie at right angles to one another. Only the first column is guaranteed to maintain its current direction.
func (*Mat3x3[T]) Proj2D ¶
Proj2D transforms the matrix as a planar projection matrix along the provided normal axis
normal - The normal of the plane
func (*Mat3x3[T]) RotateAroundAxis ¶
RotateAroundAxis transforms this matrix by applying a rotation around the provided axis by the provided angle in radians
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Mat3x3[T]) RotateX ¶
RotateX applies a transformation to this matrix that rotates around the x axis by the specified amount
angleRad - The angle to rotate around the x axis in radians
func (*Mat3x3[T]) RotateY ¶
RotateY applies a transformation to this matrix that rotates around the y axis by the specified amount
angleRad - The angle to rotate around the y axis in radians
func (*Mat3x3[T]) RotateZ ¶
RotateZ applies a transformation to this matrix that rotates around the z axis by the specified amount
angleRad - The angle to rotate around the z axis in radians
func (*Mat3x3[T]) Scale ¶
func (m *Mat3x3[T]) Scale(x, y, z T)
Scale applies a scale transform to this matrix that scales vectors by the 3 provided scalars
x - Factor to scale by along the x axis
y - Factor to scale by along the y axis
z - Factor to scale by along the z axis
func (*Mat3x3[T]) SetApplyTransform ¶
SetApplyTransform applies the right transform matrix to the left transform matrix and overwrites the current contents of this matrix with the result. "ApplyTransform" is just a matrix multiply with the operands reversed.
lhs - The matrix having a transform applied to it
rhs - The transform being applied
func (*Mat3x3[T]) SetColMajor ¶
SetColMajor overwrites the current contents of the matrix with 3 matrix columns passed in as 3-element vectors
c1 - The first column of the matrix c2 - The second column of the matrix c3 - The third column of the matrix
func (*Mat3x3[T]) SetDiagonalScalar ¶
func (m *Mat3x3[T]) SetDiagonalScalar(s T)
SetDiagonalScalar overwrites the current contents of the matrix with an identity matrix, multiplied by the provided scalar value
s - The scalar value to multiply the matrix entries by
func (*Mat3x3[T]) SetDiagonalVector ¶
SetDiagonalVector overwrites the current contents of the matrix with an identity matrix, in which the 1 values are replaced with the contents of a provided vector, with each vector element corresponding to a column in the matrix
v - The vector containing the diagonal entries that will be populated into the matrix
func (*Mat3x3[T]) SetIdentity ¶
func (m *Mat3x3[T]) SetIdentity()
SetIdentity overwrites the current contents of the matrix with the identity matrix
func (*Mat3x3[T]) SetMat2x2 ¶ added in v1.1.0
SetMat2x2 overwrites the current contents of the matrix with the identity matrix and layers the provided 2x2 matrix over the upper left 2x2 area of the matrix
other - The 2x2 matrix to initialize from
func (*Mat3x3[T]) SetMat3x3 ¶
SetMat3x3 overwrites the current contents of the matrix with the contents of the provided matrix
other - The matrix to initialize from
func (*Mat3x3[T]) SetMat4x4 ¶
SetMat4x4 overwrites the current contents of the matrix with the upper left 3x3 area of a 4x4 matrix
other - The 4x4 matrix to initialize from
func (*Mat3x3[T]) SetMultMat3x3 ¶ added in v1.1.0
SetMultMat3x3 multiplies two 3x3 matrices together and overwrites the current contents of this matrix with the results. In Matrix Multiplication between transform matrices, the left matrix is unintuitively applied to the right matrix rather than the other way around. You may prefer to use SetApplyTransform.
lhs - The left operand of the multiplication operation rhs - The right operand of the multiplication operation
func (*Mat3x3[T]) SetQuaternion ¶
func (m *Mat3x3[T]) SetQuaternion(other *Quaternion[T])
SetQuaternion overwrites the current contents of the matrix with a rotation matrix providing the same rotation as a provided quaternion
other - A quaternion whose rotation will be written into this matrix
func (*Mat3x3[T]) SetRotationAroundAxis ¶
SetRotationAroundAxis overwrites the current contents of this matrix with a rotation matrix that rotates around the provided axis by the provided angle in radians.
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Mat3x3[T]) SetRotationEulers ¶
SetRotationEulers overwrites the current contents of this matrix with a rotation matrix that rotates first by yaw (y rotation), then by pitch (x rotation), and then by roll (z rotation)
yawRad - Angle to rotate yaw in radians
pitchRad - Angle to rotate pitch in radians
rollRad - Angle to rotate roll in radians
func (*Mat3x3[T]) SetRotationX ¶
SetRotationX overwrites the current contents of this matrix with a rotation matrix that rotates around the x axis by the specified amount
pitchRad - The angle to rotate around the x axis in radians
func (*Mat3x3[T]) SetRotationY ¶
SetRotationY overwrites the current contents of this matrix with a rotation matrix that rotates around the y axis by the specified amount
yawRad - The angle to rotate around the y axis in radians
func (*Mat3x3[T]) SetRotationZ ¶
SetRotationZ overwrites the current contents of this matrix with a rotation matrix that rotates around the z axis by the specified amount
rollRad - The angle to rotate around the z axis in radians
func (*Mat3x3[T]) SetRowMajor ¶
SetRowMajor overwrites the current contents of the matrix with 3 matrix rows passed in as 3-element vectors
r1 - The first row of the matrix r2 - The second row of the matrix r3 - The third row of the matrix
func (*Mat3x3[T]) SetScale ¶
func (m *Mat3x3[T]) SetScale(x, y, z T)
SetScale overwrites the current contents of this matrix with a transform matrix that scales vectors by the 3 provided scalars
x - Factor to scale by along the x axis
y - Factor to scale by along the y axis
z - Factor to scale by along the z axis
func (*Mat3x3[T]) SetShearX ¶
func (m *Mat3x3[T]) SetShearX(y, z T)
SetShearX overwrites this matrix with a shear matrix that shears along the X axis by the provided factor scalars
y - y shear factor
z - z shear factor
func (*Mat3x3[T]) SetShearY ¶
func (m *Mat3x3[T]) SetShearY(x, z T)
SetShearY overwrites this matrix with a shear matrix that shears along the Y axis by the provided factor scalars
x - x shear factor
z - z shear factor
func (*Mat3x3[T]) SetShearZ ¶
func (m *Mat3x3[T]) SetShearZ(x, y T)
SetShearZ overwrites this matrix with a shear matrix that shears along the Z axis by the provided factor scalars
x - x shear factor
y - y shear factor
func (*Mat3x3[T]) ShearX ¶
func (m *Mat3x3[T]) ShearX(y, z T)
ShearX applies a shear transform to this matrix along the X axis by the provided factor scalars
y - y shear factor
z - z shear factor
func (*Mat3x3[T]) ShearY ¶
func (m *Mat3x3[T]) ShearY(x, z T)
ShearY applies a shear transform to this matrix along the Y axis by the provided factor scalars
x - x shear factor
z - z shear factor
type Mat4Row ¶
type Mat4Row[T FloatingPoint] [4]T
type Mat4x4 ¶
type Mat4x4[T FloatingPoint] [4]Mat4Row[T]
Mat4x4 is a two-dimensional array of floating point-compatible values that can be used for 4x4 matrix arithmetic and all 3d matrix transformations
func (*Mat4x4[T]) ApplyTransform ¶
ApplyTransform applies the provided transform matrix to this transform matrix. "Apply Transform" is just a matrix multiply with the operands reversed.
other - The transform matrix to apply
func (*Mat4x4[T]) Equal ¶
Equal returns true if every entry in this matrix is equal to every entry in the provided matrix
other - The matrix to compare this matrix to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat4x4[T]) GetAxisAngle ¶
GetAxisAngle retrieves the axis and angle of rotation for this matrix, if it is a rotation matrix. If it is not a rotation matrix, the results are undefined.
outAxis - A pointer to a 3-element vector that will be populated with a unit vector normal to the angle of rotation.
outAngleRad - A pointer to a float64 that will be populated with the amount to rotate in radians
func (*Mat4x4[T]) InterpolateMat4x4 ¶ added in v1.1.0
InterpolateMat4x4 updates this transform matrix by interpolating the rotation and translation with those of another transform matrix.
otherMatrix - The "end" transform matrix in the interpolation
delta - A value between 0 and 1 indicating how far to interpolate between this matrix and the other
func (*Mat4x4[T]) Inverse ¶
func (m *Mat4x4[T]) Inverse()
Inverse inverts this matrix. If this matrix has no valid inverse, some entries will be set to NaN
func (*Mat4x4[T]) IsNormalized ¶
IsNormalized returns true if every row and every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat4x4[T]) IsNull ¶
IsNull returns true if every column in this matrix has a length of 1
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Mat4x4[T]) MultMat4x4 ¶ added in v1.1.0
MultMat4x4 multiplies this matrix with the provided matrix and updates this matrix with the results. In Matrix Multiplication between transform matrices, the left matrix is unintuitively applied to the right matrix rather than the other way around. You may prefer to use ApplyTransform.
other - The right hand side of the multiplication operation.
func (*Mat4x4[T]) Proj3D ¶
Proj3D transforms the matrix as a planar projection matrix along the provided normal axis
normal - The normal of the plane
func (*Mat4x4[T]) RotateAroundAxis ¶
RotateAroundAxis transforms this matrix by applying a rotation around the provided axis by the provided angle in radians
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Mat4x4[T]) RotateX ¶
RotateX applies a transformation to this matrix that rotates around the x axis by the specified amount
angleRad - The angle to rotate around the x axis in radians
func (*Mat4x4[T]) RotateY ¶
RotateY applies a transformation to this matrix that rotates around the y axis by the specified amount
angleRad - The angle to rotate around the y axis in radians
func (*Mat4x4[T]) RotateZ ¶
RotateZ applies a transformation to this matrix that rotates around the z axis by the specified amount
angleRad - The angle to rotate around the z axis in radians
func (*Mat4x4[T]) Scale ¶
func (m *Mat4x4[T]) Scale(x, y, z T)
Scale applies a scale transform to this matrix that scales vectors by the 3 provided scalars
x - Factor to scale by along the x axis
y - Factor to scale by along the y axis
z - Factor to scale by along the z axis
func (*Mat4x4[T]) SetAffineMat4x4 ¶ added in v1.1.0
SetAffineMat4x4 overwrites the current contents of this matrix with the identity matrix, and then copies the upper left 3x3 portion of the provided 4x4 matrix into the upper left 3x3 portion of this matrix.
other - The 4x4 matrix to copy from
func (*Mat4x4[T]) SetApplyTransform ¶ added in v1.1.1
SetApplyTransform applies the right transform matrix to the left transform matrix and overwrites the current contents of this matrix with the result. "ApplyTransform" is just a matrix multiply with the operands reversed.
lhs - The matrix having a transform applied to it
rhs - The transform being applied
func (*Mat4x4[T]) SetColMajor ¶
SetColMajor overwrites the current contents of the matrix with 4 matrix columns passed in as 4-element vectors
c1 - The first column of the matrix c2 - The second column of the matrix c3 - The third column of the matrix c4 - The fourth column of the matrix
func (*Mat4x4[T]) SetDiagonalScalar ¶
func (m *Mat4x4[T]) SetDiagonalScalar(s T)
SetDiagonalScalar overwrites the current contents of the matrix with an identity matrix, multiplied by the provided scalar value
s - The scalar value to multiply the matrix entries by
func (*Mat4x4[T]) SetDiagonalVector ¶
SetDiagonalVector overwrites the current contents of the matrix with an identity matrix, in which the 1 values are replaced with the contents of a provided vector, with each vector element corresponding to a column in the matrix
v - The vector containing the diagonal entries that will be populated into the matrix
func (*Mat4x4[T]) SetFrustum ¶
func (m *Mat4x4[T]) SetFrustum(left, right, bottom, top, nearVal, farVal T)
SetFrustum overwrites the current matrix values with a projection matrix for a frustum with the provided properties
left - The left boundary of the view frustum right - The right boundary of the view frustum bottom - The bottom boundary of the view frustum top - The top boundary of the view frustum nearVal - The near clipping plane distance from origin farVal - The far clipping plane distance from origin
func (*Mat4x4[T]) SetIdentity ¶
func (m *Mat4x4[T]) SetIdentity()
SetIdentity overwrites the current contents of the matrix with the identity matrix
func (*Mat4x4[T]) SetInfinitePerspective ¶
SetInfinitePerspective overwrites the current contents of this matrix with a projection matrix that is used to render objects that are infinitely-far away
fovYRad - The vertical field of view of the projection in radians
aspectRatio - The aspect ratio of the viewport
zNear - The near clipping plane's distance from the origin
func (*Mat4x4[T]) SetInterpolateMat4x4 ¶ added in v1.1.0
SetInterpolateMat4x4 overwrites the current contents of this matrix with a transform matrix created by interpolating between the rotation and translation of two transform matrices.
lhs - The "start" transform matrix in this interpolation
rhs - The "end" transform matrix in this interpolation
delta - A value between 0 and 1 indicating how far to interpolate between the two matrices
func (*Mat4x4[T]) SetLookAt ¶
SetLookAt overwrites the current contents of this matrix with a view matrix that is used to view a scene, given a particular camera position and orientation
eyePosition - A 3d vector indicating the location of the camera
target - A 3d vector indicating the point the camera is focusing on
up - A 3d vector indicating the camera's up direction
func (*Mat4x4[T]) SetMat2x2 ¶ added in v1.1.0
SetMat2x2 overwrites the current contents of the matrix with the identity matrix and layers the provided 2x2 matrix over the upper left 2x2 area of the matrix
other - The 2x2 matrix to initialize from
func (*Mat4x4[T]) SetMat3x3 ¶
SetMat3x3 overwrites the current contents of the matrix with the identity matrix and layers the provided 3x3 matrix over the upper left 3x3 area
other - The 3x3 matrix to initialize from
func (*Mat4x4[T]) SetMat4x4 ¶
SetMat4x4 overwrites the current contents of the matrix with the contents of the provided matrix
other - The matrix to initialize from
func (*Mat4x4[T]) SetMultMat4x4 ¶ added in v1.1.0
SetMultMat4x4 multiplies two 4x4 matrices together and overwrites the current contents of this matrix with the results. In Matrix Multiplication between transform matrices, the left matrix is unintuitively applied to the right matrix rather than the other way around. You may prefer to use SetApplyTransform.
lhs - The left operand of the multiplication operation rhs - The right operand of the multiplication operation
func (*Mat4x4[T]) SetOrientation ¶
SetOrientation overwrites the current matrix values with a rotation matrix which rotates from the provided source vector to the provided target vector
origin - A unit vector indicating the starting direction of the rotation
target - A unit vector indicating the target direction of the rotation
func (*Mat4x4[T]) SetOrthographic ¶
func (m *Mat4x4[T]) SetOrthographic(left, right, bottom, top, zNear, zFar T)
SetOrthographic overwrites the current contents of this matrix with a projection matrix that is used to render objects with no perspective, generally used for 2d rendering
left - The left boundary of the viewport
right - The right boundary of the viewport
bottom - The bottom boundary of the viewport
top - The top boundary of the viewport
zNear - The near clipping plane's distance from the origin
zFar - The far clipping plane's distance from the origin
func (*Mat4x4[T]) SetOrthographic2D ¶
func (m *Mat4x4[T]) SetOrthographic2D(left, right, bottom, top T)
SetOrthographic2D overwrites the current contents of this matrix with a projection matrix that is used to render 2-dimensional objects with no perspective effect and no depth
left - The left boundary of the viewport
right - The right boundary of the viewport
bottom - The bottom boundary of the viewport
top - The top boundary of the viewport
func (*Mat4x4[T]) SetPerspective ¶
SetPerspective overwrites the current contents of this matrix with a projection matrix that is used to render in a 3d perspective
fovYRad - The vertical field of view of the projection, in radians
aspectRatio - The aspect ratio of the viewport
zNear - The near clipping plane's distance from the origin
zFar - The far clipping plane's distance from the origin
func (*Mat4x4[T]) SetQuaternion ¶
func (m *Mat4x4[T]) SetQuaternion(other *Quaternion[T])
SetQuaternion overwrites the current contents of the matrix with an affine rotation matrix that contains the rotation of the provided Quaternion
other - The quaternion to initialize from
func (*Mat4x4[T]) SetRotationAroundAxis ¶
SetRotationAroundAxis overwrites the current contents of this matrix with a rotation matrix that rotates around the provided axis by the provided angle in radians.
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Mat4x4[T]) SetRotationEulers ¶
SetRotationEulers overwrites the current contents of this matrix with a rotation matrix that rotates first by yaw (y rotation), then by pitch (x rotation), and then by roll (z rotation)
yawRad - Angle to rotate yaw in radians
pitchRad - Angle to rotate pitch in radians
rollRad - Angle to rotate roll in radians
func (*Mat4x4[T]) SetRotationX ¶
SetRotationX overwrites the current contents of this matrix with a rotation matrix that rotates around the x axis by the specified amount
pitchRad - The angle to rotate around the x axis in radians
func (*Mat4x4[T]) SetRotationY ¶
SetRotationY overwrites the current contents of this matrix with a rotation matrix that rotates around the y axis by the specified amount
yawRad - The angle to rotate around the y axis in radians
func (*Mat4x4[T]) SetRotationZ ¶
SetRotationZ overwrites the current contents of this matrix with a rotation matrix that rotates around the z axis by the specified amount
rollRad - The angle to rotate around the z axis in radians
func (*Mat4x4[T]) SetRowMajor ¶
SetRowMajor overwrites the current contents of the matrix with 4 matrix rows passed in as 4-element vectors
r1 - The first row of the matrix r2 - The second row of the matrix r3 - The third row of the matrix r4 - The fourth row of the matrix
func (*Mat4x4[T]) SetScale ¶
func (m *Mat4x4[T]) SetScale(x, y, z T)
SetScale overwrites the current contents of this matrix with a transform matrix that scales vectors by the 3 provided scalars
x - Factor to scale by along the x axis
y - Factor to scale by along the y axis
z - Factor to scale by along the z axis
func (*Mat4x4[T]) SetShearX ¶
func (m *Mat4x4[T]) SetShearX(y, z T)
SetShearX overwrites this matrix with a shear matrix that shears along the X axis by the provided factor scalars
y - y shear factor
z - z shear factor
func (*Mat4x4[T]) SetShearY ¶
func (m *Mat4x4[T]) SetShearY(x, z T)
SetShearY overwrites this matrix with a shear matrix that shears along the Y axis by the provided factor scalars
x - x shear factor
z - z shear factor
func (*Mat4x4[T]) SetShearZ ¶
func (m *Mat4x4[T]) SetShearZ(x, y T)
SetShearZ overwrites this matrix with a shear matrix that shears along the Z axis by the provided factor scalars
x - x shear factor
y - y shear factor
func (*Mat4x4[T]) SetTranslation ¶
func (m *Mat4x4[T]) SetTranslation(x, y, z T)
SetTranslation overwrites the current matrix values with a transform matrix which translates vectors by the provided values
x - The amount to translate along the x axis
y - The amount to translate along the y axis
z - The amount to translate along the z axis
func (*Mat4x4[T]) ShearX ¶
func (m *Mat4x4[T]) ShearX(y, z T)
ShearX applies a shear transform to this matrix along the X axis by the provided factor scalars
y - y shear factor
z - z shear factor
func (*Mat4x4[T]) ShearY ¶
func (m *Mat4x4[T]) ShearY(x, z T)
ShearY applies a shear transform to this matrix along the Y axis by the provided factor scalars
x - x shear factor
z - z shear factor
func (*Mat4x4[T]) ShearZ ¶
func (m *Mat4x4[T]) ShearZ(x, y T)
ShearZ applies a shear transform to this matrix along the Z axis by the provided factor scalars
x - x shear factor
y - y shear factor
func (*Mat4x4[T]) Translate ¶
func (m *Mat4x4[T]) Translate(x, y, z T)
Translate applies a translation transform to this matrix that translates vectors by the provided scalar values
x - Amount to translate along the x axis
y - Amount to translate along the y axis
z - Amount to translate along the z axis
type Quaternion ¶
type Quaternion[T FloatingPoint] struct { X, Y, Z, W T }
Quaternion is a 4-element vector that represents a 3d rotation in a way that is immune to gimbal lock
func (*Quaternion[T]) Angle ¶
func (q *Quaternion[T]) Angle() T
Angle retrieves the scalar angle of rotation, in radians, of the quaternion's axis-angle formulation
func (*Quaternion[T]) Conjugate ¶
func (q *Quaternion[T]) Conjugate()
Conjugate calculates the conjugate of the current quaternion and updates the quaternion to that conjugate
func (*Quaternion[T]) DotProduct ¶
func (q *Quaternion[T]) DotProduct(other *Quaternion[T]) T
DotProduct calculates and returns the dot product of this quaternion with another provided quaternion
other - The quaternion to use as the right operand in the dot product operation
func (*Quaternion[T]) Equal ¶
func (q *Quaternion[T]) Equal(other *Quaternion[T], epsilon T) bool
Equal returns true if every entry in this quaternion is equal to every entry in the provided quaternion
other - The quaternion to compare this quaternion to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Quaternion[T]) EulerAngles ¶
func (q *Quaternion[T]) EulerAngles() (yaw, pitch, roll T)
EulerAngles retrieves the scalar rotations, in radians, of the quaternion's euler angles
func (*Quaternion[T]) Exp ¶
func (q *Quaternion[T]) Exp()
Exp calculates the exponent of the current quaternion and updates the quaternion to that exponent. The exponent is the inverse of the logarithm.
func (*Quaternion[T]) GetAxis ¶
func (q *Quaternion[T]) GetAxis(outAxis *Vec3[T])
GetAxis retrieves the vector axis of rotation of the quaternion's axis-angle formulation
outAxis - A pointer to a 3-element vector to populate with the axis data
func (*Quaternion[T]) Inverse ¶
func (q *Quaternion[T]) Inverse()
Inverse updates the current quaternion to be its own inverse. For unit quaternions, this is the same as the conjugate, but is less performant in order to cover non-unit cases.
func (*Quaternion[T]) Len ¶
func (q *Quaternion[T]) Len() T
Len retrieves the square root of the quaternion's dot product with itself
func (*Quaternion[T]) LenSqr ¶
func (q *Quaternion[T]) LenSqr() T
LenSqr retrieves the quaternion's dot product with itself
func (*Quaternion[T]) Lerp ¶
func (q *Quaternion[T]) Lerp(other *Quaternion[T], delta T)
Lerp performs a linear interpolation between this quaternion and another provided quaternion at non-constant speed and updates this quaternion with the result.
other - The target quaternion in the interpolation
delta - The mix factor between the two quaternions, must be a value between 0 and 1
func (*Quaternion[T]) Log ¶
func (q *Quaternion[T]) Log()
Log calculates the logarithm of the current quaternion and updates the quaternion to that logarithm. The logarithm is the inverse of the exponent.
func (*Quaternion[T]) Mix ¶
func (q *Quaternion[T]) Mix(other *Quaternion[T], delta T)
Mix performs an oriented spherical linear interpolation at constant speed between this quaternion and another provided quaternion and updates this quaternion to the result
other - The target quaternion in the interpolation
delta - The mix factor between the two quaternions- this can be any value: between 0 and 1, the interpolation will move linearly from this quaternion to the other quaternion. Beyond those bounds, the interpolation oscillates between the two values
func (*Quaternion[T]) MultQuaternion ¶
func (q *Quaternion[T]) MultQuaternion(other *Quaternion[T])
MultQuaternion multiplies this quaternion with a provided quaternion and updates this quaternion with the result
other - The quaternion to use as the right operand in the multiplication operation
func (*Quaternion[T]) Normalize ¶
func (q *Quaternion[T]) Normalize()
Normalize updates the current quaternion to be a unit quaternion
func (*Quaternion[T]) Pitch ¶
func (q *Quaternion[T]) Pitch() T
Pitch retrieves the scalar rotation, in radians, of the quaternion's euler pitch
func (*Quaternion[T]) Pow ¶
func (q *Quaternion[T]) Pow(y T)
Pow raises the current quaternion to a provided power and updates the quaternion to the calculated quaternion. Pow is understood in terms of the quaternion multiplication operation, so squaring a quaternion is the same as multiplying a quaternion against itself, cubing a quaternion is the same as multiplying it against its square, and so forth.
y - A scalar value indicating the power to raise the quaternion to. Can be any value, a quaternion raised to the 0th power is the identity quaternion.
func (*Quaternion[T]) Roll ¶
func (q *Quaternion[T]) Roll() T
Roll retrieves the scalar rotation, in radians, of the quaternion's euler roll
func (*Quaternion[T]) RotateAroundAxis ¶ added in v1.1.0
func (q *Quaternion[T]) RotateAroundAxis(axis *Vec3[T], angleRad float64)
RotateAroundAxis rotates this quaternion by applying a rotation around the provided axis by the provided angle in radians
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Quaternion[T]) RotateX ¶
func (q *Quaternion[T]) RotateX(angleRad float64)
RotateX applies a rotation to this quaternion that rotates around the x axis by the specified amount
angleRad - The angle to rotate around the x axis in radians
func (*Quaternion[T]) RotateY ¶
func (q *Quaternion[T]) RotateY(angleRad float64)
RotateY applies a rotation to this quaternion that rotates around the y axis by the specified amount
angleRad - The angle to rotate around the y axis in radians
func (*Quaternion[T]) RotateZ ¶
func (q *Quaternion[T]) RotateZ(angleRad float64)
RotateZ applies a rotation to this quaternion that rotates around the z axis by the specified amount
angleRad - The angle to rotate around the z axis in radians
func (*Quaternion[T]) SetConjugate ¶
func (q *Quaternion[T]) SetConjugate(other *Quaternion[T])
SetConjugate overwrites the contents of this quaternion with the conjugate of a provided quaternion.
other - The quaternion to conjugate
func (*Quaternion[T]) SetIdentity ¶
func (q *Quaternion[T]) SetIdentity()
SetIdentity overwrites the contents of this quaternion with the identity quaternion
func (*Quaternion[T]) SetIntermediate ¶
func (q *Quaternion[T]) SetIntermediate(prev *Quaternion[T], current *Quaternion[T], next *Quaternion[T])
SetIntermediate overwrites the current quaternion with a SQUAD control point quaternion for the control point corresponding to the 'current' rotation keyframe. This control point is used as an input for the SetSquad method.
prev - The keyframe before 'current' - this may be the same as 'current' when 'current' is the first keyframe in a path
current - The keyframe we are attempting to retrieve the control point for
next - The keyframe after 'current' - this may be the same as 'current' when 'current' is the last keyframe in a path
func (*Quaternion[T]) SetLerp ¶
func (q *Quaternion[T]) SetLerp(lhs, rhs *Quaternion[T], delta T)
SetLerp performs a linear interpolation between two quaternions at non-constant speed and overwrites this quaternion with the result.
lhs - The origin quaternion in the interpolation
rhs - The target quaternion in the interpolation
delta - The mix factor between the two quaternions and must be a value between 0 and 1
func (*Quaternion[T]) SetMat3x3 ¶
func (q *Quaternion[T]) SetMat3x3(m *Mat3x3[T])
SetMat3x3 overwrites the current quaternion with the rotation of a provided transform matrix
m - The transform matrix to initialize from
func (*Quaternion[T]) SetMat4x4 ¶
func (q *Quaternion[T]) SetMat4x4(m *Mat4x4[T])
SetMat4x4 overwrites the current quaternion with the rotation of a provided transform matrix
m - The transform matrix to initialize from
func (*Quaternion[T]) SetMix ¶
func (q *Quaternion[T]) SetMix(lhs, rhs *Quaternion[T], delta T)
SetMix performs an oriented spherical linear interpolation at constant speed between two quaternions and overwrites the current quaternion with the result.
lhs - The origin quaternion in the interpolation
rhs - The target quaternion in the interpolation
delta - The mix factor between the two quaternions- this can be any value: between 0 and 1, the interpolation will move linearly from the lhs to the rhs quaternion. Beyond those bounds, the interpolation oscillates between the two values
func (*Quaternion[T]) SetMultQuaternion ¶
func (q *Quaternion[T]) SetMultQuaternion(lhs, rhs *Quaternion[T])
SetMultQuaternion multiplies two quaternions together and overwrites the current contents of this quaternion with the results.
lhs - The left operand of the multiplication operation
rhs - The right operand of the multiplication operation
func (*Quaternion[T]) SetOrientation ¶ added in v1.1.0
func (q *Quaternion[T]) SetOrientation(origin *Vec3[T], target *Vec3[T])
SetOrientation overwrites the current quaternion with a quaternion which rotates from the provided source vector to the provided target vector
origin - A unit vector indicating the starting direction of the rotation
target - A unit vector indicating the target direction of the rotation
func (*Quaternion[T]) SetQuaternion ¶
func (q *Quaternion[T]) SetQuaternion(other *Quaternion[T])
SetQuaternion overwrites the current quaternion with the contents of the provided quaternion
other - The quaternion to initialize from
func (*Quaternion[T]) SetRotationAroundAxis ¶ added in v1.1.0
func (q *Quaternion[T]) SetRotationAroundAxis(axis *Vec3[T], angle T)
SetRotationAroundAxis overwrites the current contents of this quaternion with a quaternion that rotates around the provided axis by the provided angle in radians.
axis - A 3-element vector that is normal to the angle of rotation. It does not need to be normalized.
angleRad - The amount to rotate in radians
func (*Quaternion[T]) SetRotationEulers ¶ added in v1.1.0
func (q *Quaternion[T]) SetRotationEulers(rollRad, yawRad, pitchRad float64)
SetRotationEulers overwrites the current contents of this quaternion with quaternion that rotates first by yaw (y rotation), then by pitch (x rotation), and then by roll (z rotation)
yawRad - Angle to rotate yaw in radians
pitchRad - Angle to rotate pitch in radians
rollRad - Angle to rotate roll in radians
func (*Quaternion[T]) SetRotationX ¶ added in v1.1.0
func (q *Quaternion[T]) SetRotationX(angle T)
SetRotationX overwrites the current contents of this quaternion with a quaternion that rotates around the x axis by the specified amount
pitchRad - The angle to rotate around the x axis in radians
func (*Quaternion[T]) SetRotationY ¶ added in v1.1.0
func (q *Quaternion[T]) SetRotationY(angle T)
SetRotationY overwrites the current contents of this quaternion with a quaternion that rotates around the y axis by the specified amount
yawRad - The angle to rotate around the y axis in radians
func (*Quaternion[T]) SetRotationZ ¶ added in v1.1.0
func (q *Quaternion[T]) SetRotationZ(angle T)
SetRotationZ overwrites the current contents of this quaternion with a quaternion that rotates around the z axis by the specified amount
rollRad - The angle to rotate around the z axis in radians
func (*Quaternion[T]) SetSlerp ¶
func (q *Quaternion[T]) SetSlerp(lhs, rhs *Quaternion[T], delta T)
SetSlerp performs a spherical linear interpolation at constant speed between two quaternions and overwrites the current quaternion with the result.
lhs - The origin quaternion in the interpolation
rhs - The target quaternion in the interpolation
delta - The mix factor between the two quaternions- this can be any value: between 0 and 1, the interpolation will move linearly from the lhs to the rhs quaternion. Beyond those bounds, the interpolation oscillates between the two values
func (*Quaternion[T]) SetSquad ¶
func (q *Quaternion[T]) SetSquad(keyframe1, keyframe2, control1, control2 *Quaternion[T], delta T)
SetSquad interpolates between two keyframes of a SQUAD (Spherical Quadrangle Interpolation) path/animation. It accepts two keyframes, and the control point quaternions that correspond to those keyframes, and produces a spline interpolation between the two keyframes.
keyframe1 - The first keyframe rotation to interpolate between
keyframe2 - The second keyframe rotation to interpolate between
control1 - The control point corresponding to the first keyframe. Can be produced with SetIntermediate
control2 - The control point corresponding to the second keyframe. Can be produced with SetIntermediate
delta - A value between 0 and 1 indicating how far to interpolate between the two keyframes
func (*Quaternion[T]) Slerp ¶
func (q *Quaternion[T]) Slerp(other *Quaternion[T], delta T)
Slerp performs a spherical linear interpolation at constant speed between this quaternion and another provided quaternion and updates this quaternion with the result
other - The target quaternion in the interpolation
delta - The mix factor between the two quaternions- this can be any value: between 0 and 1, the interpolation will move linearly from this quaternion to the other quaternion. Beyond those bounds, the interpolation oscillates between the two values
func (*Quaternion[T]) Yaw ¶
func (q *Quaternion[T]) Yaw() T
Yaw retrieves the scalar rotation, in radians, of the quaternion's euler yaw
type Vec2 ¶
type Vec2[T FloatingPoint] struct { X T Y T }
Vec2 is a two-element vector of floating point compatible values that can be used for 2d vector arithmetic
func (*Vec2[T]) AddVec2 ¶
AddVec2 adds another provided vector to this one and updates this vector with the results
other - The right operand in the add operation
func (*Vec2[T]) DotProduct ¶
DotProduct calculates and returns the dot product of this vector and another provided vector
other - The right operand in the dot product operation
func (*Vec2[T]) Equal ¶
Equal returns true if every entry in this vector is equal to every entry in the provided vector
other - The vector to compare this vector to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Vec2[T]) LenSqr ¶
func (v *Vec2[T]) LenSqr() T
LenSqr calculates the length-squared of this vector. It is more performant than Len, owing to not requiring a math.Sqrt call, and may be preferable in cases when only the relative length of two vectors is required, or when comparing the length to 0 or 1
func (*Vec2[T]) Lerp ¶
Lerp interpolates between this vector and another provided vector, updating this vector to the results of the interpolation
other - The target vector in the interpolation operation
delta - A value between 0 and 1 indicating how far to interpolate between the two vectors
func (*Vec2[T]) Normalize ¶
func (v *Vec2[T]) Normalize()
Normalize converts this vector into a unit vector
func (*Vec2[T]) Rotate ¶
Rotate rotates this vector around the origin by the provided angle
angleRad - The angle to rotate, in radians
func (*Vec2[T]) Scale ¶
func (v *Vec2[T]) Scale(scale T)
Scale multiplies this vector by the provided scalar factor
scale - The scalar to multiply this vector by
func (*Vec2[T]) SetHomogenousVec3 ¶
SetHomogenousVec3 overwrites the contents of this vector with the first two elements of a 3-element vector, divided by the third element
in - The vector to initialize from
func (*Vec2[T]) SetHomogenousVec4 ¶
SetHomogenousVec4 overwrites the contents of this vector with the first two elements of a 4-element vector, divided by the fourth element
in - The vector to initialize from
func (*Vec2[T]) SetVec2 ¶
SetVec2 overwrites the contents of this vector with the contents of a 2-element vector
in - The vector to initialize from
func (*Vec2[T]) SetVec3 ¶
SetVec3 overwrites the contents of this vector with the first two elements of a 3-element vector
in - The vector to initialize from
func (*Vec2[T]) SetVec4 ¶
SetVec4 overwrites the contents of this vector with the first two elements of a 4-element vector
in - The vector to initialize from
func (*Vec2[T]) SubtractVec2 ¶
SubtractVec2 subtracts another provided vector from this one and updates this vector with the results
other - The right operand in the subtract operation
func (*Vec2[T]) Transform ¶
Transform multiplies this vector through the provided 2x2 transform matrix
m - The transform matrix used to transform this vector
func (*Vec2[T]) TransformHomogenous ¶
TransformHomogenous multiplies this vector through the provided 3x3 transform matrix and updates this 2d vector with the results by performing a homogenous divide
m - The transform matrix used to transform this vector
type Vec3 ¶
type Vec3[T FloatingPoint] struct { X T Y T Z T }
Vec3 is a three-element vector of floating point compatible values that can be used for 3d vector arithmetic and transforms
func (*Vec3[T]) AddVec3 ¶
AddVec3 adds another provided vector to this one and updates this vector with the results
other - The right operand in the add operation
func (*Vec3[T]) CrossProduct ¶
CrossProduct calculates the cross product of this vector and another provided vector and updates this vector to the calculated cross product
other - The right operand of the cross product operation
func (*Vec3[T]) DotProduct ¶
DotProduct calculates and returns the dot product of this vector and another provided vector
other - The right operand in the dot product operation
func (*Vec3[T]) Equal ¶
Equal returns true if every entry in this vector is equal to every entry in the provided vector
other - The vector to compare this vector to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Vec3[T]) LenSqr ¶
func (v *Vec3[T]) LenSqr() T
LenSqr calculates the length-squared of this vector. It is more performant than Len, owing to not requiring a math.Sqrt call, and may be preferable in cases when only the relative length of two vectors is required, or when comparing the length to 0 or 1
func (*Vec3[T]) Lerp ¶
Lerp interpolates between this vector and another provided vector, updating this vector to the results of the interpolation
other - The target vector in the interpolation operation
delta - A value between 0 and 1 indicating how far to interpolate between the two vectors
func (*Vec3[T]) Normalize ¶
func (v *Vec3[T]) Normalize()
Normalize converts this vector into a unit vector
func (*Vec3[T]) Orthonormalize ¶
Orthonormalize adjusts this vector to be a unit vector that lies orthogonal to the provided vector
other - The vector that this vector will lie orthogonal to after the operation
func (*Vec3[T]) Rotate ¶
Rotate rotates this vector around the provided axis by the provided angle
angleRad - The amount to rotate this vector, in radians
axis - The axis to rotate this vector around
func (*Vec3[T]) RotateWithQuaternion ¶
func (v *Vec3[T]) RotateWithQuaternion(q *Quaternion[T])
RotateWithQuaternion rotates this vector with the provided quaternion
q - The quaternion to rotate this vector with
func (*Vec3[T]) RotateX ¶
RotateX rotates this vector around the x axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) RotateY ¶
RotateY rotates this vector around the y axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) RotateZ ¶
RotateZ rotates this vector around the z axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) Scale ¶
func (v *Vec3[T]) Scale(scale T)
Scale multiplies this vector by the provided scalar factor
scale - The scalar to multiply this vector by
func (*Vec3[T]) SetAddVec3 ¶
SetAddVec3 overwrites the contents of this vector with the results of adding two provided vectors
lhs - The left operand of the cross product operation
rhs - The right operand of the cross product operation
func (*Vec3[T]) SetClosestPointOnLine ¶
SetClosestPointOnLine overwrites the contents of this vector with the point on the line that includes both endpoint1 and endpoint2 that falls closest to the provided point
point - The point to locate the closest position to
endpoint1 - The first point of the line the result will fall along
endpoint2 - The second point of the line the result will fall along
func (*Vec3[T]) SetCrossProduct ¶
SetCrossProduct overwrites the contents of this vector with the cross product of two provided vectors
lhs - The left operand of the cross product operation
rhs - The right operand of the cross product operation
func (*Vec3[T]) SetHomogenousVec4 ¶
SetHomogenousVec4 overwrites the contents of this vector with the first three elements of a 4-element vector, divided by the fourth element
in - The vector to initialize from
func (*Vec3[T]) SetLerp ¶
SetLerp overwrites the contents of this vector with the results of linear interpolation between two provided 3-element vectors
lhs - The source vector in the interpolation operation
rhs - The target vector in the interpolation operation
delta - A value between 0 and 1 indicating how far to interpolate between the two vectors
func (*Vec3[T]) SetNormalizeVec3 ¶
SetNormalizeVec3 overwrites the contents of this vector with the results of normalizing a provided 3-element vector
input - The vector to be normalized
func (*Vec3[T]) SetRotate ¶
SetRotate overwrites the contents of this vector with the results of rotating a provided 3-element vector around a provided axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
axis - The axis around which to rotate the vector
func (*Vec3[T]) SetRotateWithQuaternion ¶
func (v *Vec3[T]) SetRotateWithQuaternion(input *Vec3[T], q *Quaternion[T])
SetRotateWithQuaternion overwrites the contents of this vector with the results of rotating a provided 3-element vector through a provided quaternion.
input - The vector to be rotated
q - The quaternion to be used in the rotation
func (*Vec3[T]) SetRotateX ¶
SetRotateX overwrites the contents of this vector with the results of rotating a provided 3-element vector around the x axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) SetRotateY ¶
SetRotateY overwrites the contents of this vector with the results of rotating a provided 3-element vector around the y axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) SetRotateZ ¶
SetRotateZ overwrites the contents of this vector with the results of rotating a provided 3-element vector around the z axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec3[T]) SetScale ¶ added in v1.1.0
SetScale overwrites the contents of this vector with the provided vector multiplied by the provided scalar
input - The vector to scale
scale - The scalar t multiply with the vector
func (*Vec3[T]) SetSubtractVec3 ¶
SetSubtractVec3 overwrites the contents of this vector with the results of subtracting two provided vectors
lhs - The left operand of the cross product operation
rhs - The right operand of the cross product operation
func (*Vec3[T]) SetTransform ¶
SetTransform overwrites the contents of this vector with the results of multiplying a provided vector through a provided 3x3 transform matrix
input - The vector to be transformed
m - The transform matrix to be used in the transform
func (*Vec3[T]) SetTransformHomogenous ¶
SetTransformHomogenous overwrites the contents of this vector with the results of multiplying a provided 3-element vector through a provided 4x4 transform matrix. During the multiplication, the value 1 will be used as a fourth vector element, and when overwriting the vector contents, the 3 assigned elements will be divided by the 4th element output from the transform.
input - The vector to be transformed
m - The transform matrix to be used in the transform
func (*Vec3[T]) SetTriangleNormal ¶
SetTriangleNormal overwrites the contents of this vector with the unit normal of a triangle represented by the provided points. This method assumes a counter-clockwise winding order.
point1 - The first point of the triangle
point2 - The second point of the triangle
point3 - The third point of the triangle
func (*Vec3[T]) SetVec2 ¶
SetVec2 overwrites the first two elements of this vector with the first two elements of a 2-element vector. The third element of this vector is set to 0.
in - The vector to initialize from
func (*Vec3[T]) SetVec3 ¶
SetVec3 overwrites the contents of this vector with the contents of a 3-element vector
in - The vector to initialize from
func (*Vec3[T]) SetVec4 ¶
SetVec4 overwrites the contents of this vector with the first three elements of a 4-element vector
in - The vector to initialize from
func (*Vec3[T]) SubtractVec3 ¶
SubtractVec3 subtracts another provided vector from this one and updates this vector with the results
other - The right operand in the subtract operation
func (*Vec3[T]) Transform ¶
Transform multiplies this vector through the provided transform matrix and updates the vector with the result
m - The 3x3 matrix to transform this matrix through
func (*Vec3[T]) TransformHomogenous ¶
TransformHomogenous performs a transform with a provided 4x4 matrix. During the transform, the value 1 is provided as the 4th vector element and a homogenous divide is performed on the results. This vector is updated with the output.
m - The 4x4 matrix to transform this matrix through
type Vec4 ¶
type Vec4[T FloatingPoint] struct { X T Y T Z T W T }
Vec4 is a three-element vector of floating point compatible values that can be used for 3d vector arithmetic and transforms
func (*Vec4[T]) AddVec4 ¶
AddVec4 adds another provided vector to this one and updates this vector with the results
other - The right operand in the add operation
func (*Vec4[T]) DotProduct ¶
DotProduct calculates and returns the dot product of this vector and another provided vector
other - The right operand in the dot product operation
func (*Vec4[T]) Equal ¶
Equal returns true if every entry in this vector is equal to every entry in the provided vector
other - The vector to compare this vector to
epsilon - The epsilon value to use in floating point comparisons. This much floating point drift is permitted before the method returns false. 0.0001 is a common epsilon value
func (*Vec4[T]) LenSqr ¶
func (v *Vec4[T]) LenSqr() T
LenSqr calculates the length-squared of this vector. It is more performant than Len, owing to not requiring a math.Sqrt call, and may be preferable in cases when only the relative length of two vectors is required, or when comparing the length to 0 or 1
func (*Vec4[T]) Lerp ¶
Lerp interpolates between this vector and another provided vector, updating this vector to the results of the interpolation
other - The target vector in the interpolation operation
delta - A value between 0 and 1 indicating how far to interpolate between the two vectors
func (*Vec4[T]) Normalize ¶
func (v *Vec4[T]) Normalize()
Normalize converts this vector into a unit vector
func (*Vec4[T]) Rotate ¶
Rotate rotates this vector around the provided axis by the provided angle
angleRad - The amount to rotate this vector, in radians
axis - The axis to rotate this vector around
func (*Vec4[T]) RotateWithQuaternion ¶
func (v *Vec4[T]) RotateWithQuaternion(q *Quaternion[T])
RotateWithQuaternion rotates this vector with the provided quaternion
q - The quaternion to rotate this vector with
func (*Vec4[T]) RotateX ¶
RotateX rotates this vector around the x axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) RotateY ¶
RotateY rotates this vector around the y axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) RotateZ ¶
RotateZ rotates this vector around the z axis by a provided angle
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) Scale ¶
func (v *Vec4[T]) Scale(scale T)
Scale multiplies this vector by the provided scalar factor
scale - The scalar to multiply this vector by
func (*Vec4[T]) SetAddVec4 ¶
SetAddVec4 overwrites the contents of this vector with the results of adding two provided vectors
lhs - The left operand of the cross product operation
rhs - The right operand of the cross product operation
func (*Vec4[T]) SetLerp ¶
SetLerp overwrites the contents of this vector with the results of linear interpolation between two provided vectors
lhs - The source vector in the interpolation operation
rhs - The target vector in the interpolation operation
delta - A value between 0 and 1 indicating how far to interpolate between the two vectors
func (*Vec4[T]) SetNormalizeVec4 ¶
SetNormalizeVec4 overwrites the contents of this vector with the results of normalizing a provided 4-element vector
input - The vector to be normalized
func (*Vec4[T]) SetRotate ¶
SetRotate overwrites the contents of this vector with the results of rotating a provided vector around a provided axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
axis - The axis around which to rotate the vector
func (*Vec4[T]) SetRotateWithQuaternion ¶
func (v *Vec4[T]) SetRotateWithQuaternion(input *Vec4[T], q *Quaternion[T])
SetRotateWithQuaternion overwrites the contents of this vector with the results of rotating a provided vector through a provided quaternion.
input - The vector to be rotated
q - The quaternion to be used in the rotation
func (*Vec4[T]) SetRotateX ¶
SetRotateX overwrites the contents of this vector with the results of rotating a provided vector around the x axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) SetRotateY ¶
SetRotateY overwrites the contents of this vector with the results of rotating a provided vector around the y axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) SetRotateZ ¶
SetRotateZ overwrites the contents of this vector with the results of rotating a provided vector around the z axis by a provided angle
input - The vector to be rotated
angleRad - The amount to rotate the vector, in radians
func (*Vec4[T]) SetScale ¶
SetScale overwrites the contents of this vector with the provided vector multiplied by the provided scalar
input - The vector to scale
scale - The scalar t multiply with the vector
func (*Vec4[T]) SetSubtractVec4 ¶
SetSubtractVec4 overwrites the contents of this vector with the results of subtracting two provided vectors
lhs - The left operand of the cross product operation
rhs - The right operand of the cross product operation
func (*Vec4[T]) SetTransform ¶
SetTransform overwrites the contents of this vector with the results of multiplying a provided vector through a provided transform matrix
input - The vector to be transformed
m - The transform matrix to be used in the transform
func (*Vec4[T]) SetTransformHomogenous ¶
SetTransformHomogenous overwrites the contents of this vector with the results of multiplying a provided vector through a provided transform matrix. A homogenous divide will be performed on the results of the transform.
input - The vector to be transformed
m - The transform matrix to be used in the transform
func (*Vec4[T]) SetVec2 ¶
SetVec2 overwrites the first two elements of this vector with the first two elements of a 2-element vector. The third element of this vector is set to 0 and the fourth is set to 1.
in - The vector to initialize from
func (*Vec4[T]) SetVec3 ¶
SetVec3 overwrites the first three elements of this vector with the first three elements of a 3-element vector. The fourth element of this vector is set to 1.
in - The vector to initialize from
func (*Vec4[T]) SetVec4 ¶
SetVec4 overwrites the contents of this vector with the contents of a 4-element vector
in - The vector to initialize from
func (*Vec4[T]) SubtractVec4 ¶
SubtractVec4 subtracts another provided vector from this one and updates this vector with the results
other - The right operand in the subtract operation
func (*Vec4[T]) Transform ¶
Transform multiplies this vector through the provided transform matrix and updates the vector with the result
m - The 4x4 matrix to transform this matrix through
func (*Vec4[T]) TransformHomogenous ¶
TransformHomogenous performs a transform with a provided 4x4 matrix. After the transform, a homogenous divide is performed on the results. This vector is updated with the output.
m - The 4x4 matrix to transform this matrix through