Отказ от функций GetWeightedSum в пользу AppendScaled; оптимизация версоров / Replacing of GetWeightedSum onto AppendScaled; versor optimization
This commit is contained in:
parent
c3dc0b2ecd
commit
c66edd3432
14 changed files with 142 additions and 548 deletions
|
|
@ -270,14 +270,24 @@ namespace BGC
|
|||
|
||||
public static void Combine(in F32Versor second, in F32Versor first, out F32Versor result)
|
||||
{
|
||||
LoadValues(
|
||||
(second.s0 * first.s0 - second.x1 * first.x1) - (second.x2 * first.x2 + second.x3 * first.x3),
|
||||
(second.x1 * first.s0 + second.s0 * first.x1) - (second.x3 * first.x2 - second.x2 * first.x3),
|
||||
(second.x2 * first.s0 + second.s0 * first.x2) - (second.x1 * first.x3 - second.x3 * first.x1),
|
||||
(second.x3 * first.s0 + second.s0 * first.x3) - (second.x2 * first.x1 - second.x1 * first.x2),
|
||||
out result);
|
||||
float s0 = (second.s0 * first.s0 - second.x1 * first.x1) - (second.x2 * first.x2 + second.x3 * first.x3);
|
||||
float x1 = (second.x1 * first.s0 + second.s0 * first.x1) - (second.x3 * first.x2 - second.x2 * first.x3);
|
||||
float x2 = (second.x2 * first.s0 + second.s0 * first.x2) - (second.x1 * first.x3 - second.x3 * first.x1);
|
||||
float x3 = (second.x3 * first.s0 + second.s0 * first.x3) - (second.x2 * first.x1 - second.x1 * first.x2);
|
||||
|
||||
float squareModule = (s0 * s0 + x1 * x1) + (x2 * x2 + x3 * x3);
|
||||
|
||||
result.s0 = s0;
|
||||
result.x1 = x1;
|
||||
result.x2 = x2;
|
||||
result.x3 = x3;
|
||||
|
||||
if (squareModule < 1.0f - F32Utility.TWO_EPSYLON || 1.0f + F32Utility.TWO_EPSYLON < squareModule)
|
||||
{
|
||||
result.Normalize(squareModule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void LoadIdle(out F32Versor versor)
|
||||
{
|
||||
versor.s0 = 1.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue