9 #ifndef _TurtleBrains_Vector_h_
10 #define _TurtleBrains_Vector_h_
13 #include "../core/tb_error.h"
14 #include "../core/tb_defines.h"
59 #if defined(tb_visual_cpp)
61 #pragma warning(disable: 4201)
62 struct {
float x, y; };
65 struct {
float x, y; };
95 inline Vector2(
const float valueX,
const float valueY) :
146 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y)) ?
true :
false;
155 return (
true ==
operator==(other)) ?
false :
true;
161 inline operator const float*(void)
const {
return mComponents; }
167 inline operator float*(void) {
return mComponents; }
172 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
178 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
180 #if defined(tb_with_math_operators)
244 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y)); }
259 if (
true ==
IsZero(magnitude)) {
return Zero(); }
260 return Vector2(x / magnitude, y / magnitude);
271 if (
false ==
IsZero(magnitude))
282 inline void Scale(
float scalar) { *
this *= scalar; }
313 float mComponents[3];
315 #if defined(tb_visual_cpp)
316 #pragma warning(push)
317 #pragma warning(disable: 4201)
318 struct {
float x, y, z; };
321 struct {
float x, y, z; };
353 inline Vector3(
const float valueX,
const float valueY,
const float valueZ) :
429 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y) &&
true ==
IsEqual(z, other.z)) ?
true :
false;
438 return (
true ==
operator==(other)) ?
false :
true;
444 inline operator const float*(void)
const {
return mComponents; }
450 inline operator float*(void) {
return mComponents; }
455 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
461 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
463 #if defined(tb_with_math_operators)
501 inline Vector3&
operator*=(
float scalar) { x *= scalar; y *= scalar; z *= scalar;
return *
this; }
512 inline Vector3&
operator/=(
float scalar) { x /= scalar; y /= scalar; z /= scalar;
return *
this; }
523 inline float operator*(
const Vector3 &rhs)
const {
return (x * rhs.x) + (y * rhs.y) + (z * rhs.z); }
531 return Vector3((y * rightSide.z) - (rightSide.y * z), -((x * rightSide.z) - (rightSide.x * z)), (x * rightSide.y) - (rightSide.x * y));
539 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y) + (z * z)); }
554 if (
true ==
IsZero(magnitude)) {
return Zero(); }
555 return Vector3(x / magnitude, y / magnitude, z / magnitude);
566 if (
false ==
IsZero(magnitude))
578 inline void Scale(
float scalar) { *
this *= scalar; }
609 float mComponents[4];
611 #if defined(tb_visual_cpp)
612 #pragma warning(push)
613 #pragma warning(disable: 4201)
614 struct {
float x, y, z, w; };
617 struct {
float x, y, z, w; };
651 inline Vector4(
const float valueX,
const float valueY,
const float valueZ,
const float valueW) :
666 inline explicit Vector4(
const Vector2& other,
const float valueZ,
const float valueW) :
737 return (
true ==
IsEqual(x, other.x) &&
true ==
IsEqual(y, other.y) &&
738 true ==
IsEqual(z, other.z) &&
true ==
IsEqual(w, other.w)) ?
true :
false;
747 return (
true ==
operator==(other)) ?
false :
true;
753 inline operator const float*(void)
const {
return mComponents; }
759 inline operator float*(void) {
return mComponents; }
764 inline const float&
operator[](
const size_t index)
const {
return mComponents[index]; }
770 inline float&
operator[](
const size_t index) {
return mComponents[index]; }
772 #if defined(tb_with_math_operators)
782 inline Vector4&
operator+=(
const Vector4& rightSide) { x += rightSide.x, y += rightSide.y; z += rightSide.z; w += rightSide.w;
return *
this; }
792 inline Vector4&
operator-=(
const Vector4& rightSide) { x -= rightSide.x, y -= rightSide.y; z -= rightSide.z; w -= rightSide.w;
return *
this; }
804 friend Vector4 operator*(
float scalar,
const Vector4& rightSide) {
return Vector4(scalar * rightSide.x, scalar * rightSide.y, scalar * rightSide.z, scalar * rightSide.w); }
810 inline Vector4&
operator*=(
float scalar) { x *= scalar; y *= scalar; z *= scalar; w *= scalar;
return *
this; }
821 inline Vector4&
operator/=(
float scalar) { x /= scalar; y /= scalar; z /= scalar; w /= scalar;
return *
this; }
832 inline float operator*(
const Vector4& rightSide)
const {
return (x * rightSide.x) + (y * rightSide.y) + (z * rightSide.z) + (w * rightSide.w); }
841 inline float Magnitude(
void)
const {
return sqrt((x * x) + (y * y) + (z * z) + (w * w)); }
847 inline float MagnitudeSquared(
void)
const {
return (x * x) + (y * y) + (z * z) + (w * w); }
856 if (
true ==
IsZero(magnitude)) {
return Zero(); }
857 return Vector4(x / magnitude, y / magnitude, z / magnitude, w / magnitude);
868 if (
false ==
IsZero(magnitude))
881 inline void Scale(
float scalar) { *
this *= scalar; }
910 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
911 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
912 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
914 result->x = leftSide->x + rightSide->x;
915 result->y = leftSide->y + rightSide->y;
924 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
925 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
926 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
928 result->x = leftSide->x + rightSide->x;
929 result->y = leftSide->y + rightSide->y;
930 result->z = leftSide->z + rightSide->z;
939 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
940 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
941 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
943 result->x = leftSide->x + rightSide->x;
944 result->y = leftSide->y + rightSide->y;
945 result->z = leftSide->z + rightSide->z;
946 result->w = leftSide->w + rightSide->w;
962 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
963 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
964 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
966 result->x = leftSide->x - rightSide->x;
967 result->y = leftSide->y - rightSide->y;
976 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
977 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
978 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
980 result->x = leftSide->x - rightSide->x;
981 result->y = leftSide->y - rightSide->y;
982 result->z = leftSide->z - rightSide->z;
991 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
992 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
993 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
995 result->x = leftSide->x - rightSide->x;
996 result->y = leftSide->y - rightSide->y;
997 result->z = leftSide->z - rightSide->z;
998 result->w = leftSide->w - rightSide->w;
1013 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1014 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1016 result->x = input->x * scalar;
1017 result->y = input->y * scalar;
1026 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1027 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1029 result->x = input->x * scalar;
1030 result->y = input->y * scalar;
1031 result->z = input->z * scalar;
1040 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1041 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1043 result->x = input->x * scalar;
1044 result->y = input->y * scalar;
1045 result->z = input->z * scalar;
1046 result->w = input->w * scalar;
1061 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1062 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1064 result->x = input->x / scalar;
1065 result->y = input->y / scalar;
1074 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1075 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1077 result->x = input->x / scalar;
1078 result->y = input->y / scalar;
1079 result->z = input->z / scalar;
1088 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1089 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1091 result->x = input->x / scalar;
1092 result->y = input->y / scalar;
1093 result->z = input->z / scalar;
1094 result->w = input->w / scalar;
1108 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1109 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1111 result->x = -input->x;
1112 result->y = -input->y;
1121 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1122 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1124 result->x = -input->x;
1125 result->y = -input->y;
1126 result->z = -input->z;
1135 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1136 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1138 result->x = -input->x;
1139 result->y = -input->y;
1140 result->z = -input->z;
1141 result->w = -input->w;
1155 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1156 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1157 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y);
1165 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1166 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1167 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y) + (leftSide->z * rightSide->z);
1175 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1176 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1177 return (leftSide->x * rightSide->x) + (leftSide->y * rightSide->y) + (leftSide->z * rightSide->z) + (leftSide->w * rightSide->w);
1195 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1196 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1197 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1198 tb_error_if(leftSide == rightSide,
"tbExternalError: Invalid parameter; expected leftSide to be different from rightSide.");
1199 tb_error_if(result == leftSide || result == rightSide,
"Invalid parameter; expected result to be different than leftSide and rightSide");
1201 result->x = ((leftSide->y * rightSide->z) - (rightSide->y * leftSide->z));
1202 result->y = -(((leftSide->x * rightSide->z) - (rightSide->x * leftSide->z)));
1203 result->z = ((leftSide->x * rightSide->y) - (rightSide->x * leftSide->y));
1213 tb_error_if(
nullptr == result,
"tbExternalError: Invalid parameter for result, expected valid pointer.");
1214 tb_error_if(
nullptr == leftSide,
"tbExternalError: Invalid parameter for leftSide, expected valid pointer.");
1215 tb_error_if(
nullptr == rightSide,
"tbExternalError: Invalid parameter for rightSide, expected valid pointer.");
1216 tb_error_if(result == leftSide || result == rightSide,
"Invalid parameter; expected result to be different than leftSide and rightSide");
1218 tb_error_if(
true,
"Not sure if this is an accurate Vector4 CrossProduct");
1219 result->x = ((leftSide->y * rightSide->z) - (rightSide->y * leftSide->z));
1220 result->y = -(((leftSide->x * rightSide->z) - (rightSide->x * leftSide->z)));
1221 result->z = ((leftSide->x * rightSide->y) - (rightSide->x * leftSide->y));
1235 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1236 return sqrt((input->x * input->x) + (input->y * input->y));
1244 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1245 return sqrt((input->x * input->x) + (input->y * input->y) + (input->z * input->z));
1253 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1254 return sqrt((input->x * input->x) + (input->y * input->y) + (input->z * input->z) + (input->w * input->w));
1267 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1268 return (input->x * input->x) + (input->y * input->y);
1276 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1277 return (input->x * input->x) + (input->y * input->y) + (input->z * input->z);
1285 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1286 return (input->x * input->x) + (input->y * input->y) + (input->z * input->z) + (input->w * input->w);
1299 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1302 if (
true ==
IsZero(magnitude))
1309 result->x = input->x / magnitude;
1310 result->y = input->y / magnitude;
1321 if (
true ==
IsZero(magnitude))
1329 result->x = input->x / magnitude;
1330 result->y = input->y / magnitude;
1331 result->z = input->z / magnitude;
1342 if (
true ==
IsZero(magnitude))
1351 result->x = input->x / magnitude;
1352 result->y = input->y / magnitude;
1353 result->z = input->z / magnitude;
1354 result->w = input->w / magnitude;
1371 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1374 if (
true ==
IsZero(magnitude))
1381 result->x = input->x / magnitude;
1382 result->y = input->y / magnitude;
1392 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1395 if (
true ==
IsZero(magnitude))
1403 result->x = input->x / magnitude;
1404 result->y = input->y / magnitude;
1405 result->z = input->z / magnitude;
1415 tb_error_if(
nullptr == input,
"tbExternalError: Invalid parameter for input, expected valid pointer.");
1418 if (
true ==
IsZero(magnitude))
1427 result->x = input->x / magnitude;
1428 result->y = input->y / magnitude;
1429 result->z = input->z / magnitude;
1430 result->w = input->w / magnitude;
1442 if (
true ==
IsZero(productOfMagnitudes)) {
return 0.0f; }
1444 const float clampedValue((value < -1.0f) ? -1.0f : (value > 1.0f) ? 1.0f : value);
1445 return acos(clampedValue);
1454 result->x = sin(orientation);
1456 result->z = -cos(orientation);
1467 result.x = sin(orientation);
1468 result.y = -cos(orientation);
1483 Vector3 vZAxis(0.0f, 0.0f, -1.0f);
1484 float orientation = acos((vZAxis.x * forward.x) + (vZAxis.y * forward.y) + (vZAxis.z * forward.z));
1485 if (forward.x < 0.0f)
1487 orientation = fabs(orientation -
kTwoPi);
1504 float orientation = acos((yAxis.x * forward.x) + (yAxis.y * forward.y));
1505 if (forward.x < 0.0f)
1507 orientation = fabs(orientation -
kTwoPi);
Vector2 * Vector2NormalizeMagnitude(Vector2 *result, const Vector2 *input, float &magnitude)
Definition: tb_vector.h:1369
Definition: tb_vector.h:47
Vector4(const Vector2 &other, const float valueZ, const float valueW)
Definition: tb_vector.h:666
const float & operator[](const size_t index) const
Definition: tb_vector.h:764
Vector3 operator-(void) const
Definition: tb_vector.h:518
Vector4 * Vector4Negate(Vector4 *result, const Vector4 *input)
Definition: tb_vector.h:1133
friend Vector4 operator*(float scalar, const Vector4 &rightSide)
Definition: tb_vector.h:804
Vector4(const float valueX, const float valueY, const float valueZ, const float valueW)
Definition: tb_vector.h:651
float & operator[](const size_t index)
Definition: tb_vector.h:461
Vector2 GetNormalized(void) const
Definition: tb_vector.h:256
Vector3(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:331
bool operator!=(const Vector2 &other) const
Definition: tb_vector.h:153
Vector2 operator*(float scalar) const
Definition: tb_vector.h:205
static Vector3 * OrientationToForwardVector3(Vector3 *result, float orientation)
Definition: tb_vector.h:1452
Vector4 operator/(float scalar) const
Definition: tb_vector.h:815
Vector4(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:627
Contains objects and functions for dealing with Vector and Matrix math.
float Vector4DotProduct(const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:1173
Vector3 & operator=(const Vector3 &other)
Definition: tb_vector.h:398
float & operator[](const size_t index)
Definition: tb_vector.h:178
Vector2 & operator/=(float scalar)
Definition: tb_vector.h:228
bool operator==(const Vector3 &other) const
Definition: tb_vector.h:427
Vector3 operator^(const Vector3 &rightSide) const
Definition: tb_vector.h:529
static float ForwardVector2ToOrientation(const Vector2 &forward)
Definition: tb_vector.h:1501
float Normalize(void)
Definition: tb_vector.h:268
Vector4(const Vector3 &other, const float valueW)
Definition: tb_vector.h:680
Vector4 & operator/=(float scalar)
Definition: tb_vector.h:821
Vector4(const Vector4 &other)
Definition: tb_vector.h:694
float Vector4MagnitudeSquared(const Vector4 *input)
Definition: tb_vector.h:1283
Vector2(void)
Definition: tb_vector.h:83
Definition: tb_vector.h:39
Definition: tb_vector.h:303
float Normalize(void)
Definition: tb_vector.h:865
Vector4 * Vector4CrossProduct(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:1211
Vector3(const Vector2 &other, const float valueZ)
Definition: tb_vector.h:366
Vector4 * Vector4Add(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:937
Vector4 * Vector4Subtract(Vector4 *result, const Vector4 *leftSide, const Vector4 *rightSide)
Definition: tb_vector.h:989
bool operator==(const Vector2 &other) const
Definition: tb_vector.h:144
Vector2 * Vector2Subtract(Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:960
Vector3 GetNormalized(void) const
Definition: tb_vector.h:551
void SetLength(float length)
Definition: tb_vector.h:291
friend Vector3 operator*(float scalar, const Vector3 &rightSide)
Definition: tb_vector.h:495
float Magnitude(void) const
Definition: tb_vector.h:539
void Scale(float scalar)
Definition: tb_vector.h:282
Vector2 operator-(void) const
Definition: tb_vector.h:233
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
Vector3(void)
Definition: tb_vector.h:339
Vector3 * Vector3Add(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:922
static Vector2 Zero(void)
Definition: tb_vector.h:53
Vector3 * Vector3Scale(Vector3 *result, const Vector3 *input, const float scalar)
Definition: tb_vector.h:1024
#define tb_unused(parameter)
Definition: tb_defines.h:19
float Vector4Magnitude(const Vector4 *input)
Definition: tb_vector.h:1251
Vector3 operator+(const Vector3 &rightSide) const
Definition: tb_vector.h:467
static float ForwardVector3ToOrientation(const Vector3 &forward)
Definition: tb_vector.h:1481
Vector3 * Vector3Normalize(Vector3 *result, const Vector3 *input)
Definition: tb_vector.h:1318
Vector4 & operator*=(float scalar)
Definition: tb_vector.h:810
void Scale(float scalar)
Definition: tb_vector.h:578
Definition: tb_vector.h:40
VectorComponent
Definition: tb_vector.h:35
SkipInitialization
Definition: tb_vector.h:29
Vector3 * Vector3NormalizeMagnitude(Vector3 *result, const Vector3 *input, float &magnitude)
Definition: tb_vector.h:1390
bool operator!=(const Vector3 &other) const
Definition: tb_vector.h:436
float Magnitude(void) const
Definition: tb_vector.h:244
float Vector2Magnitude(const Vector2 *input)
Definition: tb_vector.h:1233
Vector2 * Vector2Negate(Vector2 *result, const Vector2 *input)
Definition: tb_vector.h:1106
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:195
Vector4 & operator=(const Vector4 &other)
Definition: tb_vector.h:714
Vector2 operator+(const Vector2 &rightSide) const
Definition: tb_vector.h:184
Vector3 & operator-=(const Vector3 &rightSide)
Definition: tb_vector.h:483
Vector2 & operator=(const Vector2 &other)
Definition: tb_vector.h:125
float operator*(const Vector4 &rightSide) const
Definition: tb_vector.h:832
Vector2 & operator*=(float scalar)
Definition: tb_vector.h:217
float Magnitude(void) const
Definition: tb_vector.h:841
float operator*(const Vector3 &rhs) const
Definition: tb_vector.h:523
static Vector4 Zero(void)
Definition: tb_vector.h:605
Vector4 * Vector4Scale(Vector4 *result, const Vector4 *input, const float scalar)
Definition: tb_vector.h:1038
Vector4 * Vector4Normalize(Vector4 *result, const Vector4 *input)
Definition: tb_vector.h:1339
Vector3 * Vector3Subtract(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:974
Vector2 * Vector2Add(Vector2 *result, const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:908
void Scale(float scalar)
Definition: tb_vector.h:881
bool operator!=(const Vector4 &other) const
Definition: tb_vector.h:745
Vector4 * Vector4NormalizeMag(Vector4 *result, const Vector4 *input, float &magnitude)
Definition: tb_vector.h:1413
const float & operator[](const size_t index) const
Definition: tb_vector.h:455
static Vector2 & OrientationToForwardVector2(Vector2 &result, float orientation)
Definition: tb_vector.h:1465
~Vector4(void)
Definition: tb_vector.h:705
Vector2 * Vector2Normalize(Vector2 *result, const Vector2 *input)
Definition: tb_vector.h:1297
~Vector3(void)
Definition: tb_vector.h:389
float MagnitudeSquared(void) const
Definition: tb_vector.h:847
float Vector3AngleBetween(const Vector3 *left, const Vector3 *right)
Definition: tb_vector.h:1439
float Vector2MagnitudeSquared(const Vector2 *input)
Definition: tb_vector.h:1265
Vector2 operator/(float scalar) const
Definition: tb_vector.h:222
void SetLength(float length)
Definition: tb_vector.h:890
float & operator[](const size_t index)
Definition: tb_vector.h:770
float Normalize(void)
Definition: tb_vector.h:563
float MagnitudeSquared(void) const
Definition: tb_vector.h:250
float Vector3DotProduct(const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:1163
Vector2(const SkipInitialization &fastAndStupid)
Definition: tb_vector.h:75
Vector4 GetNormalized(void) const
Definition: tb_vector.h:853
Vector4 operator+(const Vector4 &rightSide) const
Definition: tb_vector.h:776
Vector3 * Vector3ScaleDivide(Vector3 *result, const Vector3 *input, const float scalar)
Definition: tb_vector.h:1072
bool IsZero(const float value, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:49
Vector2(const Vector2 &other)
Definition: tb_vector.h:107
Vector2(const float valueX, const float valueY)
Definition: tb_vector.h:95
Vector2 * Vector2ScaleDivide(Vector2 *result, const Vector2 *input, const float scalar)
Definition: tb_vector.h:1059
bool IsEqual(const float leftValue, const float rightValue, const float tolerance=tbMath::kTolerance)
Definition: tb_math.h:30
Vector3(const float valueX, const float valueY, const float valueZ)
Definition: tb_vector.h:353
Vector3 * Vector3CrossProduct(Vector3 *result, const Vector3 *leftSide, const Vector3 *rightSide)
Definition: tb_vector.h:1193
friend Vector2 operator*(float scalar, const Vector2 &rightSide)
Definition: tb_vector.h:211
float MagnitudeSquared(void) const
Definition: tb_vector.h:545
float Vector2DotProduct(const Vector2 *leftSide, const Vector2 *rightSide)
Definition: tb_vector.h:1153
Vector4 * Vector4ScaleDivide(Vector4 *result, const Vector4 *input, const float scalar)
Definition: tb_vector.h:1086
const float & operator[](const size_t index) const
Definition: tb_vector.h:172
Vector4 operator*(float scalar) const
Definition: tb_vector.h:798
Vector2 & operator+=(const Vector2 &rightSide)
Definition: tb_vector.h:190
Definition: tb_vector.h:38
bool operator==(const Vector4 &other) const
Definition: tb_vector.h:735
~Vector2(void)
Definition: tb_vector.h:116
Vector4 & operator+=(const Vector4 &rightSide)
Definition: tb_vector.h:782
void SetLength(float length)
Definition: tb_vector.h:587
Vector4(void)
Definition: tb_vector.h:635
float Vector3MagnitudeSquared(const Vector3 *input)
Definition: tb_vector.h:1274
Vector3 & operator/=(float scalar)
Definition: tb_vector.h:512
Definition: tb_vector.h:37
Vector3 & operator*=(float scalar)
Definition: tb_vector.h:501
Vector3 operator-(const Vector3 &rightSide) const
Definition: tb_vector.h:478
Vector3(const Vector3 &other)
Definition: tb_vector.h:379
Vector4 operator-(const Vector4 &rightSide) const
Definition: tb_vector.h:787
#define tb_error_if(errorTest, message,...)
Definition: tb_error.h:37
static Vector3 Zero(void)
Definition: tb_vector.h:309
Vector3 operator*(float scalar) const
Definition: tb_vector.h:489
float operator*(const Vector2 &rhs) const
Definition: tb_vector.h:238
Vector4 & operator-=(const Vector4 &rightSide)
Definition: tb_vector.h:792
Vector3 * Vector3Negate(Vector3 *result, const Vector3 *input)
Definition: tb_vector.h:1119
Vector2 & operator-=(const Vector2 &rightSide)
Definition: tb_vector.h:200
Vector3 operator/(float scalar) const
Definition: tb_vector.h:506
Vector4 operator-(void) const
Definition: tb_vector.h:827
float Vector3Magnitude(const Vector3 *input)
Definition: tb_vector.h:1242
Definition: tb_vector.h:599
Vector3 & operator+=(const Vector3 &rightSide)
Definition: tb_vector.h:473
Vector2 * Vector2Scale(Vector2 *result, const Vector2 *input, const float scalar)
Definition: tb_vector.h:1011