40anglesMake(vector angle)
105 float diffX = pointA[0] - pointB[0];
106 float diffY = pointA[1] - pointB[1];
107 float diffZ = pointA[2] - pointB[2];
108 return (diffX * diffX) + (diffY * diffY) + (diffZ * diffZ);
130 float diffX = pointA[0] - pointB[0];
131 float diffY = pointA[1] - pointB[1];
132 return sqrt((diffX * diffX) + (diffY * diffY));
142closer(vector referencePoint, vector pointA, vector pointB)
146 return (distanceA < distanceB) ? true :
false;
169 static float lastOutput = 0.0f;
171 if (toCalculate == lastInput) {
175 lastInput = toCalculate;
176 lastOutput = vlen(toCalculate);
198 return dotproduct(vectorA, vectorB);
208vectorLerp(vector fromVector, vector toVector,
float lerpFraction)
210 static float vectorLerp_Lerp(
float fA,
float fB,
float fPercent) {
211 return (fA * (1 - fPercent)) + (fB * fPercent);
215 outputVector[0] = vectorLerp_Lerp(fromVector[0], toVector[0], lerpFraction);
216 outputVector[1] = vectorLerp_Lerp(fromVector[1], toVector[1], lerpFraction);
217 outputVector[2] = vectorLerp_Lerp(fromVector[2], toVector[2], lerpFraction);
231 if (toNormalize == lastInput) {
235 lastInput = toNormalize;
236 lastOutput = normalize(toNormalize);
250 if (toAngles == lastInput) {
254 lastInput = toAngles;
271 if (forwardDir == lastInput && rollDir == lastInput2) {
275 lastInput = forwardDir;
276 lastInput2 = rollDir;
const vector g_vec_null
Definition: global.h:111
vector v_up
Definition: math.h:46
vector anglesToUp(vector angle)
Calculates the up vector of a set of euler-angles.
Definition: math_vector.h:87
vector vectorLerp(vector fromVector, vector toVector, float lerpFraction)
Calculates an interpolated (linear) point between two points.
Definition: math_vector.h:208
vector combineAngles(vector angleA, vector angleB)
Calculates a set of angles from a given vector.
Definition: math_vector.h:154
float length(vector toCalculate)
Calculates accurate length of a given vector.
Definition: math_vector.h:166
#define vectoangles
Definition: math.h:43
float distance2D(vector pointA, vector pointB)
Calculates the distance between two vectors, ignoring the height difference between them.
Definition: math_vector.h:128
float distance(vector pointA, vector pointB)
Calculates the distance between two points.
Definition: math_vector.h:117
vector dirFromTarget(vector lookingEnt, vector targetEnt)
Definition: math_vector.h:301
float vectorDot(vector vectorA, vector vectorB)
Calculate the dot product of two vectors.
Definition: math_vector.h:196
var vector g_vectorCacheRight
Definition: math_vector.h:36
vector vectorToAnglesRoll(vector forwardDir, vector rollDir)
Calculates a set of angles from a given vector, with roll support.
Definition: math_vector.h:265
bool closer(vector referencePoint, vector pointA, vector pointB)
Figure out which point is the closest between two options.
Definition: math_vector.h:142
vector vectorToAngles(vector toAngles)
Calculates a set of angles from a given vector.
Definition: math_vector.h:245
vector anglesToRight(vector angle)
Calculates the right vector of a set of euler-angles.
Definition: math_vector.h:71
void rotatevectorsbyangle(vector angle)
float lengthSquared(vector target)
Calculates the length of a given vector using a dot product.
Definition: math_vector.h:185
var vector g_vectorCacheForward
Definition: math_vector.h:35
vector v_right
Definition: math.h:47
var vector g_vectorCacheUp
Definition: math_vector.h:37
var vector g_vectorCacheLast
Definition: math_vector.h:34
vector lerpAngleVector(vector inputAngle, vector endAngle, float lerpAmount)
Lerps between two angles.
Definition: math_vector.h:288
float distanceSquared(vector pointA, vector pointB)
Calculates the squared distance between two points.
Definition: math_vector.h:103
vector anglesToForward(vector angle)
Calculates the forward vector of a set of euler-angles.
Definition: math_vector.h:55
vector v_forward
Definition: math.h:45
void makevectors(vector angles)
Definition: math.h:48
vector fixAngle(vector inputAngle)
Recursive function that fixes euler angles.
Definition: math.h:127
vector vectorNormalize(vector toNormalize)
Calculates a normalized version of a given vector.
Definition: math_vector.h:226
string target
Definition: defs.h:23