Path: blob/master/thirdparty/jolt_physics/Jolt/Math/Double3.h
9913 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Core/HashCombine.h>78JPH_NAMESPACE_BEGIN910/// Class that holds 3 doubles. Used as a storage class. Convert to DVec3 for calculations.11class [[nodiscard]] Double312{13public:14JPH_OVERRIDE_NEW_DELETE1516Double3() = default; ///< Intentionally not initialized for performance reasons17Double3(const Double3 &inRHS) = default;18Double3 & operator = (const Double3 &inRHS) = default;19Double3(double inX, double inY, double inZ) : x(inX), y(inY), z(inZ) { }2021double operator [] (int inCoordinate) const22{23JPH_ASSERT(inCoordinate < 3);24return *(&x + inCoordinate);25}2627bool operator == (const Double3 &inRHS) const28{29return x == inRHS.x && y == inRHS.y && z == inRHS.z;30}3132bool operator != (const Double3 &inRHS) const33{34return x != inRHS.x || y != inRHS.y || z != inRHS.z;35}3637double x;38double y;39double z;40};4142static_assert(std::is_trivial<Double3>(), "Is supposed to be a trivial type!");4344JPH_NAMESPACE_END4546// Create a std::hash/JPH::Hash for Double347JPH_MAKE_HASHABLE(JPH::Double3, t.x, t.y, t.z)484950