Method: Matrix#rot4
- Defined in:
- lib/openc3/core_ext/matrix.rb
#rot4(quaternion) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/openc3/core_ext/matrix.rb', line 143 def rot4(quaternion) # Get rotation matrix r = Matrix.cfromq(quaternion) 4.times do |row| x = @rows[0][row] y = @rows[1][row] z = @rows[2][row] 3.times do |i| @rows[i][row] = x * r[i][0] + y * r[i][1] + z * r[i][2] end end # Ensure the final row is floating point for consistency @rows[3].map! { |x| x.to_f } return self end |