public static unsafe void swMM( bool Translate, bool InputP2, __m128 *inp, __m128 b, __m128 c, __m128 *res, int count) { var(tmp1, tmp2, tmp3) = swMMRotation(b); var(tmp4, tmp5, tmp6) = Translate ? swMMTranslation(b, c) : (__m128.Zero, __m128.Zero, __m128.Zero); int stride = InputP2 ? 2 : 1; for (int i = 0; i < count; ++i) { ref __m128 p1_in = ref inp[stride * i]; // a __m128 p1_in_xzwy = _mm_swizzle_ps(p1_in, 120 /* 1, 3, 2, 0 */); __m128 p1_in_xwyz = _mm_swizzle_ps(p1_in, 156 /* 2, 1, 3, 0 */); ref __m128 p1_out = ref res[stride * i];
public unsafe Line(__m128 *p1p2) { P1 = p1p2[0]; P2 = p1p2[1]; }
public static unsafe void mat4x4_12(bool translated, bool normalized, __m128 b, __m128 *c, __m128 *res) { // The derivation of this conversion follows directly from the general // expansion of conjugating a point with a motor. See sw312 in // klein_sw.hpp for details. // // LSB // (2a0(b2 c3 - b0 c1 - b3 c2 - b1 c0) + // 2a3(b1 b3 - b0 b2) + // 2a2(b0 b3 + b2 b1) + // a1(b0^2 + b1^2 - b3^2 - b2^2)) e032 // x-coordinate // // (2a0(b3 c1 - b0 c2 - b1 c3 - b2 c0) + // 2a1(b2 b1 - b0 b3) + // 2a3(b0 b1 + b3 b2) + // a2(b0^2 + b2^2 - b1^2 - b3^2)) e013 + // y-coordinate // // (2a0(b1 c2 - b0 c3 - b2 c1 - b3 c0) + // 2a2(b3 b2 - b0 b1) + // 2a1(b0 b2 + b1 b3) + // a3(b0^2 + b3^2 - b2^2 - b1^2)) e021 + // z-coordinate // // a0(b0^2 + b1^2 + b2^2 + b3^2) e123 // w-coordinate // MSB // Store a number of scalar temporaries needed later var buf = _mm_mul_ps(b, b); float b0_2 = buf.GetElement(0); float b1_2 = buf.GetElement(1); float b2_2 = buf.GetElement(2); float b3_2 = buf.GetElement(3); // The first column of the matrix we need to produce contains the scale // factors of the x-coordinate (a1). This can be read off as: // // b0^2 + b1^2 - b3^2 - b2^2 // 2(b1 b2 - b3 b0) // 2(b2 b0 + b1 b3) // 0 ref __m128 c0 = ref res[0];