85 Any toAny(
const std::string& name)
const;
95 Vector3(
float _x,
float _y,
float _z);
96 explicit Vector3(
float coordinate[3]);
97 explicit Vector3(
double coordinate[3]);
119 return (x != 0) || (y != 0) || (z != 0);
160 return *
this * (1.0f / s);
171 return (*
this *= (1.0f / s));
183 return Vector3(powf(x, p), powf(y, p), powf(z, p));
239 if (mag < 0.0000001f) {
241 }
else if (mag < 1.00001f && mag > 0.99999f) {
244 return *
this * (1.0f / mag);
278 float iOutside)
const;
318 inline float min()
const {
323 inline float max()
const {
358 return (*
this) + (v - *
this) * alpha;
411 inline float sum()
const {
439 "makeAxes requires Z to have unit length");
445 X -= *
this * this->
dot(X);
596 std::ostream&
operator<<(std::ostream& os,
const Vector3&);
622 return ((
float*)
this)[i];
626 return ((
float*)
this)[i];
658 return ( x == rkVector.
x && y == rkVector.
y && z == rkVector.
z );
663 return ( x != rkVector.
x || y != rkVector.
y || z != rkVector.
z );
668 return Vector3(x + rkVector.
x, y + rkVector.
y, z + rkVector.
z);
673 return Vector3(x - rkVector.
x, y - rkVector.
y, z - rkVector.
z);
678 return Vector3(x * rkVector.
x, y * rkVector.
y, z * rkVector.
z);
682 return Vector3(x * f, y * f, z * f);
687 return Vector3(x / rkVector.
x, y / rkVector.
y, z / rkVector.
z);
737 return x*x + y*y + z*
z;
747 return ::sqrtf(x*x + y*y + z*z);
758 const float invSqrt = 1.0f / sqrtf(lenSquared);
759 return Vector3(x * invSqrt, y * invSqrt, z * invSqrt);
765 float lenSquared = x * x + y * y + z *
z;
766 float invSqrt =
rsq(lenSquared);
767 return Vector3(x * invSqrt, y * invSqrt, z * invSqrt);
772 return x*rkVector.
x + y*rkVector.
y + z*rkVector.
z;
777 return Vector3(y*rkVector.
z - z*rkVector.
y, z*rkVector.
x - x*rkVector.
z,
778 x*rkVector.
y - y*rkVector.
x);
783 Vector3 kCross(y*rkVector.
z - z*rkVector.
y, z*rkVector.
x - x*rkVector.
z,
784 x*rkVector.
y - y*rkVector.
x);
800 return G3D::fuzzyEq(fabsf(x) + fabsf(y) + fabsf(z), 0.0f);
Vector3 &__fastcall operator+=(const Vector3 &v)
Definition: Vector3.h:696
void moveTowards(const Vector3 &goal, float maxTranslation)
Definition: Vector3.cpp:42
Vector4 yyzy() const
Definition: Vector3.cpp:502
Vector4 xzyy() const
Definition: Vector3.cpp:495
Vector3 yxz() const
Definition: Vector3.cpp:442
Vector3 __fastcall operator+(const Vector3 &v) const
Definition: Vector3.h:667
Vector4 zxzy() const
Definition: Vector3.cpp:500
float squaredMagnitude() const
Definition: Vector3.h:736
bool operator>(const Vector3 &) const
static Vector3 hemiRandom(const Vector3 &normal, Random &r=Random::common())
Random vector distributed over the hemisphere about normal.
Definition: Vector3.cpp:303
Vector3int32
Definition: Vector3int32.h:29
Vector4 yyyz() const
Definition: Vector3.cpp:520
Vector4 zzzx() const
Definition: Vector3.cpp:479
bool isZero() const
Definition: Vector3.h:799
float x
Definition: Vector3.h:62
Vector4 xyyx() const
Definition: Vector3.cpp:465
Vector4 xyxx() const
Definition: Vector3.cpp:456
Vector3 directionOrZero() const
Definition: Vector3.h:237
Vector3 pow(float p) const
Definition: Vector3.h:182
Vector3 yyy() const
Definition: Vector3.cpp:436
Vector3 zzy() const
Definition: Vector3.cpp:440
Vector3 zxx() const
Definition: Vector3.cpp:425
Vector4 xxyz() const
Definition: Vector3.cpp:516
Vector4 zzzy() const
Definition: Vector3.cpp:506
float sum() const
Definition: Vector3.h:411
class Matrix3 cross() const
Definition: Vector3.cpp:393
Vector4 zzyy() const
Definition: Vector3.cpp:497
Vector2 xz() const
Definition: Vector3.cpp:417
Vector3 xyz() const
Definition: Vector3.cpp:444
Definition: Vector3.h:122
Vector4 yzyz() const
Definition: Vector3.cpp:523
Vector3 yzy() const
Definition: Vector3.cpp:439
Vector3 &__fastcall operator-=(const Vector3 &v)
Definition: Vector3.h:704
double round(double f)
Definition: g3dmath.h:214
Vector4 zzyz() const
Definition: Vector3.cpp:524
Vector3 yyz() const
Definition: Vector3.cpp:445
Vector3 __fastcall operator/(float s) const
Definition: Vector3.h:159
static const Vector3 & minFinite()
Definition: Vector3.cpp:126
Vector4 zzxy() const
Definition: Vector3.cpp:488
bool nonZero() const
Definition: Vector3.h:118
Vector2 xy() const
Definition: Vector3.cpp:414
Vector4 zyxx() const
Definition: Vector3.cpp:458
#define X
Definition: CollisionDetection.cpp:2281
double abs(double fValue)
Definition: g3dmath.h:617
static Vector3 random(Random &r=Random::common())
Random unit vector, uniformly distributed on the sphere.
Definition: Vector3.cpp:226
Vector2 zx() const
Definition: Vector3.cpp:413
Vector4 xyzz() const
Definition: Vector3.cpp:528
Vector4 zyyx() const
Definition: Vector3.cpp:467
Definition: Vector4int8.h:30
Definition: HashTrait.h:105
Vector4 yxyy() const
Definition: Vector3.cpp:490
bool operator>=(const Vector3 &) const
Vector3 clamp(const Vector3 &low, const Vector3 &high) const
Definition: Vector3.h:329
Definition: PositionTrait.h:5
Vector3 fastDirection() const
Definition: Vector3.h:764
Axis primaryAxis() const
Definition: Vector3.cpp:129
bool any(float x)
Definition: g3dmath.h:424
Vector3 &__fastcall operator=(const Vector3 &rkVector)
Definition: Vector3.h:631
Vector4 xxxx() const
Definition: Vector3.cpp:453
bool operator!=(const Vector3 &rkVector) const
Definition: Vector3.h:662
Vector3 yxx() const
Definition: Vector3.cpp:424
void getTangents(Vector3 &X, Vector3 &Y) const
Definition: Vector3.h:437
void deserialize(std::string &s, BinaryInput &b)
Definition: serialize.h:16
Vector4 zyzy() const
Definition: Vector3.cpp:503
Vector2 yy() const
Definition: Vector3.cpp:415
Vector3 zzz() const
Definition: Vector3.cpp:449
bool fuzzyNe(double a, double b)
Definition: g3dmath.h:861
Vector3 &__fastcall operator/=(float s)
Definition: Vector3.h:170
static Vector3 & ignore()
Definition: Vector3.cpp:114
float rsq(float x)
Definition: g3dmath.h:380
double clamp(double val, double low, double hi)
Definition: g3dmath.h:571
Vector4 yyzx() const
Definition: Vector3.cpp:475
Axis
Definition: Vector3.h:122
Vector4 xxyx() const
Definition: Vector3.cpp:462
Vector4 xxxz() const
Definition: Vector3.cpp:507
float __fastcall dot(const Vector3 &rkVector) const
Definition: Vector3.h:771
Vector3 clamp(float low, float high) const
Definition: Vector3.h:336
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
Vector3 xxx() const
Definition: Vector3.cpp:423
Vector3 direction() const
Definition: Vector3.h:756
Vector3 xyx() const
Definition: Vector3.cpp:426
Vector4 yxzy() const
Definition: Vector3.cpp:499
Vector4 yxxy() const
Definition: Vector3.cpp:481
float y
Definition: Vector3.h:62
float length() const
Definition: Vector3.h:751
Vector4 zxzx() const
Definition: Vector3.cpp:473
Vector4 yzyy() const
Definition: Vector3.cpp:496
Vector3 yyx() const
Definition: Vector3.cpp:427
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Vector3 fastUnit() const
Definition: Vector3.h:287
Vector4 yzyx() const
Definition: Vector3.cpp:469
Vector4 yyxx() const
Definition: Vector3.cpp:457
Vector3 zyy() const
Definition: Vector3.cpp:437
Vector4 zxxy() const
Definition: Vector3.cpp:482
Vector3()
Definition: Vector3.h:604
const float &__fastcall operator[](int i) const
Definition: Vector3.h:621
Vector4 yxzx() const
Definition: Vector3.cpp:472
Vector3 __fastcall operator*(float s) const
Definition: Vector3.h:681
Vector2 xx() const
Definition: Vector3.cpp:411
Vector4 zzyx() const
Definition: Vector3.cpp:470
static const Vector3 & unitX()
Definition: Vector3.cpp:121
Vector4 zxzz() const
Definition: Vector3.cpp:527
static const Vector3 & zero()
Definition: Vector3.cpp:119
Vector3 lerp(const Vector3 &v, float alpha) const
Definition: Vector3.h:357
Vector4 zyzz() const
Definition: Vector3.cpp:530
Definition: Vector3.h:122
Vector4 yxxz() const
Definition: Vector3.cpp:508
Vector4 xzyx() const
Definition: Vector3.cpp:468
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Vector3 xxy() const
Definition: Vector3.cpp:432
Easy loading and saving of human-readable configuration files.
Definition: Any.h:184
Vector4 xyzx() const
Definition: Vector3.cpp:474
Vector4 zzxx() const
Definition: Vector3.cpp:461
bool operator<=(const Vector3 &) const
Vector3 floor() const
Definition: Vector3.h:344
size_t hashCode() const
Definition: Vector3.cpp:155
void serialize(const std::string &s, BinaryOutput &b)
Definition: serialize.h:12
Vector4 xzzz() const
Definition: Vector3.cpp:531
static const Vector3 & unitY()
Definition: Vector3.cpp:122
Vector4 yyxz() const
Definition: Vector3.cpp:511
Vector3 refractionDirection(const Vector3 &normal, float iInside, float iOutside) const
Definition: Vector3.cpp:321
Vector3 zyx() const
Definition: Vector3.cpp:428
Vector4 yzxx() const
Definition: Vector3.cpp:460
Vector3 yxy() const
Definition: Vector3.cpp:433
Vector4 yzxy() const
Definition: Vector3.cpp:487
Vector4 zyzx() const
Definition: Vector3.cpp:476
Vector4 zyyy() const
Definition: Vector3.cpp:494
void deserialize(class BinaryInput &b)
Definition: Vector3.cpp:190
Vector4 xzzx() const
Definition: Vector3.cpp:477
Vector4 zxyy() const
Definition: Vector3.cpp:491
Vector3 unit() const
Definition: Vector3.h:281
A simple tokenizer for parsing text files.
Definition: TextInput.h:223
Vector4 zyxz() const
Definition: Vector3.cpp:512
Vector3 xzy() const
Definition: Vector3.cpp:438
float magnitude() const
Definition: Vector3.h:746
Vector4 xzxy() const
Definition: Vector3.cpp:486
Vector4 xxxy() const
Definition: Vector3.cpp:480
Vector4 yzzz() const
Definition: Vector3.cpp:532
void serialize(class BinaryOutput &b) const
Definition: Vector3.cpp:219
static void orthonormalize(Vector3 akVector[3])
Definition: Vector3.cpp:357
Vector4 xzzy() const
Definition: Vector3.cpp:504
Vector4 yzzx() const
Definition: Vector3.cpp:478
Definition: Vector3.h:122
Vector3 zzx() const
Definition: Vector3.cpp:431
Vector4 zzxz() const
Definition: Vector3.cpp:515
Vector4 yxyz() const
Definition: Vector3.cpp:517
Vector4 zyxy() const
Definition: Vector3.cpp:485
Vector3 zxy() const
Definition: Vector3.cpp:434
Vector4 xxzz() const
Definition: Vector3.cpp:525
static const Vector3 & unitZ()
Definition: Vector3.cpp:123
Vector4 xxzx() const
Definition: Vector3.cpp:471
Vector4 yyxy() const
Definition: Vector3.cpp:484
Vector3 yzz() const
Definition: Vector3.cpp:448
Definition: TextOutput.h:60
Vector3 xyy() const
Definition: Vector3.cpp:435
bool isFinite() const
Definition: Vector3.h:652
static void getPosition(const G3D::Vector2 &v, G3D::Vector3 &p)
Definition: Vector3.h:837
Vector3 zyz() const
Definition: Vector3.cpp:446
Vector4 xyxy() const
Definition: Vector3.cpp:483
Any toAny() const
Definition: Vector3.cpp:94
Definition: Vector3.h:122
Vector4 yxxx() const
Definition: Vector3.cpp:454
Vector3 xzx() const
Definition: Vector3.cpp:429
Vector4 yyyx() const
Definition: Vector3.cpp:466
Vector4 xyyy() const
Definition: Vector3.cpp:492
static Vector3 cosSphereRandom(const Vector3 &n, Random &r=Random::common())
Definition: Vector3.cpp:263
Vector4 yxyx() const
Definition: Vector3.cpp:463
Vector4 zxyx() const
Definition: Vector3.cpp:464
Vector3 round() const
Definition: Vector3.h:349
Vector3 yzx() const
Definition: Vector3.cpp:430
Vector2 yx() const
Definition: Vector3.cpp:412
Vector4 zyyz() const
Definition: Vector3.cpp:521
float z
Definition: Vector3.h:62
static const Vector3 & maxFinite()
Definition: Vector3.cpp:127
Vector3 xzz() const
Definition: Vector3.cpp:447
Vector4 yyyy() const
Definition: Vector3.cpp:493
Vector3 reflectAbout(const Vector3 &normal) const
Definition: Vector3.cpp:233
static Vector3 cosHemiRandom(const Vector3 &n, Random &r=Random::common())
Random unit vector, distributed according to .
Definition: Vector3.cpp:243
Vector4 xxyy() const
Definition: Vector3.cpp:489
Vector4 yxzz() const
Definition: Vector3.cpp:526
Vector3 unitCross(const Vector3 &rkVector) const
Definition: Vector3.h:782
Vector4 zzzz() const
Definition: Vector3.cpp:533
Vector4 yzxz() const
Definition: Vector3.cpp:514
Vector2 zz() const
Definition: Vector3.cpp:419
static size_t hashCode(const G3D::Vector3 &key)
Definition: Vector3.h:830
std::ostream & operator<<(std::ostream &os, const NetAddress &)
Definition: NetworkDevice.cpp:26
bool fuzzyEq(const Vector3 &other) const
Definition: Vector3.h:640
Definition: BinaryOutput.h:52
bool operator==(const Vector3 &rkVector) const
Definition: Vector3.h:657
Vector4 xyxz() const
Definition: Vector3.cpp:510
float max() const
Definition: Vector3.h:323
Vector3 movedTowards(const Vector3 &goal, float maxTranslation) const
Definition: Vector3.cpp:35
static Vector3 cosPowHemiRandom(const Vector3 &n, const float k, Random &r=Random::common())
Random unit vector, distributed according to .
Definition: Vector3.cpp:283
Vector4 zxxx() const
Definition: Vector3.cpp:455
Vector2 yz() const
Definition: Vector3.cpp:418
Vector4 xxzy() const
Definition: Vector3.cpp:498
Vector4 zxxz() const
Definition: Vector3.cpp:509
Vector4 yzzy() const
Definition: Vector3.cpp:505
static void getPosition(const G3D::Vector3 &v, G3D::Vector3 &p)
Definition: Vector3.h:841
Vector4 zxyz() const
Definition: Vector3.cpp:518
Vector2 zy() const
Definition: Vector3.cpp:416
Vector4 xzxx() const
Definition: Vector3.cpp:459
float min() const
Definition: Vector3.h:318
float average() const
Definition: Vector3.h:415
Vector4 xzyz() const
Definition: Vector3.cpp:522
#define const
Definition: zconf.h:217
Vector3 &__fastcall operator*=(float s)
Definition: Vector3.h:712
Vector3 reflectionDirection(const Vector3 &normal) const
Definition: Vector3.cpp:315
static const Vector3 & inf()
Definition: Vector3.cpp:124
bool fuzzyNe(const Vector3 &other) const
Definition: Vector3.h:646
bool operator<(const Vector3 &) const
Vector3 xxz() const
Definition: Vector3.cpp:441
Vector3 Point3
Definition: Vector3.h:820
static const Vector3 & one()
Definition: Vector3.cpp:120
static const Vector3 & nan()
Definition: Vector3.cpp:125
bool isUnit() const
Definition: Vector3.h:805
Vector4 xzxz() const
Definition: Vector3.cpp:513
bool isNaN() const
Definition: Vector3.cpp:83
float squaredLength() const
Definition: Vector3.h:741
static Random & common()
Definition: Random.cpp:16
Vector4 yyzz() const
Definition: Vector3.cpp:529
bool fuzzyEq(double a, double b)
Definition: g3dmath.h:857
Vector3 zxz() const
Definition: Vector3.cpp:443
G3D::Color3 operator*(float s, const G3D::Color3 &c)
Definition: Color3.h:275
Vector3 __fastcall operator-() const
Definition: Vector3.h:691
#define Y
Definition: CollisionDetection.cpp:2282
bool isFinite(double x)
Definition: g3dmath.h:525
std::string toString() const
Definition: Vector3.cpp:386
Vector4 xyyz() const
Definition: Vector3.cpp:519
Vector4 xyzy() const
Definition: Vector3.cpp:501