SA_Maths
Sapphire Suite's C++ Maths Library
Loading...
Searching...
No Matches
Rectangle2D.hpp
Go to the documentation of this file.
1// Copyright (c) 2023 Sapphire's Suite. All Rights Reserved.
2
3#pragma once
4
5#ifndef SAPPHIRE_MATHS_RECT2D_GUARD
6#define SAPPHIRE_MATHS_RECT2D_GUARD
7
9
10#include <SA/Support/Pragma.hpp>
11
22namespace SA
23{
29 template <typename T>
30 struct Rect2D
31 {
32 SA_PRAGMA_SDWARN_MSVC(4201)
33
34 union
35 {
38
39 struct
40 {
42 T x;
43
45 T y;
46 };
47 };
48
49 union
50 {
53
54 struct
55 {
58
61 };
62 };
63
64 SA_PRAGMA_EDWARN_MSVC()
65
66
67 Rect2D() = default;
68
75 Rect2D(const Vec2<T>& _offset, const Vec2<T>& _extent) noexcept :
76 offset{ _offset },
77 extent{ _extent }
78 {
79 }
80
89 Rect2D(T _x, T _y, T _width, T _height) noexcept :
90 offset{ _x, _y },
91 extent{ _width, _height }
92 {
93 }
94 };
95
96
97//{ Aliases
98
101
104
107
110
111
113 template <typename T>
115
118
121
124
127
128
129//}
130}
131
132
135#endif // GUARD
Vector 2 type implementation.
Rectangle2D Sapphire's class.
Definition Rectangle2D.hpp:31
T x
alias for offset.x
Definition Rectangle2D.hpp:42
T height
alias for extent.y
Definition Rectangle2D.hpp:60
T y
alias for offset.y
Definition Rectangle2D.hpp:45
Vec2< T > extent
extents.
Definition Rectangle2D.hpp:52
T width
alias for extent.x
Definition Rectangle2D.hpp:57
Vec2< T > offset
offset.
Definition Rectangle2D.hpp:37
Rect2D(T _x, T _y, T _width, T _height) noexcept
Constructor from (x, y) (offset) and (width, height) (extent).
Definition Rectangle2D.hpp:89
Vector 2 Sapphire's class.
Definition Vector2.hpp:41