X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=mathlib.h;fp=mathlib.h;h=85bf7b62a816469df1c9444874c7c096aea4c6ce;hb=0d368b1865e1de4c00689959407d40bf6817233e;hp=0b0855fc3ced22e5cc2357d675ef49c9013aae93;hpb=dc94032bc95888a1bd92180885dadde40ef8ae95;p=xonotic%2Fdarkplaces.git diff --git a/mathlib.h b/mathlib.h index 0b0855fc..85bf7b62 100644 --- a/mathlib.h +++ b/mathlib.h @@ -77,6 +77,13 @@ unsigned int CeilPowerOf2(unsigned int value); #define RAD2DEG(a) ((a) * (180.0f / (float) M_PI)) #define ANGLEMOD(a) ((a) - 360.0 * floor((a) / 360.0)) +#define DotProduct2(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]) +#define Vector2Clear(a) ((a)[0]=(a)[1]=0) +#define Vector2Compare(a,b) (((a)[0]==(b)[0])&&((a)[1]==(b)[1])) +#define Vector2Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1]) +#define Vector2Negate(a,b) ((b)[0]=-((a)[0]),(b)[1]=-((a)[1])) +#define Vector2Set(a,b,c,d,e) ((a)[0]=(b),(a)[1]=(c)) + #define DotProduct4(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]+(a)[3]*(b)[3]) #define Vector4Clear(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0) #define Vector4Compare(a,b) (((a)[0]==(b)[0])&&((a)[1]==(b)[1])&&((a)[2]==(b)[2])&&((a)[3]==(b)[3]))