示例#1
0
// Matrix multiply by column vector, result is a new column vector
func (m *Matrix4) MultiV(v *Vector4) *Vector4 {
	m2 := matrix.NewMatrix(4, 1) // column vector
	m2.Init(v.Vector)

	return &Vector4{matrix.MultiMM(m.Matrix, m2).Column(1)}
}
示例#2
0
// Row vector multiply by matrix, result is a new row vector
func (v *Vector4) MultiM(m *Matrix4) *Vector4 {
	m2 := matrix.NewMatrix(1, 4)
	m2.InitRow(1, v.Vector)
	return &Vector4{matrix.MultiMM(m2, m.Matrix).Row(1)}
}
示例#3
0
func NewMatrix4() *Matrix4 {
	return &Matrix4{matrix.NewMatrix(4, 4)}
}