#include <math.h>
Include dependency graph for l_math.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | DEG2RAD(a) ( a * M_PI ) / 180.0F |
| #define | DotProduct(x, y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) |
| #define | EQUAL_EPSILON 0.001 |
| #define | M_PI 3.14159265358979323846 |
| #define | PITCH 0 |
| #define | Q_PI 3.14159265358979323846 |
| #define | ROLL 2 |
| #define | SIDE_BACK 1 |
| #define | SIDE_CROSS -2 |
| #define | SIDE_FRONT 0 |
| #define | SIDE_ON 2 |
| #define | Vector4Copy(a, b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];} |
| #define | VectorAdd(a, b, c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];} |
| #define | VectorClear(x) {x[0] = x[1] = x[2] = 0;} |
| #define | VectorCopy(a, b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} |
| #define | VectorMA(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s)) |
| #define | VectorNegate(x, y) {y[0]=-x[0];y[1]=-x[1];y[2]=-x[2];} |
| #define | VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s)) |
| #define | VectorSubtract(a, b, c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];} |
| #define | YAW 1 |
Typedefs | |
| typedef vec_t | vec3_t [3] |
| typedef vec_t | vec4_t [4] |
| typedef float | vec_t |
Functions | |
| vec_t | _DotProduct (vec3_t v1, vec3_t v2) |
| void | _VectorAdd (vec3_t va, vec3_t vb, vec3_t out) |
| void | _VectorCopy (vec3_t in, vec3_t out) |
| void | _VectorMA (vec3_t va, double scale, vec3_t vb, vec3_t vc) |
| void | _VectorScale (vec3_t v, vec_t scale, vec3_t out) |
| void | _VectorSubtract (vec3_t va, vec3_t vb, vec3_t out) |
| void | AddPointToBounds (const vec3_t v, vec3_t mins, vec3_t maxs) |
| void | AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) |
| void | ClearBounds (vec3_t mins, vec3_t maxs) |
| vec_t | ColorNormalize (vec3_t in, vec3_t out) |
| void | CreateRotationMatrix (vec3_t angles, float matrix[3][3]) |
| void | CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross) |
| vec_t | Q_rint (vec_t in) |
| void | R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]) |
| void | RotatePoint (vec3_t point, float matrix[3][3]) |
| qboolean | VectorCompare (vec3_t v1, vec3_t v2) |
| void | VectorInverse (vec3_t v) |
| double | VectorLength (vec3_t v) |
| vec_t | VectorNormalize (vec3_t inout) |
| vec_t | VectorNormalize2 (const vec3_t v, vec3_t out) |
Variables | |
| vec3_t | vec3_origin |
|
|
Definition at line 48 of file l_math.h. Referenced by CG_AddParticleToScene(), DoRailDiscs(), FakeTexCoordsToTexMat(), R_Init(), RotatePointAroundVector(), and UI_DrawPlayer(). |
|
|
|
|
|
|
|
Definition at line 42 of file l_math.h. Referenced by BG_TouchJumpPad(), BotAimAtEnemy(), BotInputToUserCommand(), BotMapScripts(), CL_CreateCmd(), IN_CenterView(), and vectoyaw(). |
|
|
Definition at line 46 of file l_math.h. Referenced by Brush_MakeSidedSphere(), DrawBrushEntityName(), CXYWnd::DrawCameraIcon(), InsertMD3Model(), PaintedModel(), Patch_RotateTexture(), Select_RotateAxis(), VectorRotate(), CXYWnd::XY_MouseDown(), and CXYWnd::XY_MouseMoved(). |
|
|
Definition at line 44 of file l_math.h. Referenced by BotInputToUserCommand(). |
|
|
Definition at line 39 of file l_math.h. Referenced by ClipSkyPolygon(), MergeWindings(), VL_ChopWindingWithBrush(), VL_LightSurfaceWithVolume(), VL_R_FloodLight(), VS_ChopWindingWithBrush(), VS_LightSurfaceWithVolume(), and VS_R_FloodLight(). |
|
|
|
|
|
Definition at line 37 of file l_math.h. Referenced by ClipSkyPolygon(), and MergeWindings(). |
|
|
Definition at line 38 of file l_math.h. Referenced by ChopWindingInPlace(), ClipSkyPolygon(), ClipWindingEpsilon(), PassageChopWinding(), R_ChopPolyBehindPlane(), VisChopWinding(), VL_ChopWinding(), VL_R_FloodLight(), VL_SplitLightVolume(), VL_SplitWinding(), VS_ChopWinding(), VS_R_FloodLight(), VS_SplitLightVolume(), VS_SplitWinding(), Winding_Clip(), and Winding_SplitEpsilon(). |
|
|
Definition at line 64 of file l_math.h. Referenced by CM_AddFacetBevels(), CM_DrawDebugSurface(), CM_FindPlane(), CM_FindPlane2(), CM_TraceThroughPatchCollide(), CM_ValidateFacet(), and UI_SPLevelMenu_MenuDraw(). |
|
|
|
|
|
|
|
|
|
Definition at line 43 of file l_math.h. Referenced by BotAimAtEnemy(), BotInputToUserCommand(), BotMapScripts(), CG_PlayerAngles(), CG_PlayerFlag(), CG_Viewpos_f(), CL_CreateCmd(), G_TryPushingEntity(), UI_PlayerAngles(), vectoyaw(), CXYWnd::XY_MouseDown(), and CXYWnd::XY_MouseMoved(). |
|
|
|
|
|
|
||||||||||||
|
Definition at line 170 of file l_math.c.
|
|
||||||||||||||||
|
Definition at line 182 of file l_math.c.
|
|
||||||||||||
|
Definition at line 189 of file l_math.c.
|
|
||||||||||||||||||||
|
Definition at line 163 of file l_math.c. References va(). 00164 {
00165 vc[0] = va[0] + scale*vb[0];
00166 vc[1] = va[1] + scale*vb[1];
00167 vc[2] = va[2] + scale*vb[2];
00168 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 196 of file l_math.c. 00197 {
00198 out[0] = v[0] * scale;
00199 out[1] = v[1] * scale;
00200 out[2] = v[2] * scale;
00201 }
|
|
||||||||||||||||
|
Definition at line 175 of file l_math.c.
|
|
||||||||||||||||
|
Definition at line 276 of file l_math.c. 00277 {
00278 int i;
00279 vec_t val;
00280
00281 for (i=0 ; i<3 ; i++)
00282 {
00283 val = v[i];
00284 if (val < mins[i])
00285 mins[i] = val;
00286 if (val > maxs[i])
00287 maxs[i] = val;
00288 }
00289 }
|
|
||||||||||||||||||||
|
Definition at line 29 of file l_math.c. 00030 {
00031 float angle;
00032 static float sr, sp, sy, cr, cp, cy;
00033 // static to help MS compiler fp bugs
00034
00035 angle = angles[YAW] * (M_PI*2 / 360);
00036 sy = sin(angle);
00037 cy = cos(angle);
00038 angle = angles[PITCH] * (M_PI*2 / 360);
00039 sp = sin(angle);
00040 cp = cos(angle);
00041 angle = angles[ROLL] * (M_PI*2 / 360);
00042 sr = sin(angle);
00043 cr = cos(angle);
00044
00045 if (forward)
00046 {
00047 forward[0] = cp*cy;
00048 forward[1] = cp*sy;
00049 forward[2] = -sp;
00050 }
00051 if (right)
00052 {
00053 right[0] = (-1*sr*sp*cy+-1*cr*-sy);
00054 right[1] = (-1*sr*sp*sy+-1*cr*cy);
00055 right[2] = -1*sr*cp;
00056 }
00057 if (up)
00058 {
00059 up[0] = (cr*sp*cy+-sr*-sy);
00060 up[1] = (cr*sp*sy+-sr*cy);
00061 up[2] = cr*cp;
00062 }
00063 }
|
|
||||||||||||
|
Definition at line 270 of file l_math.c. 00271 {
00272 mins[0] = mins[1] = mins[2] = 99999;
00273 maxs[0] = maxs[1] = maxs[2] = -99999;
00274 }
|
|
||||||||||||
|
Definition at line 241 of file l_math.c. 00242 {
00243 float max, scale;
00244
00245 max = in[0];
00246 if (in[1] > max)
00247 max = in[1];
00248 if (in[2] > max)
00249 max = in[2];
00250
00251 if (max == 0)
00252 return 0;
00253
00254 scale = 1.0 / max;
00255
00256 VectorScale (in, scale, out);
00257
00258 return max;
00259 }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 156 of file l_math.c. 00157 {
00158 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
00159 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
00160 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
00161 }
|
|
|
Definition at line 151 of file l_math.c. 00152 {
00153 return floor(in + 0.5);
00154 }
|
|
||||||||||||||||
|
Definition at line 89 of file l_math.c. 00090 {
00091 out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
00092 in1[0][2] * in2[2][0];
00093 out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
00094 in1[0][2] * in2[2][1];
00095 out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
00096 in1[0][2] * in2[2][2];
00097 out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
00098 in1[1][2] * in2[2][0];
00099 out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
00100 in1[1][2] * in2[2][1];
00101 out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
00102 in1[1][2] * in2[2][2];
00103 out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
00104 in1[2][2] * in2[2][0];
00105 out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
00106 in1[2][2] * in2[2][1];
00107 out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
00108 in1[2][2] * in2[2][2];
00109 }
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 140 of file l_math.c. 00141 {
00142 int i;
00143
00144 for (i=0 ; i<3 ; i++)
00145 if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON)
00146 return false;
00147
00148 return true;
00149 }
|
|
|
Definition at line 263 of file l_math.c.
|
|
|
Definition at line 127 of file l_math.c. 00128 {
00129 int i;
00130 double length;
00131
00132 length = 0;
00133 for (i=0 ; i< 3 ; i++)
00134 length += v[i]*v[i];
00135 length = sqrt (length); // FIXME
00136
00137 return length;
00138 }
|
|
|
Definition at line 203 of file l_math.c. 00204 {
00205 vec_t length, ilength;
00206
00207 length = sqrt (inout[0]*inout[0] + inout[1]*inout[1] + inout[2]*inout[2]);
00208 if (length == 0)
00209 {
00210 VectorClear (inout);
00211 return 0;
00212 }
00213
00214 ilength = 1.0/length;
00215 inout[0] = inout[0]*ilength;
00216 inout[1] = inout[1]*ilength;
00217 inout[2] = inout[2]*ilength;
00218
00219 return length;
00220 }
|
|
||||||||||||
|
Definition at line 222 of file l_math.c. 00223 {
00224 vec_t length, ilength;
00225
00226 length = sqrt (in[0]*in[0] + in[1]*in[1] + in[2]*in[2]);
00227 if (length == 0)
00228 {
00229 VectorClear (out);
00230 return 0;
00231 }
00232
00233 ilength = 1.0/length;
00234 out[0] = in[0]*ilength;
00235 out[1] = in[1]*ilength;
00236 out[2] = in[2]*ilength;
00237
00238 return length;
00239 }
|
|
|
|
1.3.9.1