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)
| 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. |
| 530 | func 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. |
| 541 | func (p *Point) MultiplyMatrixVector(m *Matrix) *Point { |
no outgoing calls