Documentation ¶
Overview ¶
Package vpmat4x4 contains 4x4 matrix utilities.
Index ¶
- Constants
- type F32
- func F32Add(mata, matb *F32) *F32
- func F32DivScale(mat *F32, factor float32) *F32
- func F32Identity() *F32
- func F32Inv(mat *F32) *F32
- func F32MulComp(a, b *F32) *F32
- func F32MulScale(mat *F32, factor float32) *F32
- func F32New(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16 float32) *F32
- func F32Ortho(left, right, bottom, top, nearVal, farVal float32) *F32
- func F32Perspective(fovy, aspect, zNear, zFar float32) *F32
- func F32RebaseOXYZ(Origin, PosX, PosY, PosZ *vpvec3.F32) *F32
- func F32RebaseOXYZP(Origin, PosX, PosY, PosZ, PosP *vpvec3.F32) *F32
- func F32RotX(r float32) *F32
- func F32RotY(r float32) *F32
- func F32RotZ(r float32) *F32
- func F32Scale(vec *vpvec3.F32) *F32
- func F32Sub(mata, matb *F32) *F32
- func F32Translation(vec *vpvec3.F32) *F32
- func F32Transpose(mat *F32) *F32
- func (mat *F32) Add(op *F32) *F32
- func (mat *F32) Det() float32
- func (mat *F32) DivScale(factor float32) *F32
- func (mat *F32) Get(col, row int) float32
- func (mat *F32) GetCol(col int) *vpvec4.F32
- func (mat *F32) GetRow(row int) *vpvec4.F32
- func (mat *F32) Inv() *F32
- func (mat *F32) IsSimilar(op *F32) bool
- func (mat *F32) MarshalJSON() ([]byte, error)
- func (mat *F32) MulComp(op *F32) *F32
- func (mat *F32) MulScale(factor float32) *F32
- func (mat *F32) MulVec(vec *vpvec4.F32) *vpvec4.F32
- func (mat *F32) MulVecDir(vec *vpvec3.F32) *vpvec3.F32
- func (mat *F32) MulVecPos(vec *vpvec3.F32) *vpvec3.F32
- func (mat *F32) Set(col, row int, val float32)
- func (mat *F32) SetCol(col int, vec *vpvec4.F32)
- func (mat *F32) SetRow(row int, vec *vpvec4.F32)
- func (mat *F32) String() string
- func (mat *F32) Sub(op *F32) *F32
- func (mat *F32) ToF64() *F64
- func (mat *F32) ToX32() *X32
- func (mat *F32) ToX64() *X64
- func (mat *F32) Transpose(op *F32) *F32
- func (mat *F32) UnmarshalJSON(data []byte) error
- type F64
- func F64Add(mata, matb *F64) *F64
- func F64DivScale(mat *F64, factor float64) *F64
- func F64Identity() *F64
- func F64Inv(mat *F64) *F64
- func F64MulComp(a, b *F64) *F64
- func F64MulScale(mat *F64, factor float64) *F64
- func F64New(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16 float64) *F64
- func F64Ortho(left, right, bottom, top, nearVal, farVal float64) *F64
- func F64Perspective(fovy, aspect, zNear, zFar float64) *F64
- func F64RebaseOXYZ(Origin, PosX, PosY, PosZ *vpvec3.F64) *F64
- func F64RebaseOXYZP(Origin, PosX, PosY, PosZ, PosP *vpvec3.F64) *F64
- func F64RotX(r float64) *F64
- func F64RotY(r float64) *F64
- func F64RotZ(r float64) *F64
- func F64Scale(vec *vpvec3.F64) *F64
- func F64Sub(mata, matb *F64) *F64
- func F64Translation(vec *vpvec3.F64) *F64
- func F64Transpose(mat *F64) *F64
- func (mat *F64) Add(op *F64) *F64
- func (mat *F64) Det() float64
- func (mat *F64) DivScale(factor float64) *F64
- func (mat *F64) Get(col, row int) float64
- func (mat *F64) GetCol(col int) *vpvec4.F64
- func (mat *F64) GetRow(row int) *vpvec4.F64
- func (mat *F64) Inv() *F64
- func (mat *F64) IsSimilar(op *F64) bool
- func (mat *F64) MarshalJSON() ([]byte, error)
- func (mat *F64) MulComp(op *F64) *F64
- func (mat *F64) MulScale(factor float64) *F64
- func (mat *F64) MulVec(vec *vpvec4.F64) *vpvec4.F64
- func (mat *F64) MulVecDir(vec *vpvec3.F64) *vpvec3.F64
- func (mat *F64) MulVecPos(vec *vpvec3.F64) *vpvec3.F64
- func (mat *F64) Set(col, row int, val float64)
- func (mat *F64) SetCol(col int, vec *vpvec4.F64)
- func (mat *F64) SetRow(row int, vec *vpvec4.F64)
- func (mat *F64) String() string
- func (mat *F64) Sub(op *F64) *F64
- func (mat *F64) ToF32() *F32
- func (mat *F64) ToX32() *X32
- func (mat *F64) ToX64() *X64
- func (mat *F64) Transpose(op *F64) *F64
- func (mat *F64) UnmarshalJSON(data []byte) error
- type X32
- func X32Add(mata, matb *X32) *X32
- func X32DivScale(mat *X32, factor vpnumber.X32) *X32
- func X32Identity() *X32
- func X32Inv(mat *X32) *X32
- func X32MulComp(a, b *X32) *X32
- func X32MulScale(mat *X32, factor vpnumber.X32) *X32
- func X32New(...) *X32
- func X32Ortho(left, right, bottom, top, nearVal, farVal vpnumber.X32) *X32
- func X32Perspective(fovy, aspect, zNear, zFar vpnumber.X32) *X32
- func X32RebaseOXYZ(Origin, PosX, PosY, PosZ *vpvec3.X32) *X32
- func X32RebaseOXYZP(Origin, PosX, PosY, PosZ, PosP *vpvec3.X32) *X32
- func X32RotX(r vpnumber.X32) *X32
- func X32RotY(r vpnumber.X32) *X32
- func X32RotZ(r vpnumber.X32) *X32
- func X32Scale(vec *vpvec3.X32) *X32
- func X32Sub(mata, matb *X32) *X32
- func X32Translation(vec *vpvec3.X32) *X32
- func X32Transpose(mat *X32) *X32
- func (mat *X32) Add(op *X32) *X32
- func (mat *X32) Det() vpnumber.X32
- func (mat *X32) DivScale(factor vpnumber.X32) *X32
- func (mat *X32) Get(col, row int) vpnumber.X32
- func (mat *X32) GetCol(col int) *vpvec4.X32
- func (mat *X32) GetRow(row int) *vpvec4.X32
- func (mat *X32) Inv() *X32
- func (mat *X32) IsSimilar(op *X32) bool
- func (mat *X32) MarshalJSON() ([]byte, error)
- func (mat *X32) MulComp(op *X32) *X32
- func (mat *X32) MulScale(factor vpnumber.X32) *X32
- func (mat *X32) MulVec(vec *vpvec4.X32) *vpvec4.X32
- func (mat *X32) MulVecDir(vec *vpvec3.X32) *vpvec3.X32
- func (mat *X32) MulVecPos(vec *vpvec3.X32) *vpvec3.X32
- func (mat *X32) Set(col, row int, val vpnumber.X32)
- func (mat *X32) SetCol(col int, vec *vpvec4.X32)
- func (mat *X32) SetRow(row int, vec *vpvec4.X32)
- func (mat *X32) String() string
- func (mat *X32) Sub(op *X32) *X32
- func (mat *X32) ToF32() *F32
- func (mat *X32) ToF64() *F64
- func (mat *X32) ToX64() *X64
- func (mat *X32) Transpose(op *X32) *X32
- func (mat *X32) UnmarshalJSON(data []byte) error
- type X64
- func X64Add(mata, matb *X64) *X64
- func X64DivScale(mat *X64, factor vpnumber.X64) *X64
- func X64Identity() *X64
- func X64Inv(mat *X64) *X64
- func X64MulComp(a, b *X64) *X64
- func X64MulScale(mat *X64, factor vpnumber.X64) *X64
- func X64New(...) *X64
- func X64Ortho(left, right, bottom, top, nearVal, farVal vpnumber.X64) *X64
- func X64Perspective(fovy, aspect, zNear, zFar vpnumber.X64) *X64
- func X64RebaseOXYZ(Origin, PosX, PosY, PosZ *vpvec3.X64) *X64
- func X64RebaseOXYZP(Origin, PosX, PosY, PosZ, PosP *vpvec3.X64) *X64
- func X64RotX(r vpnumber.X64) *X64
- func X64RotY(r vpnumber.X64) *X64
- func X64RotZ(r vpnumber.X64) *X64
- func X64Scale(vec *vpvec3.X64) *X64
- func X64Sub(mata, matb *X64) *X64
- func X64Translation(vec *vpvec3.X64) *X64
- func X64Transpose(mat *X64) *X64
- func (mat *X64) Add(op *X64) *X64
- func (mat *X64) Det() vpnumber.X64
- func (mat *X64) DivScale(factor vpnumber.X64) *X64
- func (mat *X64) Get(col, row int) vpnumber.X64
- func (mat *X64) GetCol(col int) *vpvec4.X64
- func (mat *X64) GetRow(row int) *vpvec4.X64
- func (mat *X64) Inv() *X64
- func (mat *X64) IsSimilar(op *X64) bool
- func (mat *X64) MarshalJSON() ([]byte, error)
- func (mat *X64) MulComp(op *X64) *X64
- func (mat *X64) MulScale(factor vpnumber.X64) *X64
- func (mat *X64) MulVec(vec *vpvec4.X64) *vpvec4.X64
- func (mat *X64) MulVecDir(vec *vpvec3.X64) *vpvec3.X64
- func (mat *X64) MulVecPos(vec *vpvec3.X64) *vpvec3.X64
- func (mat *X64) Set(col, row int, val vpnumber.X64)
- func (mat *X64) SetCol(col int, vec *vpvec4.X64)
- func (mat *X64) SetRow(row int, vec *vpvec4.X64)
- func (mat *X64) String() string
- func (mat *X64) Sub(op *X64) *X64
- func (mat *X64) ToF32() *F32
- func (mat *X64) ToF64() *F64
- func (mat *X64) ToX32() *X32
- func (mat *X64) Transpose(op *X64) *X64
- func (mat *X64) UnmarshalJSON(data []byte) error
Constants ¶
const ( // Col0Row0 is the index of column 0 row 0 in a 4x4 column-major matrix. Col0Row0 = iota // Col0Row1 is the index of column 0 row 1 in a 4x4 column-major matrix. Col0Row1 // Col0Row2 is the index of column 0 row 2 in a 4x4 column-major matrix. Col0Row2 // Col0Row3 is the index of column 0 row 3 in a 4x4 column-major matrix. Col0Row3 // Col1Row0 is the index of column 1 row 0 in a 4x4 column-major matrix. Col1Row0 // Col1Row1 is the index of column 1 row 1 in a 4x4 column-major matrix. Col1Row1 // Col1Row2 is the index of column 1 row 2 in a 4x4 column-major matrix. Col1Row2 // Col1Row3 is the index of column 1 row 3 in a 4x4 column-major matrix. Col1Row3 // Col2Row0 is the index of column 2 row 0 in a 4x4 column-major matrix. Col2Row0 // Col2Row1 is the index of column 2 row 1 in a 4x4 column-major matrix. Col2Row1 // Col2Row2 is the index of column 2 row 2 in a 4x4 column-major matrix. Col2Row2 // Col2Row3 is the index of column 2 row 3 in a 4x4 column-major matrix. Col2Row3 // Col3Row0 is the index of column 3 row 0 in a 4x4 column-major matrix. Col3Row0 // Col3Row1 is the index of column 3 row 1 in a 4x4 column-major matrix. Col3Row1 // Col3Row2 is the index of column 3 row 2 in a 4x4 column-major matrix. Col3Row2 // Col3Row3 is the index of column 3 row 3 in a 4x4 column-major matrix. Col3Row3 // Size is the number of elements in a 4x4 matrix. Size // Width is the width a 4x4 matrix (max column index is Width-1). Width = 4 // Height is the width a 4x4 matrix (max row index is Height-1). Height = 4 )
const PackageCopyright = "Copyright (C) 2015, 2016 Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh
PackageCopyright contains a short copyright notice.
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh
PackageEmail contains a contact email for the package.
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh
PackageLicense contains a short license information.
const PackageName = "Vapor Toolkit" // PackageName set by version.sh
PackageName contains a readable name of the package, suitable for display.
const PackageTarname = "vapor" // PackageTarname set by version.sh
PackageTarname contains a short name of the package, suitable for a filename.
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh
PackageURL contains the address of the project homepage.
const VersionMajor = 0 // VersionMajor set by version.sh
VersionMajor is the project major version.
const VersionMinor = 3 // VersionMinor set by version.sh
VersionMinor is the project minor version.
const VersionStamp = "c6a4298" // VersionStamp set by version.sh
VersionStamp is the project stamp, possibly changes for each build.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type F32 ¶
F32 is a matrix containing 4x4 float32 values. Can be used in 3D matrix transformations.
func F32Add ¶
F32Add adds two matrices. Args are left untouched, a pointer on a new object is returned.
func F32DivScale ¶
F32DivScale divides all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func F32Inv ¶
F32Inv inverts a matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. Args is left untouched, a pointer on a new object is returned.
func F32MulComp ¶
F32MulComp multiplies two matrices (composition). Args are left untouched, a pointer on a new object is returned.
func F32MulScale ¶
F32MulScale multiplies all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func F32New ¶
F32New creates a new matrix containing 4x4 float32 values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func F32Ortho ¶
F32Ortho creates a projection matrix the way the standard OpenGL glOrtho would (see https://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml). Note: use -nearVal and -farVal to initialize. It's a little akward, if you expect to pass vectors with positions ranging from nearVal to farVal then you need to pass -nearVal and -farVal to this function. This is probably due to the fact that with a right-handed basis and X,Y set up "as usual", then Z is negative when going farther and farther. This tweak allows farVal to yield +1 and nearVal -1. We keep this function as is here, as this is the way OpenGL functions seem to work.
func F32Perspective ¶
F32Perspective creates a projection matrix the way the standard GLU gluPerspective function would (see https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml). Beware, fovy is in degrees, not radians.
func F32RebaseOXYZ ¶
F32RebaseOXYZ creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func F32RebaseOXYZP ¶
F32RebaseOXYZP creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1), P=(1,1,1) basis to the given basis. Note that there can be a projection, so f(a+b) is not f(a)+f(b).
func F32RotX ¶
F32RotX creates a new rotation matrix. The rotation is done in 3D over the x (1st) axis. Angle is given in radians.
func F32RotY ¶
F32RotY creates a new rotation matrix. The rotation is done in 3D over the y (2nd) axis. Angle is given in radians.
func F32RotZ ¶
F32RotZ creates a new rotation matrix. The rotation is done in 3D over the z (3rd) axis. Angle is given in radians.
func F32Sub ¶
F32Sub substracts matrix b from matrix a. Args are left untouched, a pointer on a new object is returned.
func F32Translation ¶
F32Translation creates a new translation matrix.
func F32Transpose ¶
F32Transpose inverts rows and columns (matrix transposition). Args is left untouched, a pointer on a new object is returned.
func (*F32) Add ¶
Add adds operand to the matrix. It modifies the matrix, and returns a pointer on it.
func (*F32) DivScale ¶
DivScale divides all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*F32) Inv ¶
Inv inverts the matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. It modifies the matrix, and returns a pointer on it.
func (*F32) IsSimilar ¶
IsSimilar returns true if matrices are approximatively the same. This is a workarround to ignore rounding errors.
func (*F32) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*F32) MulComp ¶
MulComp multiplies the matrix by another matrix (composition). It modifies the matrix, and returns a pointer on it.
func (*F32) MulScale ¶
MulScale multiplies all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*F32) MulVec ¶
MulVec performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right).
func (*F32) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 0, so in practice a direction vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations to be accumulated within the matrix and then performed at once.
func (*F32) MulVecPos ¶
MulVecPos performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 1, so in practice a position vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations and translations to be accumulated within the matrix and then performed at once.
func (*F32) Sub ¶
Sub substracts operand from the matrix. It modifies the matrix, and returns a pointer on it.
func (*F32) Transpose ¶
Transpose inverts rows and columns (matrix transposition). It modifies the matrix, and returns a pointer on it.
func (*F32) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type F64 ¶
F64 is a matrix containing 4x4 float64 values. Can be used in 3D matrix transformations.
func F64Add ¶
F64Add adds two matrices. Args are left untouched, a pointer on a new object is returned.
func F64DivScale ¶
F64DivScale divides all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func F64Inv ¶
F64Inv inverts a matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. Args is left untouched, a pointer on a new object is returned.
func F64MulComp ¶
F64MulComp multiplies two matrices (composition). Args are left untouched, a pointer on a new object is returned.
func F64MulScale ¶
F64MulScale multiplies all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func F64New ¶
F64New creates a new matrix containing 4x4 float64 values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func F64Ortho ¶
F64Ortho creates a projection matrix the way the standard OpenGL glOrtho would (see https://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml). Note: use -nearVal and -farVal to initialize. It's a little akward, if you expect to pass vectors with positions ranging from nearVal to farVal then you need to pass -nearVal and -farVal to this function. This is probably due to the fact that with a right-handed basis and X,Y set up "as usual", then Z is negative when going farther and farther. This tweak allows farVal to yield +1 and nearVal -1. We keep this function as is here, as this is the way OpenGL functions seem to work.
func F64Perspective ¶
F64Perspective creates a projection matrix the way the standard GLU gluPerspective function would (see https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml). Beware, fovy is in degrees, not radians.
func F64RebaseOXYZ ¶
F64RebaseOXYZ creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func F64RebaseOXYZP ¶
F64RebaseOXYZP creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1), P=(1,1,1) basis to the given basis. Note that there can be a projection, so f(a+b) is not f(a)+f(b).
func F64RotX ¶
F64RotX creates a new rotation matrix. The rotation is done in 3D over the x (1st) axis. Angle is given in radians.
func F64RotY ¶
F64RotY creates a new rotation matrix. The rotation is done in 3D over the y (2nd) axis. Angle is given in radians.
func F64RotZ ¶
F64RotZ creates a new rotation matrix. The rotation is done in 3D over the z (3rd) axis. Angle is given in radians.
func F64Sub ¶
F64Sub substracts matrix b from matrix a. Args are left untouched, a pointer on a new object is returned.
func F64Translation ¶
F64Translation creates a new translation matrix.
func F64Transpose ¶
F64Transpose inverts rows and columns (matrix transposition). Args is left untouched, a pointer on a new object is returned.
func (*F64) Add ¶
Add adds operand to the matrix. It modifies the matrix, and returns a pointer on it.
func (*F64) DivScale ¶
DivScale divides all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*F64) Inv ¶
Inv inverts the matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. It modifies the matrix, and returns a pointer on it.
func (*F64) IsSimilar ¶
IsSimilar returns true if matrices are approximatively the same. This is a workarround to ignore rounding errors.
func (*F64) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*F64) MulComp ¶
MulComp multiplies the matrix by another matrix (composition). It modifies the matrix, and returns a pointer on it.
func (*F64) MulScale ¶
MulScale multiplies all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*F64) MulVec ¶
MulVec performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right).
func (*F64) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 0, so in practice a direction vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations to be accumulated within the matrix and then performed at once.
func (*F64) MulVecPos ¶
MulVecPos performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 1, so in practice a position vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations and translations to be accumulated within the matrix and then performed at once.
func (*F64) Sub ¶
Sub substracts operand from the matrix. It modifies the matrix, and returns a pointer on it.
func (*F64) Transpose ¶
Transpose inverts rows and columns (matrix transposition). It modifies the matrix, and returns a pointer on it.
func (*F64) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type X32 ¶
X32 is a matrix containing 4x4 fixed point 32 bit values. Can be used in 3D matrix transformations.
func X32Add ¶
X32Add adds two matrices. Args are left untouched, a pointer on a new object is returned.
func X32DivScale ¶
X32DivScale divides all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func X32Inv ¶
X32Inv inverts a matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. Args is left untouched, a pointer on a new object is returned.
func X32MulComp ¶
X32MulComp multiplies two matrices (composition). Args are left untouched, a pointer on a new object is returned.
func X32MulScale ¶
X32MulScale multiplies all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func X32New ¶
func X32New(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16 vpnumber.X32) *X32
X32New creates a new matrix containing 4x4 fixed point 32 bit values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func X32Ortho ¶
X32Ortho creates a projection matrix the way the standard OpenGL glOrtho would (see https://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml). Note: use -nearVal and -farVal to initialize. It's a little akward, if you expect to pass vectors with positions ranging from nearVal to farVal then you need to pass -nearVal and -farVal to this function. This is probably due to the fact that with a right-handed basis and X,Y set up "as usual", then Z is negative when going farther and farther. This tweak allows farVal to yield +1 and nearVal -1. We keep this function as is here, as this is the way OpenGL functions seem to work.
func X32Perspective ¶
X32Perspective creates a projection matrix the way the standard GLU gluPerspective function would (see https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml). Beware, fovy is in degrees, not radians.
func X32RebaseOXYZ ¶
X32RebaseOXYZ creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func X32RebaseOXYZP ¶
X32RebaseOXYZP creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1), P=(1,1,1) basis to the given basis. Note that there can be a projection, so f(a+b) is not f(a)+f(b).
func X32RotX ¶
X32RotX creates a new rotation matrix. The rotation is done in 3D over the x (1st) axis. Angle is given in radians.
func X32RotY ¶
X32RotY creates a new rotation matrix. The rotation is done in 3D over the y (2nd) axis. Angle is given in radians.
func X32RotZ ¶
X32RotZ creates a new rotation matrix. The rotation is done in 3D over the z (3rd) axis. Angle is given in radians.
func X32Sub ¶
X32Sub substracts matrix b from matrix a. Args are left untouched, a pointer on a new object is returned.
func X32Translation ¶
X32Translation creates a new translation matrix.
func X32Transpose ¶
X32Transpose inverts rows and columns (matrix transposition). Args is left untouched, a pointer on a new object is returned.
func (*X32) Add ¶
Add adds operand to the matrix. It modifies the matrix, and returns a pointer on it.
func (*X32) DivScale ¶
DivScale divides all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*X32) Inv ¶
Inv inverts the matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. It modifies the matrix, and returns a pointer on it.
func (*X32) IsSimilar ¶
IsSimilar returns true if matrices are approximatively the same. This is a workarround to ignore rounding errors.
func (*X32) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*X32) MulComp ¶
MulComp multiplies the matrix by another matrix (composition). It modifies the matrix, and returns a pointer on it.
func (*X32) MulScale ¶
MulScale multiplies all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*X32) MulVec ¶
MulVec performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right).
func (*X32) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 0, so in practice a direction vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations to be accumulated within the matrix and then performed at once.
func (*X32) MulVecPos ¶
MulVecPos performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 1, so in practice a position vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations and translations to be accumulated within the matrix and then performed at once.
func (*X32) Sub ¶
Sub substracts operand from the matrix. It modifies the matrix, and returns a pointer on it.
func (*X32) Transpose ¶
Transpose inverts rows and columns (matrix transposition). It modifies the matrix, and returns a pointer on it.
func (*X32) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type X64 ¶
X64 is a matrix containing 4x4 fixed point 64 bit values. Can be used in 3D matrix transformations.
func X64Add ¶
X64Add adds two matrices. Args are left untouched, a pointer on a new object is returned.
func X64DivScale ¶
X64DivScale divides all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func X64Inv ¶
X64Inv inverts a matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. Args is left untouched, a pointer on a new object is returned.
func X64MulComp ¶
X64MulComp multiplies two matrices (composition). Args are left untouched, a pointer on a new object is returned.
func X64MulScale ¶
X64MulScale multiplies all values of a matrix by a scalar. Args are left untouched, a pointer on a new object is returned.
func X64New ¶
func X64New(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16 vpnumber.X64) *X64
X64New creates a new matrix containing 4x4 fixed point 64 bit values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func X64Ortho ¶
X64Ortho creates a projection matrix the way the standard OpenGL glOrtho would (see https://www.opengl.org/sdk/docs/man2/xhtml/glOrtho.xml). Note: use -nearVal and -farVal to initialize. It's a little akward, if you expect to pass vectors with positions ranging from nearVal to farVal then you need to pass -nearVal and -farVal to this function. This is probably due to the fact that with a right-handed basis and X,Y set up "as usual", then Z is negative when going farther and farther. This tweak allows farVal to yield +1 and nearVal -1. We keep this function as is here, as this is the way OpenGL functions seem to work.
func X64Perspective ¶
X64Perspective creates a projection matrix the way the standard GLU gluPerspective function would (see https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml). Beware, fovy is in degrees, not radians.
func X64RebaseOXYZ ¶
X64RebaseOXYZ creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func X64RebaseOXYZP ¶
X64RebaseOXYZP creates a matrix that translates from the default O=(0,0,0), X=(1,0,0), Y=(0,1,0), Z=(0,0,1), P=(1,1,1) basis to the given basis. Note that there can be a projection, so f(a+b) is not f(a)+f(b).
func X64RotX ¶
X64RotX creates a new rotation matrix. The rotation is done in 3D over the x (1st) axis. Angle is given in radians.
func X64RotY ¶
X64RotY creates a new rotation matrix. The rotation is done in 3D over the y (2nd) axis. Angle is given in radians.
func X64RotZ ¶
X64RotZ creates a new rotation matrix. The rotation is done in 3D over the z (3rd) axis. Angle is given in radians.
func X64Sub ¶
X64Sub substracts matrix b from matrix a. Args are left untouched, a pointer on a new object is returned.
func X64Translation ¶
X64Translation creates a new translation matrix.
func X64Transpose ¶
X64Transpose inverts rows and columns (matrix transposition). Args is left untouched, a pointer on a new object is returned.
func (*X64) Add ¶
Add adds operand to the matrix. It modifies the matrix, and returns a pointer on it.
func (*X64) DivScale ¶
DivScale divides all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*X64) Inv ¶
Inv inverts the matrix. Never fails (no division by zero error, never) but if the matrix can't be inverted, result does not make sense. It modifies the matrix, and returns a pointer on it.
func (*X64) IsSimilar ¶
IsSimilar returns true if matrices are approximatively the same. This is a workarround to ignore rounding errors.
func (*X64) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*X64) MulComp ¶
MulComp multiplies the matrix by another matrix (composition). It modifies the matrix, and returns a pointer on it.
func (*X64) MulScale ¶
MulScale multiplies all values of the matrix by factor. It modifies the matrix, and returns a pointer on it.
func (*X64) MulVec ¶
MulVec performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right).
func (*X64) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 0, so in practice a direction vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations to be accumulated within the matrix and then performed at once.
func (*X64) MulVecPos ¶
MulVecPos performs a multiplication of a vector by a 4x4 matrix, considering the vector is a column vector (matrix left, vector right). The last member of the vector is assumed to be 1, so in practice a position vector of length 3 (a point in space) is passed. This allow geometric transformations such as rotations and translations to be accumulated within the matrix and then performed at once.
func (*X64) Sub ¶
Sub substracts operand from the matrix. It modifies the matrix, and returns a pointer on it.
func (*X64) Transpose ¶
Transpose inverts rows and columns (matrix transposition). It modifies the matrix, and returns a pointer on it.
func (*X64) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.