mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-01 16:42:37 +00:00
2e91b29580
This gets only some very basics working: * Algebra (multi-vector) types: eg @algebra(float(3,0,1)). * Algebra scopes (using either the above or @algebra(TYPE_NAME) where the above was used in a typedef. * Basis blades (eg, e12) done via procedural symbols that evaluate to suitable constants based on the basis group for the blade. * Addition and subtraction of multi-vectors (only partially tested). * Assignment of sub-algebra multi-vectors to full-algebra multi-vectors (missing elements zeroed). There's still much work to be done, but I thought it time to get something into git.
20 lines
294 B
R
20 lines
294 B
R
#include "test-harness.h"
|
||
|
||
vector a = { 1, 0, 0 };
|
||
vector b = { 0, 1, 0 };
|
||
vector c = { 0, 0, 1 };
|
||
|
||
int
|
||
main ()
|
||
{
|
||
vector v = a × b;
|
||
if (v != c) {
|
||
printf ("cross product failed\n");
|
||
return 1;
|
||
};
|
||
if (v • c != [1, 1, 1]) {
|
||
printf ("dot product failed\n");
|
||
return 1;
|
||
}
|
||
return 0;
|
||
}
|