quakeforge/tools/qfcc/test/vecops.r
Bill Currie cb4b073e47 [qfcc] Support some unicode ops and GA ops
Only · (dot product) and × (cross product for vector, commutator product
for geometric algebra) have been tested so far, but that involved
fighting with cpp to get it to not convert the · to \U000000b7, which
was rather annoying.
2023-08-21 17:47:55 +09:00

20 lines
293 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 (v · c != [1, 1, 1]) {
printf ("dot product failed\n");
return 1;
}
return 0;
}