summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-05 22:38:08 +0200
committerworktycho <work.tycho@gmail.com>2015-05-05 22:38:08 +0200
commitf3101f1d047683a799b4ea439a05d7c7e8fefe86 (patch)
tree6468d564a3b55970210ef5d17cbf7300d4773661 /src/Vector3.h
parentMerge pull request #1939 from SafwatHalaby/Polising (diff)
parentChanged fabs() to std::abs() (diff)
downloadcuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar.gz
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar.bz2
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar.lz
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar.xz
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.tar.zst
cuberite-f3101f1d047683a799b4ea439a05d7c7e8fefe86.zip
Diffstat (limited to 'src/Vector3.h')
-rw-r--r--src/Vector3.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index c5431438e..071997f50 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -78,6 +78,11 @@ public:
);
}
+ inline bool HasNonZeroLength(void) const
+ {
+ return ((x != 0) || (y != 0) || (z != 0));
+ }
+
inline double Length(void) const
{
return sqrt(static_cast<double>(x * x + y * y + z * z));
@@ -121,11 +126,7 @@ public:
{
// Perform a bitwise comparison of the contents - we want to know whether this object is exactly equal
// To perform EPS-based comparison, use the EqualsEps() function
- return (
- (memcmp(&x, &a_Rhs.x, sizeof(x)) == 0) &&
- (memcmp(&y, &a_Rhs.y, sizeof(y)) == 0) &&
- (memcmp(&z, &a_Rhs.z, sizeof(z)) == 0)
- );
+ return !((x != a_Rhs.x) || (y != a_Rhs.y) || (z != a_Rhs.z));
}
inline bool EqualsEps(const Vector3<T> & a_Rhs, T a_Eps) const