#include "l_cmd.h"
#include "l_math.h"
Include dependency graph for l_math.c:

Go to the source code of this file.
|
||||||||||||
|
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. 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 }
|
|
||||||||||||||||
|
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 111 of file l_math.c. 00111 {
00112 axis[0][0] = 1;
00113 axis[0][1] = 0;
00114 axis[0][2] = 0;
00115 axis[1][0] = 0;
00116 axis[1][1] = 1;
00117 axis[1][2] = 0;
00118 axis[2][0] = 0;
00119 axis[2][1] = 0;
00120 axis[2][2] = 1;
00121 }
|
|
||||||||||||
|
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. Referenced by VL_R_FloodLight(), and VS_R_FloodLight(). 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 70 of file l_math.c. 00070 {
00071 int i;
00072 vec3_t corner;
00073 float a, b;
00074
00075 for (i=0 ; i<3 ; i++) {
00076 a = fabs( mins[i] );
00077 b = fabs( maxs[i] );
00078 corner[i] = a > b ? a : b;
00079 }
00080
00081 return VectorLength (corner);
00082 }
|
|
||||||||||||
|
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 123 of file l_math.c. References DotProduct, and v. Referenced by CM_Trace(). 00123 {
00124 return DotProduct(v, v);
00125 }
|
|
|
Definition at line 203 of file l_math.c. Referenced by VL_R_FloodLight(), and VS_R_FloodLight(). 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