29#define MATH_PI 3.1415926
37#define vectoangles vectoangles2
45 float sr, sp, sy, cr, cp, cy;
61 v_right[0] = (-1*sr*sp*cy+-1*cr*-sy);
62 v_right[1] = (-1*sr*sp*sy+-1*cr*cy);
65 v_up[0] = (cr*sp*cy+-sr*-sy);
66 v_up[1] = (cr*sp*sy+-sr*cy);
79lerpAngle(
float startAngle,
float endAngle,
float lerpAmount)
81 float shortest_angle = ((((endAngle - startAngle) % 360.0f) + 540.0f) % 360.0f) - 180.0f;
82 return shortest_angle * lerpAmount;
92lerp(
float startValue,
float endValue,
float lerpAmount)
94 return (startValue * (1 - lerpAmount)) + (endValue * lerpAmount);
104 if (angleValue > 180) {
106 }
else if (angleValue < -180) {
137 return hitDirection - 2 *
dotproduct(hitDirection, planeNormal) * planeNormal;
148 tmp[0] = random() - 0.5f;
149 tmp[1] = random() - 0.5f;
151 if ( flyUp ==
true ) {
154 tmp[2] = random() - 0.5f;
170 new[0] = pivot[0] + (pos[0] - pivot[0]) * cos(degr) - (pos[1] - pivot[1]) * sin(degr);
171 new[1] = pivot[1] + (pos[0] - pivot[0]) * sin(degr) + (pos[1] - pivot[1]) * cos(degr);
183 static float Math_AngleDiff_S(
float from,
float to) {
184 float angleDelta = from - to;
186 if (angleDelta > 180) {
188 }
else if (angleDelta < -180) {
201 newAngle[0] = Math_AngleDiff_S(angle1[0], angle2[0]);
202 newAngle[1] = Math_AngleDiff_S(angle1[1], angle2[1]);
203 newAngle[2] = Math_AngleDiff_S(angle1[2], angle2[2]);
218 h = max(0.0, min(360.0, h));
219 s = max(0.0, min(100.0,
s));
220 v = max(0.0, min(100.0, v));
226 col[0] = col[1] = col[2] = rint(v*255);
235 t = v * (1 -
s * (1 -
f));
239 col[0] = rint(255*v);
240 col[1] = rint(255*t);
241 col[2] = rint(255*p);
244 col[0] = rint(255*q);
245 col[1] = rint(255*v);
246 col[2] = rint(255*p);
249 col[0] = rint(255*p);
250 col[1] = rint(255*v);
251 col[2] = rint(255*t);
254 col[0] = rint(255*p);
255 col[1] = rint(255*q);
256 col[2] = rint(255*v);
259 col[0] = rint(255*t);
260 col[1] = rint(255*p);
261 col[2] = rint(255*v);
264 col[0] = rint(255*v);
265 col[1] = rint(255*p);
266 col[2] = rint(255*q);
#define dotproduct(v1, v2)
Definition: fteextensions.qc:2464
get float f
Definition: fteextensions.qc:3825
const float M_PI
Definition: fteextensions.qc:864
get __int i
Definition: fteextensions.qc:3826
string s
Definition: fteextensions.qc:3376
vector v_up
Definition: math.h:40
float lerp(float startValue, float endValue, float lerpAmount)
Linear lerp function.
Definition: math.h:92
float fixAngleDelta(float angleValue)
Tecursive function that fixes an euler angle.
Definition: math.h:102
void(vector angle) rotatevectorsbyangle
noref const vector g_vec_null
Definition: math.h:30
vector reflect(vector hitDirection, vector planeNormal)
Takes a direction and a plane normal, returns a new trajectory.
Definition: math.h:135
vector rotateAroundPoint(vector pos, vector pivot, float degr)
Takes a position and a pivot point and rotates point by N degrees around the pivot (YAW)
Definition: math.h:167
vector v_right
Definition: math.h:41
vector angleDifference(vector angle1, vector angle2)
Calculates the difference between two angles.
Definition: math.h:181
float lerpAngle(float startAngle, float endAngle, float lerpAmount)
Euler-angle lerping function that accounts for negative degrees.
Definition: math.h:79
vector v_forward
Definition: math.h:39
vector hsvToRGB(float h, float s, float v)
Converts a Hue-Saturation-Value pair to an RGB vector.
Definition: math.h:213
void makevectors(vector angles)
Definition: math.h:42
vector fixAngle(vector inputAngle)
Recursive function that fixes euler angles.
Definition: math.h:121
vector randomVector(bool flyUp)
Calculates a random Vector, with every axis being a value between -1.0 and 1.0, unless flyUp is true.
Definition: math.h:145
vector(vector fwd, optional vector up) vectoangles2
noref vector angles
Definition: ui_3dview.qc:18