matmath

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DontNeedMATXAnyMore

func DontNeedMATXAnyMore(matx *MATX)

when you dont need one MATX anymore, you should call this function

func DontNeedVECXAnyMore

func DontNeedVECXAnyMore(vecx *VECX)

when you dont need one VECX anymore, you should call this function

Types

type MATX

type MATX struct {
	// contains filtered or unexported fields
}

element in the data is arranged in column. For example: int a mat2 , data[0] == mat2[1][1], data[1] == mat2[2][1]

func GetMATX

func GetMATX(di int) *MATX

this is the only function that you should new-a-MATX the data inside the result is dirty, don't think they are zero-initialized

func Homoz4 added in v0.0.4

func Homoz4(z float32) *MATX

func LookAtFrom4 added in v0.0.4

func LookAtFrom4(point, target, up *VECX) *MATX

generate mat4

func (*MATX) Add

func (self *MATX) Add(other *MATX) *MATX

mat math add, the result will be stored int another new-matx; mat3 and mat4 cannot add, so return nil on that condition;

func (*MATX) Add_InPlace

func (self *MATX) Add_InPlace(other *MATX)

mat math add in place, the result will be stored int self; mat3 and mat4 cannot add, so return with nothing changed on that condition

func (*MATX) Address added in v0.0.4

func (self *MATX) Address() *float32

return the first element address

func (*MATX) Di

func (self *MATX) Di() int

read-only, return the dimension about this MATX

func (*MATX) EqualsTo

func (self *MATX) EqualsTo(other *MATX) bool

check equal

func (*MATX) GetEleByRowAndCol

func (self *MATX) GetEleByRowAndCol(row, col int) float32

return matx[row][ele]

func (*MATX) PrettyShow

func (self *MATX) PrettyShow(logs ...string)

read-only, pretty print the mat

func (*MATX) RightMul_InPlace

func (self *MATX) RightMul_InPlace(other *MATX)

self = other * self mat3 and vec4 cannot mul, so return nil on that condition;

func (*MATX) Rotate4 added in v0.0.4

func (self *MATX) Rotate4(rotation *VECX)

in-place

func (*MATX) SetByCol_InPlace

func (self *MATX) SetByCol_InPlace(other *VECX, col int)

set one col with a vec in place note: col begins from 1 for humanity

func (*MATX) SetEleByRowAndCol

func (self *MATX) SetEleByRowAndCol(row, col int, value float32)

matx[row][ele] = value

func (*MATX) ToIdentity added in v0.0.4

func (self *MATX) ToIdentity()

in-place

func (*MATX) Translate4 added in v0.0.4

func (self *MATX) Translate4(translate *VECX)

in-place

type VECX

type VECX struct {
	// contains filtered or unexported fields
}

func GetVECX

func GetVECX(di int) *VECX

this is the only function that you should new-a-VECX the data inside the result is dirty, don't think they are zero-initialized

func Vec3Cross added in v0.0.4

func Vec3Cross(left, right *VECX) *VECX

left X right

func (*VECX) Add

func (self *VECX) Add(other *VECX, op ...bool) *VECX

vec math add, the result will be stored int another new-vecx; vec3 and vec4 cannot add, so return nil on that condition;

func (*VECX) Add_InPlace

func (self *VECX) Add_InPlace(other *VECX, op ...bool)

vec math add in place, will store the result in self vec3 and vec4 cannot add, so return with nothing changed on that condition

func (*VECX) Clear

func (self *VECX) Clear()

set all elements to 0

func (*VECX) Di

func (self *VECX) Di() int

read-only, return the dimension about this vecx

func (*VECX) Dot

func (self *VECX) Dot(other *VECX) float32

self * other, the so-called vec dot

func (*VECX) EqualsTo

func (self *VECX) EqualsTo(other *VECX) bool

check equal

func (*VECX) GetIndexValue

func (self *VECX) GetIndexValue(index int) float32

read-only, return the index value node: index begins from 0

func (*VECX) GrabColToVec

func (self *VECX) GrabColToVec(other *MATX, col int)

grab one col from matx to store in self

func (*VECX) Interpolation

func (self *VECX) Interpolation(other *VECX, t float32) *VECX

two vec interpolation t should be [0,1], but any other real number is supported

func (*VECX) Normalize added in v0.0.4

func (self *VECX) Normalize()

func (*VECX) PrettyShow

func (self *VECX) PrettyShow()

read-only, pretty print the mat

func (*VECX) RightMul_InPlace

func (self *VECX) RightMul_InPlace(other *MATX)

mat mul vec, the result will be stored in self; mat3 and vec4 cannot mul, so return nil on that condition;

func (*VECX) Scale_InPlace

func (self *VECX) Scale_InPlace(factor float32)

vec math scale in place, will store the result in self

func (*VECX) SetIndexValue

func (self *VECX) SetIndexValue(index int, value float32)

set index value node: index begins from 0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL