quakeforge/tools/qfcc/test/vecops.r
Bill Currie 2e91b29580 [qfcc] Start work on implementing geometric algebra
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.
2023-08-21 17:58:20 +09:00

20 lines
294 B
R
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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 (vc != [1, 1, 1]) {
printf ("dot product failed\n");
return 1;
}
return 0;
}