MCPcopy
hub / github.com/EngoEngine/engo / MultiplyMatrixVector

Function MultiplyMatrixVector

math.go:530–538  ·  view source on GitHub ↗

MultiplyMatrixVector multiplies the matrix m with the float32 vector v and returns the result. The size of vector v MUST be 2 or 3. If v is size 2, a 3rd component is automatically added with value of 1.0.

(m *Matrix, v []float32)

Source from the content-addressed store, hash-verified

528// The size of vector v MUST be 2 or 3. If v is size 2, a 3rd component is automatically added with
529// value of 1.0.
530func MultiplyMatrixVector(m *Matrix, v []float32) []float32 {
531 if len(v) == 2 {
532 v = []float32{v[0], v[1], 1}
533 }
534 v00 := m.Val[m00]*v[m00] + m.Val[m01]*v[m10] + m.Val[m02]*v[m20]
535 v10 := m.Val[m10]*v[m00] + m.Val[m11]*v[m10] + m.Val[m12]*v[m20]
536 v20 := m.Val[m20]*v[m00] + m.Val[m21]*v[m10] + m.Val[m22]*v[m20]
537 return []float32{v00, v10, v20}
538}
539
540// MultiplyMatrixVector multiplies the matrix m with the point and returns the result.
541func (p *Point) MultiplyMatrixVector(m *Matrix) *Point {

Callers 3

multModelMethod · 0.92
multModelMethod · 0.92
TestMultipleMatrixVectorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestMultipleMatrixVectorFunction · 0.68