mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
15 lines
398 B
R
15 lines
398 B
R
|
typedef @algebra(float(3,0,1)) PGA;
|
||
|
typedef PGA.group_mask(0xa) bivector_t;
|
||
|
typedef PGA.group_mask(0x1e) motor_t;
|
||
|
|
||
|
motor_t
|
||
|
make_motor (vec4 translation, vec4 rotation)
|
||
|
{
|
||
|
auto dt = (PGA.group_mask(0x18)) translation;
|
||
|
auto q = (PGA.group_mask(0x06)) rotation;
|
||
|
motor_t t = { .scalar = 1, .bvecp = -dt.bvecp };
|
||
|
motor_t r = { .scalar = q.scalar, .bvect = q.bvect };
|
||
|
motor_t m = t * r;
|
||
|
return m;
|
||
|
}
|