Covellite++
Version: 2.3.2 Revision: 2584 Platform: x64 Build: 19:03 05.09.2026
Кроссплатформенный фреймворк для разработки приложений на С++
Toggle main menu visibility
Загрузка...
Поиск...
Не найдено
CubeCoords.hpp
1
2
#pragma once
3
4
namespace
basement
5
{
6
7
namespace
model
8
{
9
25
class
CubeCoords final
26
{
27
static
constexpr
uint64_t Offset = 8 *
sizeof
(uint64_t) / 2;
28
static
constexpr
uint32_t HalfRange =
29
static_cast<
uint32_t
>
(1) << (8 *
sizeof
(int32_t) - 1);
30
31
public
:
32
inline
int
GetX(
void
)
const
{
return
X; }
33
inline
int
GetY(
void
)
const
{
return
Y; }
34
inline
int
GetZ(
void
)
const
{
return
-(X + Y); }
35
36
public
:
37
CubeCoords operator + (
const
CubeCoords &)
const
;
38
CubeCoords operator - (
const
CubeCoords &)
const
;
39
CubeCoords operator * (
const
int32_t)
const
;
40
CubeCoords TurnLeft(
void
)
const
{
return
CubeCoords{ -Y, X + Y }; }
41
inline
CubeCoords TurnRight(
void
)
const
{
return
CubeCoords{ X + Y, -X }; }
42
CubeCoords TurnLeft(
const
uint32_t)
const
;
43
CubeCoords TurnRight(
const
uint32_t)
const
;
44
::std::pair<float, float> ToPlane(
void
)
const
;
45
uint64_t GetHash(
void
)
const
;
46
47
private
:
48
int32_t X, Y;
49
50
public
:
51
explicit
CubeCoords(
const
int
= 0,
const
int
= 0);
52
explicit
CubeCoords(
const
uint64_t);
53
};
54
55
inline
CubeCoords
CubeCoords::operator + (
const
CubeCoords
& _CubeCoords)
const
56
{
57
return
CubeCoords
{ X + _CubeCoords.X, Y + _CubeCoords.Y };
58
}
59
60
inline
CubeCoords CubeCoords::operator - (
const
CubeCoords & _CubeCoords)
const
61
{
62
return
CubeCoords{ X - _CubeCoords.X, Y - _CubeCoords.Y };
63
}
64
65
inline
CubeCoords
CubeCoords::operator * (
const
int32_t _Value)
const
66
{
67
return
CubeCoords{ X * _Value, Y * _Value };
68
}
69
70
inline
uint64_t CubeCoords::GetHash(
void
)
const
71
{
72
# if BOOST_COMP_MSVC
73
# pragma warning(push)
74
# pragma warning(disable: 26451)
75
# endif
76
77
return
(
static_cast<
uint64_t
>
(Y + HalfRange) << Offset) +
78
static_cast<
uint64_t
>
(X + HalfRange);
79
80
# if BOOST_COMP_MSVC
81
# pragma warning(pop)
82
# endif
83
}
84
85
}
// namespace model
86
87
}
// namespace basement
basement
Определения
Common.hpp:10
basement::model::CubeCoords
Класс входит в проект Example Класс манипуляции кубическими координатами.
Определения
CubeCoords.hpp:26
Solution
Solution
Example
Example
Basements
Demo
CubeCoords.hpp
Документация по Covellite++. Последние изменения:
. Создано системой
1.18.0