Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Double3.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10
12class [[nodiscard]] Double3
13{
14public:
16
17 Double3() = default;
18 Double3(const Double3 &inRHS) = default;
19 Double3 & operator = (const Double3 &inRHS) = default;
20 Double3(double inX, double inY, double inZ) : x(inX), y(inY), z(inZ) { }
21
22 double operator [] (int inCoordinate) const
23 {
24 JPH_ASSERT(inCoordinate < 3);
25 return *(&x + inCoordinate);
26 }
27
28 bool operator == (const Double3 &inRHS) const
29 {
30 return x == inRHS.x && y == inRHS.y && z == inRHS.z;
31 }
32
33 bool operator != (const Double3 &inRHS) const
34 {
35 return x != inRHS.x || y != inRHS.y || z != inRHS.z;
36 }
37
38 double x;
39 double y;
40 double z;
41};
42
43static_assert(is_trivial<Double3>(), "Is supposed to be a trivial type!");
44
46
47// Create a std::hash/JPH::Hash for Double3
48JPH_MAKE_HASHABLE(JPH::Double3, t.x, t.y, t.z)
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
#define JPH_MAKE_HASHABLE(type,...)
Definition HashCombine.h:191
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
Class that holds 3 doubles. Used as a storage class. Convert to DVec3 for calculations.
Definition Double3.h:13
double z
Definition Double3.h:40
double y
Definition Double3.h:39
JPH_OVERRIDE_NEW_DELETE Double3()=default
Intentionally not initialized for performance reasons.
Double3(const Double3 &inRHS)=default
double x
Definition Double3.h:38
Double3(double inX, double inY, double inZ)
Definition Double3.h:20