float4x4 operator *(const TranslateOp &lhs, const float4x4 &rhs) { float4x4 r = rhs; r.SetTranslatePart(r.TranslatePart() + lhs.Offset()); // Our optimized form of multiplication must be the same as this. mathassert(r.Equals(lhs.ToFloat4x4() * rhs)); return r; }
float3x4 operator *(const float3x4 &lhs, const TranslateOp &rhs) { float3x4 r = lhs; r.SetTranslatePart(lhs.TransformPos(rhs.Offset())); // Our optimized form of multiplication must be the same as this. mathassert(r.Equals(lhs * (float3x4)rhs)); return r; }
float3x4 operator *(const float3x4 &lhs, const TranslateOp &rhs) { float3x4 r = lhs; r.SetTranslatePart(lhs.TransformPos(DIR_TO_FLOAT3(rhs.Offset()))); // Our optimized form of multiplication must be the same as this. assume4(r.Equals(lhs * (float3x4)rhs), lhs, rhs, r, lhs * (float3x4)rhs); return r; }
float3x4 operator *(const TranslateOp &lhs, const float3x4 &rhs) { float3x4 r = rhs; r.SetTranslatePart(r.TranslatePart() + DIR_TO_FLOAT3(lhs.Offset())); // Our optimized form of multiplication must be the same as this. mathassert(r.Equals((float3x4)lhs * rhs)); return r; }
float4x4 operator *(const TranslateOp &lhs, const float4x4 &rhs) { // This function is based on the optimized assumption that the last row of rhs is [0,0,0,1]. // If this does not hold and you are hitting the check below, explicitly cast TranslateOp lhs to float4x4 before multiplication! assume(rhs.Row(3).Equals(0.f, 0.f, 0.f, 1.f)); float4x4 r = rhs; r.SetTranslatePart(r.TranslatePart() + DIR_TO_FLOAT3(lhs.Offset())); return r; }
float4x4 operator *(const float4x4 &lhs, const TranslateOp &rhs) { float4x4 r = lhs; r.SetTranslatePart(lhs.TransformPos(DIR_TO_FLOAT3(rhs.Offset()))); return r; }