Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(v float32) float32
- func Acos(v float32) float32
- func Asin(v float32) float32
- func Atan(v float32) float32
- func Atan2(y, x float32) float32
- func Ceil(v float32) float32
- func Clamp(x, a, b float32) float32
- func ClampBotton(x, a float32) float32
- func ClampInt(x, a, b int) int
- func Cos(v float32) float32
- func DegToRad(degrees float32) float32
- func DisableMemoryPooling()
- func Floor(v float32) float32
- func Inf(sign int) float32
- func IsNaN(v float32) bool
- func Max(a, b float32) float32
- func Min(a, b float32) float32
- func Mod(a, b float32) float32
- func Module(L *lua.Lua) lua.Module
- func NaN() float32
- func NewColor(r, g, b, a float32) *color
- func NewHex(color uint) *color
- func Pf32(L *l.LState, pos int) float32
- func Pow(a, b float32) float32
- func Quat(w, x, y, z float32) *quaternion
- func QuatUnp(v ...float32) *quaternion
- func RadToDeg(radians float32) float32
- func Round(v float32) float32
- func Sin(v float32) float32
- func Sqrt(v float32) float32
- func Tan(v float32) float32
- type AF32
- type AU32
- type Color
- type Getter
- type Length
- type Manipulator
- type MatRxC
- func (m *MatRxC) Add(o Matrice) Matrice
- func (m *MatRxC) Cols() int
- func (m *MatRxC) Compose(translate, rotate, scale []float32) Matrice
- func (m *MatRxC) Decompose(translate, scale Vector, rotate Quaternion) Matrice
- func (m *MatRxC) Determinant() float32
- func (m *MatRxC) Frustrum(left, right, bottom, top, near, far float32) Matrice
- func (m *MatRxC) Get(row, col int) float32
- func (m *MatRxC) GetStr(k1, k2 string) float32
- func (m *MatRxC) Len() float32
- func (m *MatRxC) LookAt(eye, target, up Vector) Matrice
- func (m *MatRxC) MulMatrice(o Matrice) Matrice
- func (m *MatRxC) MulScalar(c float32) Matrice
- func (m *MatRxC) MulVec(o Vector) Vector
- func (m *MatRxC) Orthographic(left, right, top, bottom, near, far float32) Matrice
- func (m *MatRxC) Perspective(fov, aspect, near, far float32) Matrice
- func (m *MatRxC) Raw() []float32
- func (m *MatRxC) RawLen() int
- func (m *MatRxC) Rotate(q Quaternion) Matrice
- func (m *MatRxC) Rows() int
- func (m *MatRxC) Scale(v Vector) Matrice
- func (m *MatRxC) Set(row, col int, val float32)
- func (m *MatRxC) SetStr(k1, k2 string, v float32)
- func (m *MatRxC) Sub(o Matrice) Matrice
- func (m *MatRxC) Tag() string
- func (m *MatRxC) Trace() float32
- func (m *MatRxC) Translate(v Vector) Matrice
- func (m *MatRxC) Transpose() Matrice
- func (m *MatRxC) Update(v ...float32)
- type MathType
- type Matrice
- func ExpectedMatrice(k string, v interface{}) (Matrice, bool)
- func IdentityMatrix(k string) Matrice
- func MatOfSize(sz int, m []float32) (Matrice, error)
- func MultiplyMatrices(a, b Matrice) Matrice
- func ToMatrice(L *l.LState, v l.LValue) Matrice
- func UnpackToMat(L *l.LState, from int, k string, ignore bool) Matrice
- type MultiGetter
- type MultiSetter
- type MxPos
- type Quaternion
- func ExpectedQuat(v interface{}) (Quaternion, bool)
- func SetQuatFromAxisAngle(q Quaternion, ax Vector, an float32) Quaternion
- func SetQuatFromEuler(q Quaternion, v Vector) Quaternion
- func SetQuatFromRotationMatrix(q Quaternion, m Matrice) Quaternion
- func SetQuatFromUnitVectors(q Quaternion, from, to Vector) Quaternion
- func UnpackToQuat(L *l.LState, from int, ignore bool) Quaternion
- type Setter
- type VecN
- func (v *VecN) Add(o Vector) Vector
- func (v *VecN) Clone() Vector
- func (v *VecN) Cross(o Vector) Vector
- func (v *VecN) Dot(o Vector) float32
- func (v *VecN) Get(i int) float32
- func (v *VecN) GetStr(k string) float32
- func (v *VecN) Len() float32
- func (v *VecN) Mul(c float32) Vector
- func (v *VecN) Normalize() Vector
- func (v *VecN) Raw() []float32
- func (v *VecN) RawLen() int
- func (v *VecN) Rotate(q Quaternion) Vector
- func (v *VecN) Set(i int, val float32)
- func (v *VecN) SetStr(k string, val float32)
- func (v *VecN) Sub(o Vector) Vector
- func (v *VecN) Tag() string
- func (v *VecN) Update(in ...float32)
- type Vector
- func CrossVectors(a, b Vector) Vector
- func ExpectedVector(k string, v interface{}) (Vector, bool)
- func MultiplyMatriceVector(m Matrice, v Vector) Vector
- func SetMatriceFromVector(m Matrice, v Vector, ps ...MxPos) Vector
- func SetVectorFromMatrice(v Vector, m Matrice, ps ...MxPos) Vector
- func SetVectorFromQuaternion(v Vector, q Quaternion) Vector
- func SetVectorFromRotationMatrix(v Vector, m Matrice) Vector
- func ToVector(L *l.LState, v l.LValue) Vector
- func UnpackToVec(L *l.LState, from int, k string, ignore bool) Vector
- func VecOfSize(sz int, f []float32) (Vector, error)
Constants ¶
View Source
const ( VEC2 = "VEC2" VEC3 = "VEC3" VEC4 = "VEC4" MAT2 = "MAT2" MAT3 = "MAT3" MAT4 = "MAT4" QUAT = "QUAT" )
View Source
const Pi = math.Pi
Variables ¶
View Source
var ( Black = NewColor(0, 0, 0, 1) White = NewColor(1, 1, 1, 1) Red = NewColor(1, 0, 0, 1) Green = NewColor(0, 1, 0, 1) Blue = NewColor(0, 0, 1, 1) Gray = NewColor(0.5, 0.5, 0.5, 1) )
View Source
var (
EmptyQuat = Quat(defaultQW, defaultQVecX, defaultQVecY, defaultQVecZ)
)
View Source
var Infinity = float32(math.Inf(1))
View Source
var NoXOfSizeError = xrror.Xrror("No %s of size %d is possible").Out
View Source
var ( // vector x,y,z to matrice raw[12,13,14] TranslateMxPos = []MxPos{ {0, 0, 3}, {1, 1, 3}, {2, 2, 3}, } )
Functions ¶
func DisableMemoryPooling ¶
func DisableMemoryPooling()
Types ¶
type Manipulator ¶
type MatRxC ¶
type MatRxC struct {
// contains filtered or unexported fields
}
func (*MatRxC) Decompose ¶
func (m *MatRxC) Decompose(translate, scale Vector, rotate Quaternion) Matrice
func (*MatRxC) Determinant ¶
TODO: rewrite to perform algorithmically based on len of underlying array values or other available details
func (*MatRxC) GetStr ¶
string row and column starting from 1, e.g. string 1,1 will pull 0,0 from the underlying array
func (*MatRxC) MulMatrice ¶
func (*MatRxC) Orthographic ¶
func (*MatRxC) Perspective ¶
func (*MatRxC) Rotate ¶
func (m *MatRxC) Rotate(q Quaternion) Matrice
type Matrice ¶
type Matrice interface {
MathType
Manipulator
MultiGetter
MultiSetter
Length
Add(Matrice) Matrice
Cols() int
Compose([]float32, []float32, []float32) Matrice
Decompose(Vector, Vector, Quaternion) Matrice
Determinant() float32
LookAt(Vector, Vector, Vector) Matrice
MulMatrice(Matrice) Matrice
MulScalar(float32) Matrice
MulVec(Vector) Vector
Orthographic(float32, float32, float32, float32, float32, float32) Matrice
Perspective(float32, float32, float32, float32) Matrice
Rotate(Quaternion) Matrice
Rows() int
Scale(Vector) Matrice
Sub(Matrice) Matrice
Transpose() Matrice
Trace() float32
}
func ExpectedMatrice ¶
func IdentityMatrix ¶
func MultiplyMatrices ¶
type MultiGetter ¶
type MultiSetter ¶
type Quaternion ¶
type Quaternion interface {
MathType
Manipulator
Getter
Setter
Length
Clone() Quaternion
Conjugate() Quaternion
Inverse() Quaternion
Mul(Quaternion) Quaternion
Normalize() Quaternion
}
func ExpectedQuat ¶
func ExpectedQuat(v interface{}) (Quaternion, bool)
func SetQuatFromAxisAngle ¶
func SetQuatFromAxisAngle(q Quaternion, ax Vector, an float32) Quaternion
func SetQuatFromEuler ¶
func SetQuatFromEuler(q Quaternion, v Vector) Quaternion
func SetQuatFromRotationMatrix ¶
func SetQuatFromRotationMatrix(q Quaternion, m Matrice) Quaternion
func SetQuatFromUnitVectors ¶
func SetQuatFromUnitVectors(q Quaternion, from, to Vector) Quaternion
func UnpackToQuat ¶
func UnpackToQuat(L *l.LState, from int, ignore bool) Quaternion
type VecN ¶
type VecN struct {
// contains filtered or unexported fields
}
func NewVecNFrom ¶
func (*VecN) Rotate ¶
func (v *VecN) Rotate(q Quaternion) Vector
type Vector ¶
type Vector interface {
MathType
Manipulator
Getter
Setter
Length
Add(Vector) Vector
Clone() Vector
Cross(Vector) Vector
Dot(Vector) float32
Mul(float32) Vector
Normalize() Vector
Rotate(Quaternion) Vector
Sub(Vector) Vector
}
func CrossVectors ¶
func ExpectedVector ¶
func MultiplyMatriceVector ¶
func SetVectorFromQuaternion ¶
func SetVectorFromQuaternion(v Vector, q Quaternion) Vector
Click to show internal directories.
Click to hide internal directories.