(b Vector)
| 146 | } |
| 147 | |
| 148 | func (a Matrix) MulDirection(b Vector) Vector { |
| 149 | x := a.x00*b.X + a.x01*b.Y + a.x02*b.Z |
| 150 | y := a.x10*b.X + a.x11*b.Y + a.x12*b.Z |
| 151 | z := a.x20*b.X + a.x21*b.Y + a.x22*b.Z |
| 152 | return Vector{x, y, z}.Normalize() |
| 153 | } |
| 154 | |
| 155 | func (a Matrix) MulRay(b Ray) Ray { |
| 156 | return Ray{a.MulPosition(b.Origin), a.MulDirection(b.Direction)} |