void Portal_Connect(entity teleporter, entity destination)
{
- teleporter.portal_transform = AnglesTransform_Divide(AnglesTransform_TurnDirectionFR(destination.mangle), teleporter.mangle);
+ teleporter.portal_transform = AnglesTransform_RightDivide(AnglesTransform_TurnDirectionFR(destination.mangle), teleporter.mangle);
teleporter.enemy = destination;
destination.enemy = teleporter;
return transform;
}
-vector AnglesTransform_Divide(vector to_transform, vector from_transform)
+vector AnglesTransform_RightDivide(vector to_transform, vector from_transform)
{
return AnglesTransform_Multiply(to_transform, AnglesTransform_Invert(from_transform));
}
+vector AnglesTransform_LeftDivide(vector from_transform, vector to_transform)
+{
+ return AnglesTransform_Multiply(AnglesTransform_Invert(from_transform), to_transform);
+}
+
vector AnglesTransform_Normalize(vector t, float minimize_roll)
{
float need_flip;
#endif
vector AnglesTransform_Apply(vector transform, vector v);
-vector AnglesTransform_Multiply(vector t1, vector t2);
+vector AnglesTransform_Multiply(vector t1, vector t2); // A B
vector AnglesTransform_Invert(vector transform);
vector AnglesTransform_TurnDirectionFU(vector transform);
vector AnglesTransform_TurnDirectionFR(vector transform);
-vector AnglesTransform_Divide(vector to_transform, vector from_transform);
+vector AnglesTransform_RightDivide(vector to_transform, vector from_transform); // A B^-1
+vector AnglesTransform_LeftDivide(vector from_transform, vector to_transform); // A^-1 B
vector AnglesTransform_Normalize(vector t, float minimize_roll); // makes sure all angles are in their range: yaw in -180..180, pitch in -90..90, roll in -180..180 (or if minimize_roll is set, pitch in -180..180, roll in -90..90)
void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang)
{
- e.warpzone_transform = AnglesTransform_Divide(other_ang, AnglesTransform_TurnDirectionFR(my_ang));
+ e.warpzone_transform = AnglesTransform_RightDivide(other_ang, AnglesTransform_TurnDirectionFR(my_ang));
e.warpzone_shift = AnglesTransform_PrePostShift_GetPostShift(my_org, e.warpzone_transform, other_org);
e.warpzone_origin = my_org;
e.warpzone_targetorigin = other_org;