9 #ifndef _TurtleBrains_Vector_h_
10 #define _TurtleBrains_Vector_h_
12 #include "../core/tb_configuration.h"
13 #include "../core/tb_error.h"
14 #include "../core/tb_defines.h"
59 struct {
float x, y; };
88 inline Vector2(
const float valueX,
const float valueY) :
139 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y)) ?
true :
false;
148 return (
true ==
operator==(other)) ?
false :
true;
154 inline operator const float*(void)
const {
return mComponents; }
160 inline operator float*(void) {
return mComponents; }
165 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
171 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
173 #ifndef tb_math_less_operators
237 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y)); }
253 return Vector2(x / magnitude, y / magnitude);
264 if (
false ==
IsZero(magnitude))
275 inline void Scale(
float scalar) { *
this *= scalar; }
306 float mComponents[3];
307 struct {
float x, y, z; };
338 inline Vector3(
const float valueX,
const float valueY,
const float valueZ) :
414 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y) &&
true ==
IsEqual(z, other.z)) ?
true :
false;
423 return (
true ==
operator==(other)) ?
false :
true;
429 inline operator const float*(void)
const {
return mComponents; }
435 inline operator float*(void) {
return mComponents; }
440 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
446 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
451 #ifndef tb_math_less_operators
489 inline Vector3&
operator*=(
float scalar) { x *= scalar; y *= scalar; z *= scalar;
return *
this; }
500 inline Vector3&
operator/=(
float scalar) { x /= scalar; y /= scalar; z /= scalar;
return *
this; }
511 inline float operator*(
const Vector3 &rhs)
const {
return (x * rhs.x) + (y * rhs.y) + (z * rhs.z); }
519 return Vector3((y * rightSide.z) - (rightSide.y * z), -((x * rightSide.z) - (rightSide.x * z)), (x * rightSide.y) - (rightSide.x * y));
527 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y) + (z * z)); }
543 return Vector3(x / magnitude, y / magnitude, z / magnitude);
554 if (
false ==
IsZero(magnitude))
566 inline void Scale(
float scalar) { *
this *= scalar; }
597 float mComponents[4];
598 struct {
float x, y, z, w; };
631 inline Vector4(
const float valueX,
const float valueY,
const float valueZ,
const float valueW) :
646 inline explicit Vector4(
const Vector2& other,
const float valueZ,
const float valueW) :
717 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y) &&
718 true ==
IsEqual(z, other.z) &&
true ==
IsEqual(w, other.w)) ?
true :
false;
727 return (
true ==
operator==(other)) ?
false :
true;
733 inline operator const float*(void)
const {
return mComponents; }
739 inline operator float*(void) {
return mComponents; }
744 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
750 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
756 #ifndef tb_math_less_operators
766 inline Vector4&
operator+=(
const Vector4& rightSide) { x += rightSide.x, y += rightSide.y; z += rightSide.z; w += rightSide.w;
return *
this; }
776 inline Vector4&
operator-=(
const Vector4& rightSide) { x -= rightSide.x, y -= rightSide.y; z -= rightSide.z; w -= rightSide.w;
return *
this; }
788 friend Vector4 operator*(
float scalar,
const Vector4& rightSide) {
return Vector4(scalar * rightSide.x, scalar * rightSide.y, scalar * rightSide.z, scalar * rightSide.w); }
794 inline Vector4&
operator*=(
float scalar) { x *= scalar; y *= scalar; z *= scalar; w *= scalar;
return *
this; }
805 inline Vector4&
operator/=(
float scalar) { x /= scalar; y /= scalar; z /= scalar; w /= scalar;
return *
this; }
816 inline float operator*(
const Vector4& rightSide)
const {
return (x * rightSide.x) + (y * rightSide.y) + (z * rightSide.z) + (w * rightSide.w); }
825 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y) + (z * z) + (w * w)); }
831 inline float MagnitudeSquared(
void)
const {
return (x * x) + (y * y) + (z * z) + (w * w); }
841 return Vector4(x / magnitude, y / magnitude, z / magnitude, w / magnitude);
852 if (
false ==
IsZero(magnitude))
865 inline void Scale(
float scalar) { *
this *= scalar; }
894 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
895 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
896 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
898 result->x = leftSide->x + rightSide->x;
899 result->y = leftSide->y + rightSide->y;
908 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
909 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
910 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
912 result->x = leftSide->x + rightSide->x;
913 result->y = leftSide->y + rightSide->y;
914 result->z = leftSide->z + rightSide->z;
923 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
924 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
925 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
927 result->x = leftSide->x + rightSide->x;
928 result->y = leftSide->y + rightSide->y;
929 result->z = leftSide->z + rightSide->z;
930 result->w = leftSide->w + rightSide->w;
946 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
947 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
948 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
950 result->x = leftSide->x - rightSide->x;
951 result->y = leftSide->y - rightSide->y;
960 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
961 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
962 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
964 result->x = leftSide->x - rightSide->x;
965 result->y = leftSide->y - rightSide->y;
966 result->z = leftSide->z - rightSide->z;
975 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
976 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
977 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
979 result->x = leftSide->x - rightSide->x;
980 result->y = leftSide->y - rightSide->y;
981 result->z = leftSide->z - rightSide->z;
982 result->w = leftSide->w - rightSide->w;
997 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
998 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1000 result->x = input->x * scalar;
1001 result->y = input->y * scalar;
1010 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1011 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1013 result->x = input->x * scalar;
1014 result->y = input->y * scalar;
1015 result->z = input->z * scalar;
1024 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1025 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1027 result->x = input->x * scalar;
1028 result->y = input->y * scalar;
1029 result->z = input->z * scalar;
1030 result->w = input->w * scalar;
1045 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1046 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1048 result->x = input->x / scalar;
1049 result->y = input->y / scalar;
1058 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1059 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1061 result->x = input->x / scalar;
1062 result->y = input->y / scalar;
1063 result->z = input->z / scalar;
1072 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1073 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1075 result->x = input->x / scalar;
1076 result->y = input->y / scalar;
1077 result->z = input->z / scalar;
1078 result->w = input->w / scalar;
1092 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1093 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1095 result->x = -input->x;
1096 result->y = -input->y;
1105 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1106 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1108 result->x = -input->x;
1109 result->y = -input->y;
1110 result->z = -input->z;
1119 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1120 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1122 result->x = -input->x;
1123 result->y = -input->y;
1124 result->z = -input->z;
1125 result->w = -input->w;
1139 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1140 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1141 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y);
1149 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1150 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1151 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y) + (leftSide->z * rightSide->z);
1159 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1160 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1161 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y) + (leftSide->z * rightSide->z) + (leftSide->w * rightSide->w);
1176 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1177 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1178 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1179 tb_error_if(leftSide == rightSide,
"tbExternalError: Invalid parameter; expected leftSide to be different from rightSide.");
1180 tb_error_if(result == leftSide || result == rightSide,
"Invalid parameter; expected result to be different than leftSide and rightSide");
1182 result->x = ((leftSide->y * rightSide->z) - (rightSide->y * leftSide->z));
1183 result->y = -(((leftSide->x * rightSide->z) - (rightSide->x * leftSide->z)));
1184 result->z = ((leftSide->x * rightSide->y) - (rightSide->x * leftSide->y));
1194 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1195 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1196 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1197 tb_error_if(result == leftSide || result == rightSide,
"Invalid parameter; expected result to be different than leftSide and rightSide");
1199 tb_error_if(
true,
"Not sure if this is an accurate Vector4 CrossProduct");
1200 result->x = ((leftSide->y * rightSide->z) - (rightSide->y * leftSide->z));
1201 result->y = -(((leftSide->x * rightSide->z) - (rightSide->x * leftSide->z)));
1202 result->z = ((leftSide->x * rightSide->y) - (rightSide->x * leftSide->y));
1216 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1217 return sqrt((input->x * input->x) + (input->y * input->y));
1225 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1226 return sqrt((input->x * input->x) + (input->y * input->y) + (input->z * input->z));
1234 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1235 return sqrt((input->x * input->x) + (input->y * input->y) + (input->z * input->z) + (input->w * input->w));
1248 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1249 return (input->x * input->x) + (input->y * input->y);
1257 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1258 return (input->x * input->x) + (input->y * input->y) + (input->z * input->z);
1266 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1267 return (input->x * input->x) + (input->y * input->y) + (input->z * input->z) + (input->w * input->w);
1280 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1283 if (
true ==
IsZero(magnitude))
1290 result->x = input->x / magnitude;
1291 result->y = input->y / magnitude;
1302 if (
true ==
IsZero(magnitude))
1310 result->x = input->x / magnitude;
1311 result->y = input->y / magnitude;
1312 result->z = input->z / magnitude;
1323 if (
true ==
IsZero(magnitude))
1332 result->x = input->x / magnitude;
1333 result->y = input->y / magnitude;
1334 result->z = input->z / magnitude;
1335 result->w = input->w / magnitude;
1352 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1355 if (
true ==
IsZero(magnitude))
1362 result->x = input->x / magnitude;
1363 result->y = input->y / magnitude;
1373 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1376 if (
true ==
IsZero(magnitude))
1384 result->x = input->x / magnitude;
1385 result->y = input->y / magnitude;
1386 result->z = input->z / magnitude;
1396 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1399 if (
true ==
IsZero(magnitude))
1408 result->x = input->x / magnitude;
1409 result->y = input->y / magnitude;
1410 result->z = input->z / magnitude;
1411 result->w = input->w / magnitude;
1423 if (
true ==
IsZero(productOfMagnitudes)) {
return 0.0f; }
1425 const float clampedValue((value < -1.0f) ? -1.0f : (value > 1.0f) ? 1.0f : value);
1426 return acos(clampedValue);
1435 result->x = sin(orientation);
1437 result->z = -cos(orientation);
1448 result.x = sin(orientation);
1449 result.y = -cos(orientation);
1464 Vector3 vZAxis(0.0f, 0.0f, -1.0f);
1465 float orientation = acos((vZAxis.x * forward.x) + (vZAxis.y * forward.y) + (vZAxis.z * forward.z));
1466 if (forward.x < 0.0f)
1468 orientation = fabs(orientation -
kTwoPi);
1485 float orientation = acos((yAxis.x * forward.x) + (yAxis.y * forward.y));
1486 if (forward.x < 0.0f)
1488 orientation = fabs(orientation -
kTwoPi);
Vector2 * Vector2NormalizeMagnitude(Vector2 *result, const Vector2 *input, float &magnitude)
Definition: tb_vector.h:1350
Definition: tb_vector.h:48
Vector4(const Vector2 &other, const float valueZ, const float valueW)
Definition: tb_vector.h:646
const float & operator[](const size_t index) const
Definition: tb_vector.h:744
Vector3 operator-(void) const
Definition: tb_vector.h:506
Vector4 * Vector4Negate(Vector4 *result, const Vector4 *input)
Definition: tb_vector.h:1117
friend Vector4 operator*(float scalar, const Vector4 &rightSide)
Definition: tb_vector.h:788
Vector4(const float valueX, const float valueY, const float valueZ, const float valueW)
Definition: tb_vector.h:631
float & operator[](const size_t index)
Definition: tb_vector.h:446
Vector2 GetNormalized(void) const
Definition: tb_vector.h:249
Vector3(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:316
bool operator!=(const Vector2 &other) const
Definition: tb_vector.h:146
Vector2 operator*(float scalar) const
Definition: tb_vector.h:198
static Vector3 * OrientationToForwardVector3(Vector3 *result, float orientation)
Definition: tb_vector.h:1433
Vector4 operator/(float scalar) const
Definition: tb_vector.h:799
Vector4(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:607
Contains objects and functions for dealing with Vector and Matrix math.
float Vector4DotProduct(const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:1157
Vector3 & operator=(const Vector3 &other)
Definition: tb_vector.h:383
float & operator[](const size_t index)
Definition: tb_vector.h:171
Vector2 & operator/=(float scalar)
Definition: tb_vector.h:221
bool operator==(const Vector3 &other) const
Definition: tb_vector.h:412
Vector3 operator^(const Vector3 &rightSide) const
Definition: tb_vector.h:517
static float ForwardVector2ToOrientation(const Vector2 &forward)
Definition: tb_vector.h:1482
float Normalize(void)
Definition: tb_vector.h:261
Vector4(const Vector3 &other, const float valueW)
Definition: tb_vector.h:660
Vector4 & operator/=(float scalar)
Definition: tb_vector.h:805
Vector4(const Vector4 &other)
Definition: tb_vector.h:674
float Vector4MagnitudeSquared(const Vector4 *input)
Definition: tb_vector.h:1264
Vector2(void)
Definition: tb_vector.h:76
Definition: tb_vector.h:40
Definition: tb_vector.h:296
float Normalize(void)
Definition: tb_vector.h:849
static const Vector2 kZero
Definition: tb_vector.h:54
Vector4 * Vector4CrossProduct(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:1192
Vector3(const Vector2 &other, const float valueZ)
Definition: tb_vector.h:351
Vector4 * Vector4Add(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:921
Vector4 * Vector4Subtract(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:973
bool operator==(const Vector2 &other) const
Definition: tb_vector.h:137
Vector2 * Vector2Subtract(Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:944
Vector3 GetNormalized(void) const
Definition: tb_vector.h:539
void SetLength(float length)
Definition: tb_vector.h:284
friend Vector3 operator*(float scalar, const Vector3 &rightSide)
Definition: tb_vector.h:483
float Magnitude(void) const
Definition: tb_vector.h:527
void Scale(float scalar)
Definition: tb_vector.h:275
Vector2 operator-(void) const
Definition: tb_vector.h:226
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
Vector3(void)
Definition: tb_vector.h:324
Vector3 * Vector3Add(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:906
Vector3 * Vector3Scale(Vector3 *result, const Vector3 *input, const float scalar)
Definition: tb_vector.h:1008
#define tb_unused(parameter)
Definition: tb_defines.h:19
float Vector4Magnitude(const Vector4 *input)
Definition: tb_vector.h:1232
Vector3 operator+(const Vector3 &rightSide) const
Definition: tb_vector.h:455
static float ForwardVector3ToOrientation(const Vector3 &forward)
Definition: tb_vector.h:1462
Vector3 * Vector3Normalize(Vector3 *result, const Vector3 *input)
Definition: tb_vector.h:1299
Vector4 & operator*=(float scalar)
Definition: tb_vector.h:794
void Scale(float scalar)
Definition: tb_vector.h:566
Definition: tb_vector.h:41
VectorComponent
Definition: tb_vector.h:36
SkipInitialization
Definition: tb_vector.h:30
Vector3 * Vector3NormalizeMagnitude(Vector3 *result, const Vector3 *input, float &magnitude)
Definition: tb_vector.h:1371
bool operator!=(const Vector3 &other) const
Definition: tb_vector.h:421
float Magnitude(void) const
Definition: tb_vector.h:237
float Vector2Magnitude(const Vector2 *input)
Definition: tb_vector.h:1214
Vector2 * Vector2Negate(Vector2 *result, const Vector2 *input)
Definition: tb_vector.h:1090
static const float kTwoPi(kPi *2.0f)
A constant for Pi * 2 stored in a float.
Vector2 operator-(const Vector2 &rightSide) const
Definition: tb_vector.h:188
Vector4 & operator=(const Vector4 &other)
Definition: tb_vector.h:694
Vector2 operator+(const Vector2 &rightSide) const
Definition: tb_vector.h:177
Vector3 & operator-=(const Vector3 &rightSide)
Definition: tb_vector.h:471
Vector2 & operator=(const Vector2 &other)
Definition: tb_vector.h:118
float operator*(const Vector4 &rightSide) const
Definition: tb_vector.h:816
Vector2 & operator*=(float scalar)
Definition: tb_vector.h:210
float Magnitude(void) const
Definition: tb_vector.h:825
float operator*(const Vector3 &rhs) const
Definition: tb_vector.h:511
Vector4 * Vector4Scale(Vector4 *result, const Vector4 *input, const float scalar)
Definition: tb_vector.h:1022
Vector4 * Vector4Normalize(Vector4 *result, const Vector4 *input)
Definition: tb_vector.h:1320
Vector3 * Vector3Subtract(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:958
Vector2 * Vector2Add(Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:892
void Scale(float scalar)
Definition: tb_vector.h:865
bool operator!=(const Vector4 &other) const
Definition: tb_vector.h:725
Vector4 * Vector4NormalizeMag(Vector4 *result, const Vector4 *input, float &magnitude)
Definition: tb_vector.h:1394
const float & operator[](const size_t index) const
Definition: tb_vector.h:440
static Vector2 & OrientationToForwardVector2(Vector2 &result, float orientation)
Definition: tb_vector.h:1446
~Vector4(void)
Definition: tb_vector.h:685
Vector2 * Vector2Normalize(Vector2 *result, const Vector2 *input)
Definition: tb_vector.h:1278
~Vector3(void)
Definition: tb_vector.h:374
float MagnitudeSquared(void) const
Definition: tb_vector.h:831
float Vector3AngleBetween(const Vector3 *left, const Vector3 *right)
Definition: tb_vector.h:1420
float Vector2MagnitudeSquared(const Vector2 *input)
Definition: tb_vector.h:1246
Vector2 operator/(float scalar) const
Definition: tb_vector.h:215
void SetLength(float length)
Definition: tb_vector.h:874
float & operator[](const size_t index)
Definition: tb_vector.h:750
float Normalize(void)
Definition: tb_vector.h:551
float MagnitudeSquared(void) const
Definition: tb_vector.h:243
float Vector3DotProduct(const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:1147
static const Vector4 kZero
Definition: tb_vector.h:593
Vector2(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:68
Vector4 GetNormalized(void) const
Definition: tb_vector.h:837
Vector4 operator+(const Vector4 &rightSide) const
Definition: tb_vector.h:760
Vector3 * Vector3ScaleDivide(Vector3 *result, const Vector3 *input, const float scalar)
Definition: tb_vector.h:1056
bool IsZero(const float value, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:41
Vector2(const Vector2 &other)
Definition: tb_vector.h:100
Vector2(const float valueX, const float valueY)
Definition: tb_vector.h:88
Vector2 * Vector2ScaleDivide(Vector2 *result, const Vector2 *input, const float scalar)
Definition: tb_vector.h:1043
bool IsEqual(const float leftValue, const float rightValue, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:28
Vector3(const float valueX, const float valueY, const float valueZ)
Definition: tb_vector.h:338
Vector3 * Vector3CrossProduct(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:1174
friend Vector2 operator*(float scalar, const Vector2 &rightSide)
Definition: tb_vector.h:204
static const Vector3 kZero
Definition: tb_vector.h:302
float MagnitudeSquared(void) const
Definition: tb_vector.h:533
float Vector2DotProduct(const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:1137
Vector4 * Vector4ScaleDivide(Vector4 *result, const Vector4 *input, const float scalar)
Definition: tb_vector.h:1070
const float & operator[](const size_t index) const
Definition: tb_vector.h:165
Vector4 operator*(float scalar) const
Definition: tb_vector.h:782
Vector2 & operator+=(const Vector2 &rightSide)
Definition: tb_vector.h:183
Definition: tb_vector.h:39
bool operator==(const Vector4 &other) const
Definition: tb_vector.h:715
~Vector2(void)
Definition: tb_vector.h:109
Vector4 & operator+=(const Vector4 &rightSide)
Definition: tb_vector.h:766
void SetLength(float length)
Definition: tb_vector.h:575
Vector4(void)
Definition: tb_vector.h:615
float Vector3MagnitudeSquared(const Vector3 *input)
Definition: tb_vector.h:1255
Vector3 & operator/=(float scalar)
Definition: tb_vector.h:500
Definition: tb_vector.h:38
Vector3 & operator*=(float scalar)
Definition: tb_vector.h:489
Vector3 operator-(const Vector3 &rightSide) const
Definition: tb_vector.h:466
Vector3(const Vector3 &other)
Definition: tb_vector.h:364
Vector4 operator-(const Vector4 &rightSide) const
Definition: tb_vector.h:771
#define tb_error_if(errorTest, message,...)
Definition: tb_error.h:37
Vector3 operator*(float scalar) const
Definition: tb_vector.h:477
float operator*(const Vector2 &rhs) const
Definition: tb_vector.h:231
Vector4 & operator-=(const Vector4 &rightSide)
Definition: tb_vector.h:776
Vector3 * Vector3Negate(Vector3 *result, const Vector3 *input)
Definition: tb_vector.h:1103
Vector2 & operator-=(const Vector2 &rightSide)
Definition: tb_vector.h:193
Vector3 operator/(float scalar) const
Definition: tb_vector.h:494
Vector4 operator-(void) const
Definition: tb_vector.h:811
float Vector3Magnitude(const Vector3 *input)
Definition: tb_vector.h:1223
Definition: tb_vector.h:587
Vector3 & operator+=(const Vector3 &rightSide)
Definition: tb_vector.h:461
Vector2 * Vector2Scale(Vector2 *result, const Vector2 *input, const float scalar)
Definition: tb_vector.h:995