Documentation ¶
Overview ¶
Package dprec represents a mathematics library for working with double precision types.
Index ¶
- Constants
- func Abs(value float64) float64
- func Clamp(value, min, max float64) float64
- func Cos(angle Angle) float64
- func Eq(a, b float64) bool
- func EqEps(a, b, epsilon float64) bool
- func Max(a, b float64) float64
- func Min(a, b float64) float64
- func Mix(a, b, amount float64) float64
- func QuatDot(a, b Quat) float64
- func Sign(value float64) float64
- func Sin(angle Angle) float64
- func Sqrt(value float64) float64
- func Tan(angle Angle) float64
- func Vec2Dot(a, b Vec2) float64
- func Vec3Dot(a, b Vec3) float64
- func Vec4Dot(a, b Vec4) float64
- type Angle
- type Mat3
- func ColumnMajorArrayToMat3(values [16]float64) Mat3
- func FastInverseMat3(m Mat3) Mat3
- func IdentityMat3() Mat3
- func InverseMat3(m Mat3) Mat3
- func Mat3MultiProd(first Mat3, others ...Mat3) Mat3
- func Mat3Prod(left, right Mat3) Mat3
- func NewMat3(m11, m12, m13 float64, m21, m22, m23 float64, m31, m32, m33 float64) Mat3
- func OrthoMat3(left, right, top, bottom float64) Mat3
- func RotationMat3(angle Angle) Mat3
- func RowMajorArrayToMat3(values [16]float64) Mat3
- func ScaleMat3(x, y float64) Mat3
- func TransformationMat3(orientX, orientY, translation Vec2) Mat3
- func TranslationMat3(x, y float64) Mat3
- func ZeroMat3() Mat3
- func (m Mat3) Column1() Vec3
- func (m Mat3) Column2() Vec3
- func (m Mat3) Column3() Vec3
- func (m Mat3) ColumnMajorArray() [9]float64
- func (m Mat3) GoString() string
- func (m Mat3) OrientationX() Vec2
- func (m Mat3) OrientationY() Vec2
- func (m Mat3) Row1() Vec3
- func (m Mat3) Row2() Vec3
- func (m Mat3) Row3() Vec3
- func (m Mat3) RowMajorArray() [9]float64
- func (m Mat3) Translation() Vec2
- type Mat4
- func ColumnMajorArrayToMat4(values [16]float64) Mat4
- func FastInverseMat4(m Mat4) Mat4
- func IdentityMat4() Mat4
- func InverseMat4(m Mat4) Mat4
- func Mat4MultiProd(first Mat4, others ...Mat4) Mat4
- func Mat4Prod(left, right Mat4) Mat4
- func NewMat4(m11, m12, m13, m14 float64, m21, m22, m23, m24 float64, ...) Mat4
- func OrientationMat4(orientX, orientY, orientZ Vec3) Mat4
- func OrthoMat4(left, right, top, bottom, near, far float64) Mat4
- func PerspectiveMat4(left, right, bottom, top, near, far float64) Mat4
- func RotationMat4(angle Angle, x, y, z float64) Mat4
- func RowMajorArrayToMat4(values [16]float64) Mat4
- func ScaleMat4(x, y, z float64) Mat4
- func TRSMat4(translation Vec3, rotation Quat, scale Vec3) Mat4
- func TransformationMat4(orientX, orientY, orientZ, translation Vec3) Mat4
- func TranslationMat4(x, y, z float64) Mat4
- func ZeroMat4() Mat4
- func (m Mat4) Column1() Vec4
- func (m Mat4) Column2() Vec4
- func (m Mat4) Column3() Vec4
- func (m Mat4) Column4() Vec4
- func (m Mat4) ColumnMajorArray() [16]float64
- func (m Mat4) GoString() string
- func (m Mat4) OrientationX() Vec3
- func (m Mat4) OrientationY() Vec3
- func (m Mat4) OrientationZ() Vec3
- func (m Mat4) RotationQuat() Quat
- func (m Mat4) Row1() Vec4
- func (m Mat4) Row2() Vec4
- func (m Mat4) Row3() Vec4
- func (m Mat4) Row4() Vec4
- func (m Mat4) RowMajorArray() [16]float64
- func (m Mat4) Scale() Vec3
- func (m Mat4) Translation() Vec3
- type Quat
- func ConjugateQuat(q Quat) Quat
- func IdentityQuat() Quat
- func InverseQuat(q Quat) Quat
- func NegativeQuat(q Quat) Quat
- func NewQuat(w, x, y, z float64) Quat
- func QuatDiff(second, first Quat, shortest bool) Quat
- func QuatLerp(first, second Quat, t float64) Quat
- func QuatPow(q Quat, pow float64) Quat
- func QuatProd(first, second Quat) Quat
- func QuatScalarProd(q Quat, value float64) Quat
- func QuatScalarQuot(q Quat, value float64) Quat
- func QuatSlerp(first, second Quat, t float64) Quat
- func RotationQuat(angle Angle, direction Vec3) Quat
- func UnitQuat(q Quat) Quat
- type Vec2
- func ArrayToVec2(array [2]float64) Vec2
- func BasisXVec2() Vec2
- func BasisYVec2() Vec2
- func InverseVec2(vector Vec2) Vec2
- func NewVec2(x, y float64) Vec2
- func ResizedVec2(vector Vec2, newLength float64) Vec2
- func UnitVec2(vector Vec2) Vec2
- func Vec2Diff(a, b Vec2) Vec2
- func Vec2Lerp(a, b Vec2, t float64) Vec2
- func Vec2Prod(vector Vec2, value float64) Vec2
- func Vec2Quot(vector Vec2, value float64) Vec2
- func Vec2Sum(a, b Vec2) Vec2
- func ZeroVec2() Vec2
- type Vec3
- func ArrayToVec3(array [3]float64) Vec3
- func BasisXVec3() Vec3
- func BasisYVec3() Vec3
- func BasisZVec3() Vec3
- func InverseVec3(vector Vec3) Vec3
- func Mat3Vec3Prod(mat Mat3, vec Vec3) Vec3
- func Mat4Vec3Transformation(mat Mat4, vec Vec3) Vec3
- func NewVec3(x, y, z float64) Vec3
- func QuatVec3Rotation(q Quat, v Vec3) Vec3
- func ResizedVec3(vector Vec3, newLength float64) Vec3
- func UnitVec3(vector Vec3) Vec3
- func Vec3Cross(a, b Vec3) Vec3
- func Vec3Diff(a, b Vec3) Vec3
- func Vec3Lerp(a, b Vec3, t float64) Vec3
- func Vec3Prod(vector Vec3, value float64) Vec3
- func Vec3Quot(vector Vec3, value float64) Vec3
- func Vec3Sum(a, b Vec3) Vec3
- func ZeroVec3() Vec3
- type Vec4
- func ArrayToVec4(array [4]float64) Vec4
- func InverseVec4(vector Vec4) Vec4
- func Mat4Vec4Prod(mat Mat4, vec Vec4) Vec4
- func NewVec4(x, y, z, w float64) Vec4
- func Vec4Diff(a, b Vec4) Vec4
- func Vec4Lerp(a, b Vec4, t float64) Vec4
- func Vec4Prod(vector Vec4, value float64) Vec4
- func Vec4Quot(vector Vec4, value float64) Vec4
- func Vec4Sum(a, b Vec4) Vec4
- func ZeroVec4() Vec4
Constants ¶
const ( Pi = float64(math.Pi) Epsilon = float64(0.000000000001) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mat3 ¶
func ColumnMajorArrayToMat3 ¶ added in v0.3.0
func FastInverseMat3 ¶
FastInverseMat3 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 InverseMat3 method should be used instead, though it will be slower.
func IdentityMat3 ¶
func IdentityMat3() Mat3
func InverseMat3 ¶
InverseMat3 calculates the inverse of the matrix.
The behavior is undefined if the matrix is not reversible (i.e. has a zero determinant).
func Mat3MultiProd ¶
func RotationMat3 ¶
func RowMajorArrayToMat3 ¶ added in v0.3.0
func TransformationMat3 ¶
func TranslationMat3 ¶
func (Mat3) ColumnMajorArray ¶ added in v0.3.0
func (Mat3) OrientationX ¶
func (Mat3) OrientationY ¶
func (Mat3) RowMajorArray ¶ added in v0.3.0
func (Mat3) Translation ¶
type Mat4 ¶
type Mat4 struct {
M11, M12, M13, M14 float64
M21, M22, M23, M24 float64
M31, M32, M33, M34 float64
M41, M42, M43, M44 float64
}
func ColumnMajorArrayToMat4 ¶ added in v0.3.0
func FastInverseMat4 ¶
FastInverseMat4 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 InverseMat4 method should be used instead, though it will be slower.
func IdentityMat4 ¶
func IdentityMat4() Mat4
func InverseMat4 ¶
InverseMat4 calculates the inverse of the matrix.
The behavior is undefined if the matrix is not reversible (i.e. has a zero determinant).
func Mat4MultiProd ¶
func OrientationMat4 ¶
func PerspectiveMat4 ¶
func RotationMat4 ¶
func RowMajorArrayToMat4 ¶ added in v0.3.0
func TransformationMat4 ¶
func TranslationMat4 ¶
func (Mat4) ColumnMajorArray ¶
func (Mat4) OrientationX ¶
func (Mat4) OrientationY ¶
func (Mat4) OrientationZ ¶
func (Mat4) RotationQuat ¶ added in v0.2.0
func (Mat4) RowMajorArray ¶
func (Mat4) Translation ¶
type Quat ¶
func ConjugateQuat ¶
func IdentityQuat ¶
func IdentityQuat() Quat
func InverseQuat ¶
func NegativeQuat ¶ added in v0.4.0
func QuatScalarProd ¶
func QuatScalarQuot ¶
func RotationQuat ¶
func (Quat) OrientationX ¶
func (Quat) OrientationY ¶
func (Quat) OrientationZ ¶
type Vec2 ¶
func ArrayToVec2 ¶ added in v0.3.0
func BasisXVec2 ¶
func BasisXVec2() Vec2
func BasisYVec2 ¶
func BasisYVec2() Vec2
func InverseVec2 ¶
func ResizedVec2 ¶
type Vec3 ¶
func ArrayToVec3 ¶ added in v0.3.0
func BasisXVec3 ¶
func BasisXVec3() Vec3
func BasisYVec3 ¶
func BasisYVec3() Vec3
func BasisZVec3 ¶
func BasisZVec3() Vec3