public static fp3 mul(fp3 a, fp3x3 b) { return(fp3( a.x * b.c0.x + a.y * b.c0.y + a.z * b.c0.z, a.x * b.c1.x + a.y * b.c1.y + a.z * b.c1.z, a.x * b.c2.x + a.y * b.c2.y + a.z * b.c2.z)); }
public fpquaternion(fp3x3 m) { var u = m.c0; var v = m.c1; var w = m.c2; var u_sign = (uint)u.x & 0x80000000; var t = v.y + (fp)((uint)w.z ^ u_sign); var u_mask = new uint4((int)u_sign >> 31); var t_mask = new uint4((int)t >> 31); var tr = 1.0f + fpmath.abs(u.x); var sign_flips = new uint4(0x00000000, 0x80000000, 0x80000000, 0x80000000) ^ (u_mask & new uint4(0x00000000, 0x80000000, 0x00000000, 0x80000000)) ^ (t_mask & new uint4(0x80000000, 0x80000000, 0x80000000, 0x00000000)); var value = new float4(tr, u.y, w.x, v.z) + (float4)((uint4) new float4(t, v.x, u.z, w.y) ^ sign_flips); // +---, +++-, ++-+, +-++ value = ((uint4)value & ~u_mask) | ((uint4)value.zwxy & u_mask); value = ((uint4)value.wzyx & ~t_mask) | ((uint4)value & t_mask); value = fpmath.normalize(value); this.x = value.x; this.y = value.y; this.z = value.z; this.w = value.w; }
public static fp3x3 transpose(fp3x3 v) { return(fp3x3( v.c0.x, v.c0.y, v.c0.z, v.c1.x, v.c1.y, v.c1.z, v.c2.x, v.c2.y, v.c2.z)); }
public static fp4x3 mul(fp4x3 a, fp3x3 b) { return(fp4x3( a.c0 * b.c0.x + a.c1 * b.c0.y + a.c2 * b.c0.z, a.c0 * b.c1.x + a.c1 * b.c1.y + a.c2 * b.c1.z, a.c0 * b.c2.x + a.c1 * b.c2.y + a.c2 * b.c2.z)); }
public static fp3x4 mul(fp3x3 a, fp3x4 b) { return(fp3x4( a.c0 * b.c0.x + a.c1 * b.c0.y + a.c2 * b.c0.z, a.c0 * b.c1.x + a.c1 * b.c1.y + a.c2 * b.c1.z, a.c0 * b.c2.x + a.c1 * b.c2.y + a.c2 * b.c2.z, a.c0 * b.c3.x + a.c1 * b.c3.y + a.c2 * b.c3.z)); }
public static fp3x2 mul(fp3x3 a, fp3x2 b) { return(fp3x2( a.c0 * b.c0.x + a.c1 * b.c0.y + a.c2 * b.c0.z, a.c0 * b.c1.x + a.c1 * b.c1.y + a.c2 * b.c1.z)); }
public static fp3 mul(fp3x3 a, fp3 b) { return(a.c0 * b.x + a.c1 * b.y + a.c2 * b.z); }
public static uint3 hashwide(fp3x3 v) { return((fpmath.asuint(v.c0) * uint3(0xEADF0775u, 0x747A9D7Bu, 0x4111F799u) + fpmath.asuint(v.c1) * uint3(0xB5F05AF1u, 0xFD80290Bu, 0x8B65ADB7u) + fpmath.asuint(v.c2) * uint3(0xDFF4F563u, 0x7069770Du, 0xD1224537u)) + 0xE99ED6F3u); }
public static uint hash(fp3x3 v) { return(math.csum(fpmath.asuint(v.c0) * uint3(0xD42EAFA3u, 0xD9AFD06Du, 0x97A65421u) + fpmath.asuint(v.c1) * uint3(0x7809205Fu, 0x9C9F0823u, 0x5A9CA13Bu) + fpmath.asuint(v.c2) * uint3(0xAFCDD5EFu, 0xA88D187Du, 0xCF6EBA1Du)) + 0x9D88E5A1u); }