@@ -3,6 +3,7 @@ package linalg
3
3
import " core:math"
4
4
import " base:builtin"
5
5
import " base:intrinsics"
6
+ import " base:runtime"
6
7
7
8
// Generic
8
9
@@ -223,33 +224,27 @@ quaternion_mul_quaternion :: proc "contextless" (q1, q2: $Q) -> Q where IS_QUATE
223
224
224
225
@(require_results)
225
226
quaternion64_mul_vector3 :: proc " contextless" (q: $Q /quaternion64 , v: $V /[3 ]$F /f16 ) -> V {
226
- Raw_Quaternion :: struct {xyz: [3 ]f16 , r: f16 }
227
-
228
- q := transmute (Raw_Quaternion)q
227
+ q := transmute (runtime.Raw_Quaternion64_Vector_Scalar)q
229
228
v := v
230
229
231
- t := cross (2 *q.xyz , v)
232
- return V (v + q.r *t + cross (q.xyz , t))
230
+ t := cross (2 *q.vector , v)
231
+ return V (v + q.scalar *t + cross (q.vector , t))
233
232
}
234
233
@(require_results)
235
234
quaternion128_mul_vector3 :: proc " contextless" (q: $Q /quaternion128 , v: $V /[3 ]$F /f32 ) -> V {
236
- Raw_Quaternion :: struct {xyz: [3 ]f32 , r: f32 }
237
-
238
- q := transmute (Raw_Quaternion)q
235
+ q := transmute (runtime.Raw_Quaternion128_Vector_Scalar)q
239
236
v := v
240
237
241
- t := cross (2 *q.xyz , v)
242
- return V (v + q.r *t + cross (q.xyz , t))
238
+ t := cross (2 *q.vector , v)
239
+ return V (v + q.scalar *t + cross (q.vector , t))
243
240
}
244
241
@(require_results)
245
242
quaternion256_mul_vector3 :: proc " contextless" (q: $Q /quaternion256 , v: $V /[3 ]$F /f64 ) -> V {
246
- Raw_Quaternion :: struct {xyz: [3 ]f64 , r: f64 }
247
-
248
- q := transmute (Raw_Quaternion)q
243
+ q := transmute (runtime.Raw_Quaternion256_Vector_Scalar)q
249
244
v := v
250
245
251
- t := cross (2 *q.xyz , v)
252
- return V (v + q.r *t + cross (q.xyz , t))
246
+ t := cross (2 *q.vector , v)
247
+ return V (v + q.scalar *t + cross (q.vector , t))
253
248
}
254
249
quaternion_mul_vector3 :: proc {quaternion64_mul_vector3, quaternion128_mul_vector3, quaternion256_mul_vector3}
255
250
0 commit comments