mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[gatest] Calculate correct sign for duals
I was aware in the beginning that the signs were probably incorrect, but I had left them as I wasn't sure how they worked. Thanks to enki (bivector community), I was pointed in the right direction for getting the calculations right: the product of a basis blade with its dual (x !x) must product the positive pseudo-scalar.
This commit is contained in:
parent
2858870153
commit
a40fee2513
1 changed files with 5 additions and 3 deletions
|
@ -263,9 +263,11 @@ static MultiVector *new_mv (Algebra *algebra, BasisLayout *layout)
|
|||
}
|
||||
double lc = components[i];
|
||||
BasisBlade *lb = [layout bladeAt:i];
|
||||
unsigned mask = [lb mask] ^ dual_mask;
|
||||
double s = 1;
|
||||
int ind = [layout bladeIndex:mask];
|
||||
unsigned lb_mask = [lb mask];
|
||||
unsigned mask = lb_mask ^ dual_mask;
|
||||
double ls = [lb scale];
|
||||
double s = count_flips (lb_mask, mask) & 1 ? -1 : 1;
|
||||
int ind = [dual.layout bladeIndex:mask];
|
||||
dual.components[ind] += s * lc;
|
||||
}
|
||||
return dual;
|
||||
|
|
Loading…
Reference in a new issue