Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Float2.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
10class [[nodiscard]] Float2
11{
12public:
14
15 Float2() = default;
16 Float2(const Float2 &inRHS) = default;
17 Float2 & operator = (const Float2 &inRHS) = default;
18 Float2(float inX, float inY) : x(inX), y(inY) { }
19
20 bool operator == (const Float2 &inRHS) const { return x == inRHS.x && y == inRHS.y; }
21 bool operator != (const Float2 &inRHS) const { return x != inRHS.x || y != inRHS.y; }
22
24 friend ostream & operator << (ostream &inStream, const Float2 &inV)
25 {
26 inStream << inV.x << ", " << inV.y;
27 return inStream;
28 }
29
30 float x;
31 float y;
32};
33
34static_assert(is_trivial<Float2>(), "Is supposed to be a trivial type!");
35
#define JPH_NAMESPACE_END
Definition: Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
Class that holds 2 floats, used as a storage class mainly.
Definition: Float2.h:11
Float2(const Float2 &inRHS)=default
JPH_OVERRIDE_NEW_DELETE Float2()=default
Intentionally not initialized for performance reasons.
float y
Definition: Float2.h:31
float x
Definition: Float2.h:30
Float2(float inX, float inY)
Definition: Float2.h:18