Documentation ¶
Overview ¶
Package vpmat3x2 contains 3x2 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 float32) *F32
- func F32RebaseOXY(Origin, PosX, PosY *vpvec2.F32) *F32
- func F32Rot(r float32) *F32
- func F32Scale(vec *vpvec2.F32) *F32
- func F32Sub(mata, matb *F32) *F32
- func F32Translation(vec *vpvec2.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) *vpvec2.F32
- func (mat *F32) GetRow(row int) *vpvec3.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) MulVecDir(vec *vpvec2.F32) *vpvec2.F32
- func (mat *F32) MulVecPos(vec *vpvec2.F32) *vpvec2.F32
- func (mat *F32) Set(col, row int, val float32)
- func (mat *F32) SetCol(col int, vec *vpvec2.F32)
- func (mat *F32) SetRow(row int, vec *vpvec3.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) 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 float64) *F64
- func F64RebaseOXY(Origin, PosX, PosY *vpvec2.F64) *F64
- func F64Rot(r float64) *F64
- func F64Scale(vec *vpvec2.F64) *F64
- func F64Sub(mata, matb *F64) *F64
- func F64Translation(vec *vpvec2.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) *vpvec2.F64
- func (mat *F64) GetRow(row int) *vpvec3.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) MulVecDir(vec *vpvec2.F64) *vpvec2.F64
- func (mat *F64) MulVecPos(vec *vpvec2.F64) *vpvec2.F64
- func (mat *F64) Set(col, row int, val float64)
- func (mat *F64) SetCol(col int, vec *vpvec2.F64)
- func (mat *F64) SetRow(row int, vec *vpvec3.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) 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(x1, x2, x3, x4, x5, x6 vpnumber.X32) *X32
- func X32RebaseOXY(Origin, PosX, PosY *vpvec2.X32) *X32
- func X32Rot(r vpnumber.X32) *X32
- func X32Scale(vec *vpvec2.X32) *X32
- func X32Sub(mata, matb *X32) *X32
- func X32Translation(vec *vpvec2.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) *vpvec2.X32
- func (mat *X32) GetRow(row int) *vpvec3.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) MulVecDir(vec *vpvec2.X32) *vpvec2.X32
- func (mat *X32) MulVecPos(vec *vpvec2.X32) *vpvec2.X32
- func (mat *X32) Set(col, row int, val vpnumber.X32)
- func (mat *X32) SetCol(col int, vec *vpvec2.X32)
- func (mat *X32) SetRow(row int, vec *vpvec3.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) 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(x1, x2, x3, x4, x5, x6 vpnumber.X64) *X64
- func X64RebaseOXY(Origin, PosX, PosY *vpvec2.X64) *X64
- func X64Rot(r vpnumber.X64) *X64
- func X64Scale(vec *vpvec2.X64) *X64
- func X64Sub(mata, matb *X64) *X64
- func X64Translation(vec *vpvec2.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) *vpvec2.X64
- func (mat *X64) GetRow(row int) *vpvec3.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) MulVecDir(vec *vpvec2.X64) *vpvec2.X64
- func (mat *X64) MulVecPos(vec *vpvec2.X64) *vpvec2.X64
- func (mat *X64) Set(col, row int, val vpnumber.X64)
- func (mat *X64) SetCol(col int, vec *vpvec2.X64)
- func (mat *X64) SetRow(row int, vec *vpvec3.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) UnmarshalJSON(data []byte) error
Constants ¶
const ( // Col0Row0 is the index of column 0 row 0 in a 3x2 column-major matrix. Col0Row0 = iota // Col0Row1 is the index of column 0 row 1 in a 3x2 column-major matrix. Col0Row1 // Col1Row0 is the index of column 1 row 0 in a 3x2 column-major matrix. Col1Row0 // Col1Row1 is the index of column 1 row 1 in a 3x2 column-major matrix. Col1Row1 // Col2Row0 is the index of column 2 row 0 in a 3x2 column-major matrix. Col2Row0 // Col2Row1 is the index of column 2 row 1 in a 3x2 column-major matrix. Col2Row1 // Size is the number of elements in a 3x2 matrix. Size // Width is the width a 3x2 matrix (max column index is Width-1). Width = 3 // Height is the width a 3x2 matrix (max row index is Height-1). Height = 2 )
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 3x2 float32 values.
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 3x2 float32 values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func F32RebaseOXY ¶
F32RebaseOXY creates a matrix that translates from the default O=(0,0), X=(1,0), Y=(0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func F32Rot ¶
F32Rot creates a new rotation matrix. The rotation is done in 2D over a virtual z axis, such as z = cross(x,y). 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 (*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) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 3x2 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 2 (a point in a plane) 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 3x2 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 2 (a point in a plane) 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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type F64 ¶
F64 is a matrix containing 3x2 float64 values.
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 3x2 float64 values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func F64RebaseOXY ¶
F64RebaseOXY creates a matrix that translates from the default O=(0,0), X=(1,0), Y=(0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func F64Rot ¶
F64Rot creates a new rotation matrix. The rotation is done in 2D over a virtual z axis, such as z = cross(x,y). 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 (*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) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 3x2 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 2 (a point in a plane) 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 3x2 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 2 (a point in a plane) 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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type X32 ¶
X32 is a matrix containing 3x2 fixed point 32 bit values. Can hold the values of a point in space.
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 ¶
X32New creates a new matrix containing 3x2 fixed point 32 bit values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func X32RebaseOXY ¶
X32RebaseOXY creates a matrix that translates from the default O=(0,0), X=(1,0), Y=(0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func X32Rot ¶
X32Rot creates a new rotation matrix. The rotation is done in 2D over a virtual z axis, such as z = cross(x,y). 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 (*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) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 3x2 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 2 (a point in a plane) 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 3x2 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 2 (a point in a plane) 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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type X64 ¶
X64 is a matrix containing 3x2 fixed point 64 bit values. Can hold the values of a point in space.
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 ¶
X64New creates a new matrix containing 3x2 fixed point 64 bit values. The column-major (OpenGL notation) mode is used, first elements fill first column.
func X64RebaseOXY ¶
X64RebaseOXY creates a matrix that translates from the default O=(0,0), X=(1,0), Y=(0,1) basis to the given basis. It assumes f(a+b) equals f(a)+f(b).
func X64Rot ¶
X64Rot creates a new rotation matrix. The rotation is done in 2D over a virtual z axis, such as z = cross(x,y). 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 (*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) MulVecDir ¶
MulVecDir performs a multiplication of a vector by a 3x2 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 2 (a point in a plane) 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 3x2 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 2 (a point in a plane) 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) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.