Nuclide
Software Development Kit for id Tech
|
Vector Math Helper Functions. More...
#include "math_vector.h"
Go to the source code of this file.
Macros | |
#define | MATH_PI 3.1415926 |
Approximation of Pi. More... | |
#define | vectoangles vectoangles2 |
Functions | |
vector (vector fwd, optional vector up) vectoangles2 | |
void (vector angle) rotatevectorsbyangle | |
void | makevectors (vector angles) |
float | lerpAngle (float startAngle, float endAngle, float lerpAmount) |
Euler-angle lerping function that accounts for negative degrees. More... | |
float | lerp (float startValue, float endValue, float lerpAmount) |
Linear lerp function. More... | |
float | fixAngleDelta (float angleValue) |
Tecursive function that fixes an euler angle. More... | |
vector | fixAngle (vector inputAngle) |
Recursive function that fixes euler angles. More... | |
vector | reflect (vector hitDirection, vector planeNormal) |
Takes a direction and a plane normal, returns a new trajectory. More... | |
vector | randomVector (bool flyUp) |
Calculates a random Vector, with every axis being a value between -1.0 and 1.0, unless flyUp is true . More... | |
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) More... | |
vector | angleDifference (vector angle1, vector angle2) |
Calculates the difference between two angles. More... | |
vector | hsvToRGB (float h, float s, float v) |
Converts a Hue-Saturation-Value pair to an RGB vector. More... | |
Variables | |
noref const vector | g_vec_null = [0.0f, 0.0f, 0.0f] |
vector | v_forward |
vector | v_up |
vector | v_right |
Vector Math Helper Functions.
Math Helper Functions.
Helper functions for various mathematical operations. This header can be included in other libraries and projects to help deal with these sorts of issues. It is usually included by default in a library project. If you want to include this file into your own progs, you can include math.h
from src/shared/
.
#define MATH_PI 3.1415926 |
Approximation of Pi.
#define vectoangles vectoangles2 |
Calculates the difference between two angles.
angle1 | is the first angle. |
angle2 | is the second angle. |
Recursive function that fixes euler angles.
inputAngle | is the angle value to 'fix'. |
Tecursive function that fixes an euler angle.
angleValue | is the angle value to 'fix'. |
Converts a Hue-Saturation-Value pair to an RGB vector.
angle1 | is the first angle. |
angle2 | is the second angle. |
Linear lerp function.
startValue | is the value closest when lerpAmount is 0.0 |
endValue | is the value closest when lerpAmount is 1.0 |
lerpAmount | is the lerp value. Between 0.0 and 1.0 is common. |
Euler-angle lerping function that accounts for negative degrees.
startValue | is the value closest when lerpAmount is 0.0 |
endValue | is the value closest when lerpAmount is 1.0 |
lerpAmount | is the lerp value. Between 0.0 and 1.0 is common. |
Calculates a random Vector, with every axis being a value between -1.0 and 1.0, unless flyUp is true
.
flyUp | being true will result in the Z-axis never returning negative values. |
Takes a direction and a plane normal, returns a new trajectory.
hitDirection | is from where a trace/shot is aiming from. Usually a result from anglesToForward(). |
planeNormal | is the impact normal. Usually retrieved from a traceline() call updating the trace_plane_normal global. |
Takes a position and a pivot point and rotates point by N degrees around the pivot (YAW)
pos | is the points' current, absolute position. |
pivot | is the absolute position of the pivot point. |
degr | is the rotation amount in degrees. |
vector | ( | vector | fwd, |
optional vector | up | ||
) |
void | ( | vector | angle | ) |
noref const vector g_vec_null = [0.0f, 0.0f, 0.0f] |
vector v_forward |
vector v_right |
vector v_up |