Move Vectormath main
C++20 game and graphics mathematics
Loading...
Searching...
No Matches
QueryTypes.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4#include <optional>
5#include <type_traits>
6
9
10namespace mv::math
11{
12 enum class FaceOrientation
13 {
14 Front,
15 Back
16 };
17
18 template <typename T>
19 requires std::is_floating_point_v<T>
21 {
25
27 {
28 return std::sqrt(SquaredDistance);
29 }
30
31 [[nodiscard]] friend bool operator==(
32 const PointLineClosest3&,
33 const PointLineClosest3&) noexcept = default;
34 };
35
36 template <typename T>
37 requires std::is_floating_point_v<T>
39 {
43
45 {
46 return std::sqrt(SquaredDistance);
47 }
48
49 [[nodiscard]] friend bool operator==(const PointRayClosest3&,
50 const PointRayClosest3&) noexcept =
51 default;
52 };
53
54 template <typename T>
55 requires std::is_floating_point_v<T>
57 {
61
63 {
64 return std::sqrt(SquaredDistance);
65 }
66
67 [[nodiscard]] friend bool operator==(
69 const PointSegmentClosest3&) noexcept = default;
70 };
71
72 template <typename T>
73 requires std::is_floating_point_v<T>
75 {
79
81 {
82 return std::sqrt(SquaredDistance);
83 }
84
85 [[nodiscard]] friend bool operator==(
86 const PointPlaneClosest3&,
87 const PointPlaneClosest3&) noexcept = default;
88 };
89
90 template <typename T>
91 requires std::is_floating_point_v<T>
93 {
97
99 {
100 return std::sqrt(SquaredDistance);
101 }
102
103 [[nodiscard]] friend bool operator==(
105 const PointTriangleClosest3&) noexcept = default;
106 };
107
108 template <typename T>
109 requires std::is_floating_point_v<T>
111 {
114
116 {
117 return std::sqrt(SquaredDistance);
118 }
119
120 [[nodiscard]] friend bool operator==(
121 const PointAabbClosest3&,
122 const PointAabbClosest3&) noexcept = default;
123 };
124
125 template <typename T>
126 requires std::is_floating_point_v<T>
128 {
131
133 {
134 return std::sqrt(SquaredDistance);
135 }
136
137 [[nodiscard]] friend bool operator==(
138 const PointSphereClosest3&,
139 const PointSphereClosest3&) noexcept = default;
140 };
141
142 template <typename T>
143 requires std::is_floating_point_v<T>
145 {
149
151 {
152 return std::sqrt(SquaredDistance);
153 }
154
155 [[nodiscard]] friend bool operator==(
157 const PointCapsuleClosest3&) noexcept = default;
158 };
159
160 template <typename T>
161 requires std::is_floating_point_v<T>
179
180 template <typename T>
181 requires std::is_floating_point_v<T>
183 {
188
189 [[nodiscard]] friend bool operator==(
190 const RayPlaneHit3&, const RayPlaneHit3&) noexcept = default;
191 };
192
193 template <typename T>
194 requires std::is_floating_point_v<T>
206
207 template <typename T>
208 requires std::is_floating_point_v<T>
210 {
214 std::optional<Normal3<T>> EntryNormal;
215 std::optional<Normal3<T>> ExitNormal;
216
217 [[nodiscard]] friend bool operator==(
218 const RaySphereHit3&, const RaySphereHit3&) noexcept = default;
219 };
220
221 template <typename T>
222 requires std::is_floating_point_v<T>
224 {
228 std::optional<Normal3<T>> EntryNormal;
230
231 [[nodiscard]] friend bool operator==(
232 const RayAabbHit3&, const RayAabbHit3&) noexcept = default;
233 };
234
235 template <typename T>
236 requires std::is_floating_point_v<T>
238 {
242 std::optional<Normal3<T>> EntryNormal;
244
245 [[nodiscard]] friend bool operator==(
246 const RayObbHit3&, const RayObbHit3&) noexcept = default;
247 };
248
277} // namespace mv::math
278
279static_assert(std::is_trivially_copyable_v<mv::math::RayPlaneHit3f>);
280static_assert(std::is_trivially_copyable_v<mv::math::RayTriangleHit3f>);
281static_assert(std::is_trivially_copyable_v<mv::math::RaySphereHit3f>);
282static_assert(std::is_trivially_copyable_v<mv::math::RayAabbHit3f>);
283static_assert(std::is_trivially_copyable_v<mv::math::PointLineClosest3f>);
284static_assert(std::is_trivially_copyable_v<mv::math::PointRayClosest3f>);
285static_assert(std::is_trivially_copyable_v<mv::math::PointSegmentClosest3f>);
286static_assert(std::is_trivially_copyable_v<mv::math::PointPlaneClosest3f>);
287static_assert(std::is_trivially_copyable_v<mv::math::PointTriangleClosest3f>);
288static_assert(std::is_trivially_copyable_v<mv::math::PointAabbClosest3f>);
289static_assert(std::is_trivially_copyable_v<mv::math::PointSphereClosest3f>);
290static_assert(std::is_trivially_copyable_v<mv::math::PointCapsuleClosest3f>);
291static_assert(std::is_trivially_copyable_v<mv::math::SegmentSegmentClosest3f>);
292static_assert(std::is_trivially_copyable_v<mv::math::RayPlaneHit3d>);
293static_assert(std::is_trivially_copyable_v<mv::math::RayTriangleHit3d>);
294static_assert(std::is_trivially_copyable_v<mv::math::RaySphereHit3d>);
295static_assert(std::is_trivially_copyable_v<mv::math::RayAabbHit3d>);
296static_assert(std::is_trivially_copyable_v<mv::math::RayObbHit3f>);
297static_assert(std::is_trivially_copyable_v<mv::math::RayObbHit3d>);
friend bool operator==(const PointAabbClosest3 &, const PointAabbClosest3 &) noexcept=default
T Distance() const noexcept
friend bool operator==(const PointCapsuleClosest3 &, const PointCapsuleClosest3 &) noexcept=default
friend bool operator==(const PointLineClosest3 &, const PointLineClosest3 &) noexcept=default
T Distance() const noexcept
friend bool operator==(const PointPlaneClosest3 &, const PointPlaneClosest3 &) noexcept=default
T Distance() const noexcept
friend bool operator==(const PointRayClosest3 &, const PointRayClosest3 &) noexcept=default
T Distance() const noexcept
friend bool operator==(const PointSegmentClosest3 &, const PointSegmentClosest3 &) noexcept=default
T Distance() const noexcept
T Distance() const noexcept
friend bool operator==(const PointSphereClosest3 &, const PointSphereClosest3 &) noexcept=default
friend bool operator==(const PointTriangleClosest3 &, const PointTriangleClosest3 &) noexcept=default
std::optional< Normal3< T > > EntryNormal
Normal3< T > ExitNormal
friend bool operator==(const RayAabbHit3 &, const RayAabbHit3 &) noexcept=default
std::optional< Normal3< T > > EntryNormal
Normal3< T > ExitNormal
friend bool operator==(const RayObbHit3 &, const RayObbHit3 &) noexcept=default
FaceOrientation Face
friend bool operator==(const RayPlaneHit3 &, const RayPlaneHit3 &) noexcept=default
std::optional< Normal3< T > > EntryNormal
std::optional< Normal3< T > > ExitNormal
friend bool operator==(const RaySphereHit3 &, const RaySphereHit3 &) noexcept=default
friend bool operator==(const RayTriangleHit3 &, const RayTriangleHit3 &) noexcept=default
friend bool operator==(const SegmentSegmentClosest3 &, const SegmentSegmentClosest3 &) noexcept=default