diff --git a/tools/qfcc/test/Makemodule.am b/tools/qfcc/test/Makemodule.am index 7d491a858..fdd500dbe 100644 --- a/tools/qfcc/test/Makemodule.am +++ b/tools/qfcc/test/Makemodule.am @@ -50,6 +50,7 @@ test_progs_dat=\ tools/qfcc/test/ptraliasenc.dat \ tools/qfcc/test/ptrfunc.dat \ tools/qfcc/test/ptrstructcast.dat \ + tools/qfcc/test/motor-point.dat \ tools/qfcc/test/quaternion.dat \ tools/qfcc/test/return-ivar.dat \ tools/qfcc/test/return-postop.dat \ @@ -610,6 +611,16 @@ tools/qfcc/test/ptrstructcast.run: $(qfcc_test_run_deps) include $(ptrstructcast_dep) # am--include-marker r_depfiles_remade += $(ptrstructcast_dep) +tools_qfcc_test_motor_point_dat_SOURCES=tools/qfcc/test/motor-point.r +motor_point_obj=$(tools_qfcc_test_motor_point_dat_SOURCES:.r=.o) +motor_point_dep=$(call qcautodep,$(tools_qfcc_test_motor_point_dat_SOURCES)) +tools/qfcc/test/motor-point.dat$(EXEEXT): $(motor_point_obj) $(QFCC_DEP) + $(V_QFCCLD)$(QLINK) -o $@ $(motor_point_obj) +tools/qfcc/test/motor-point.run: $(qfcc_test_run_deps) + @$(top_srcdir)/tools/qfcc/test/build-run $@ +include $(motor_point_dep) # am--include-marker +r_depfiles_remade += $(motor_point_dep) + tools_qfcc_test_quaternion_dat_SOURCES=tools/qfcc/test/quaternion.r quaternion_obj=$(tools_qfcc_test_quaternion_dat_SOURCES:.r=.o) quaternion_dep=$(call qcautodep,$(tools_qfcc_test_quaternion_dat_SOURCES)) diff --git a/tools/qfcc/test/motor-point.r b/tools/qfcc/test/motor-point.r new file mode 100644 index 000000000..9b7122034 --- /dev/null +++ b/tools/qfcc/test/motor-point.r @@ -0,0 +1,30 @@ +#include "test-harness.h" + +typedef @algebra(float(3,0,1)) PGA; +typedef PGA.group_mask(0xa) bivector_t; +typedef PGA.group_mask(0x1e) motor_t; +typedef PGA.tvec point_t; + +point_t +apply_motor (motor_t m, point_t p) +{ + return (m * p * ~m).tvec; +} + +int +main (void) +{ + motor_t m = { + .scalar = 0.707106769, + .bvect = (PGA.bvect) '0 0 0.707106769'f, + .bvecp = (PGA.bvecp) '0 -4.2426405 0'f, + .qvec = (PGA.qvec) 0, + }; + point_t p = (point_t)'10 4 -1.5 1'f; + point_t n = apply_motor (m, p); + printf ("n: %.9q\n", n); + if ((vec4)n != '10 -4 -1.49999988 0.99999994'f) { + return 1; + } + return 0; +}