Skip to content

Commit b5e7883

Browse files
committed
fixed style
1 parent df6d75e commit b5e7883

File tree

11 files changed

+34
-31
lines changed

11 files changed

+34
-31
lines changed

include/omath/angles.hpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ namespace omath::angles
1212
requires std::is_floating_point_v<Type>
1313
[[nodiscard]] constexpr Type radians_to_degrees(const Type& radians)
1414
{
15-
return radians * (Type(180) / std::numbers::pi_v<Type>);
15+
return radians * (static_cast<Type>(180) / std::numbers::pi_v<Type>);
1616
}
1717

1818
template<class Type>
1919
requires std::is_floating_point_v<Type>
2020
[[nodiscard]] constexpr Type degrees_to_radians(const Type& degrees)
2121
{
22-
return degrees * (std::numbers::pi_v<Type> / Type(180));
22+
return degrees * (std::numbers::pi_v<Type> / static_cast<Type>(180));
2323
}
2424

25-
template<class type>
26-
requires std::is_floating_point_v<type>
27-
[[nodiscard]] type horizontal_fov_to_vertical(const type& horizontal_fov, const type& aspect)
25+
template<class Type>
26+
requires std::is_floating_point_v<Type>
27+
[[nodiscard]] Type horizontal_fov_to_vertical(const Type& horizontal_fov, const Type& aspect)
2828
{
2929
const auto fov_rad = degrees_to_radians(horizontal_fov);
3030

31-
const auto vert_fov = type(2) * std::atan(std::tan(fov_rad / type(2)) / aspect);
31+
const auto vert_fov = static_cast<Type>(2) * std::atan(std::tan(fov_rad / static_cast<Type>(2)) / aspect);
3232

3333
return radians_to_degrees(vert_fov);
3434
}
@@ -39,7 +39,8 @@ namespace omath::angles
3939
{
4040
const auto fov_as_radians = degrees_to_radians(vertical_fov);
4141

42-
const auto horizontal_fov = Type(2) * std::atan(std::tan(fov_as_radians / Type(2)) * aspect);
42+
const auto horizontal_fov
43+
= static_cast<Type>(2) * std::atan(std::tan(fov_as_radians / static_cast<Type>(2)) * aspect);
4344

4445
return radians_to_degrees(horizontal_fov);
4546
}
@@ -53,11 +54,11 @@ namespace omath::angles
5354

5455
const Type range = max - min;
5556

56-
Type wrappedAngle = std::fmod(angle - min, range);
57+
Type wrapped_angle = std::fmod(angle - min, range);
5758

58-
if (wrappedAngle < 0)
59-
wrappedAngle += range;
59+
if (wrapped_angle < 0)
60+
wrapped_angle += range;
6061

61-
return wrappedAngle + min;
62+
return wrapped_angle + min;
6263
}
6364
} // namespace omath::angles

include/omath/mat.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ namespace omath
226226
}
227227

228228
[[nodiscard]]
229-
constexpr Mat<Columns, Rows, Type, StoreType> Transposed() const noexcept
229+
constexpr Mat<Columns, Rows, Type, StoreType> transposed() const noexcept
230230
{
231231
Mat<Columns, Rows, Type, StoreType> transposed;
232232
for (size_t i = 0; i < Rows; ++i)
@@ -237,7 +237,7 @@ namespace omath
237237
}
238238

239239
[[nodiscard]]
240-
constexpr Type Determinant() const
240+
constexpr Type determinant() const
241241
{
242242
static_assert(Rows == Columns, "Determinant is only defined for square matrices.");
243243

@@ -284,7 +284,7 @@ namespace omath
284284
[[nodiscard]]
285285
constexpr Type minor(const size_t row, const size_t column) const
286286
{
287-
return strip(row, column).Determinant();
287+
return strip(row, column).determinant();
288288
}
289289

290290
[[nodiscard]]
@@ -355,17 +355,17 @@ namespace omath
355355
[[nodiscard]]
356356
constexpr std::optional<Mat> inverted() const
357357
{
358-
const auto det = Determinant();
358+
const auto det = determinant();
359359

360360
if (det == 0)
361361
return std::nullopt;
362362

363-
const auto transposed = Transposed();
363+
const auto transposed_mat = transposed();
364364
Mat result;
365365

366366
for (std::size_t row = 0; row < Rows; row++)
367367
for (std::size_t column = 0; column < Rows; column++)
368-
result.at(row, column) = transposed.alg_complement(row, column);
368+
result.at(row, column) = transposed_mat.alg_complement(row, column);
369369

370370
result /= det;
371371

include/omath/pathfinding/a_star.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ namespace omath::pathfinding
2525

2626
[[nodiscard]]
2727
static auto get_perfect_node(const std::unordered_map<Vector3<float>, PathNode>& open_list,
28-
const Vector3<float>& endVertex);
28+
const Vector3<float>& end_vertex);
2929
};
3030
} // namespace omath::pathfinding

include/omath/projection/camera.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace omath::projection
1919
float m_width;
2020
float m_height;
2121

22-
[[nodiscard]] constexpr float AspectRatio() const
22+
[[nodiscard]] constexpr float aspect_ratio() const
2323
{
2424
return m_width / m_height;
2525
}

source/collision/line_tracer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace omath::collision
4242
return ray.end;
4343

4444
const auto q = t.cross(side_a);
45+
// ReSharper disable once CppTooWideScopeInitStatement
4546
const auto v = ray_dir.dot(q) * inv_det;
4647

4748
if ((v < 0 && std::abs(v) > k_epsilon) || (u + v > 1 && std::abs(u + v - 1) > k_epsilon))

source/engines/iw_engine/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace omath::iw_engine
2727
}
2828
Mat4X4 Camera::calc_projection_matrix() const
2929
{
30-
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.AspectRatio(),
30+
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.aspect_ratio(),
3131
m_near_plane_distance, m_far_plane_distance);
3232
}
3333
} // namespace omath::iw_engine

source/engines/opengl_engine/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace omath::opengl_engine
2727
}
2828
Mat4X4 Camera::calc_projection_matrix() const
2929
{
30-
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.AspectRatio(),
30+
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.aspect_ratio(),
3131
m_near_plane_distance, m_far_plane_distance);
3232
}
3333
} // namespace omath::opengl_engine

source/engines/source_engine/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace omath::source_engine
2929

3030
Mat4X4 Camera::calc_projection_matrix() const
3131
{
32-
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.AspectRatio(),
32+
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.aspect_ratio(),
3333
m_near_plane_distance, m_far_plane_distance);
3434
}
3535
} // namespace omath::source_engine

source/engines/unity_engine/camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace omath::unity_engine
2121
}
2222
Mat4X4 Camera::calc_projection_matrix() const
2323
{
24-
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.AspectRatio(),
24+
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.aspect_ratio(),
2525
m_near_plane_distance, m_far_plane_distance);
2626
}
2727
} // namespace omath::unity_engine

source/pathfinding/a_star.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ namespace omath::pathfinding
3838
return path;
3939
}
4040
auto Astar::get_perfect_node(const std::unordered_map<Vector3<float>, PathNode>& open_list,
41-
const Vector3<float>& endVertex)
41+
const Vector3<float>& end_vertex)
4242
{
4343
return std::ranges::min_element(open_list,
44-
[&endVertex](const auto& a, const auto& b)
44+
[&end_vertex](const auto& a, const auto& b)
4545
{
46-
const float fa = a.second.g_cost + a.first.distance_to(endVertex);
47-
const float fb = b.second.g_cost + b.first.distance_to(endVertex);
46+
const float fa = a.second.g_cost + a.first.distance_to(end_vertex);
47+
const float fb = b.second.g_cost + b.first.distance_to(end_vertex);
4848
return fa < fb;
4949
});
5050
}
@@ -86,6 +86,7 @@ namespace omath::pathfinding
8686

8787
const float tentative_g_cost = current_node.g_cost + neighbor.distance_to(current);
8888

89+
// ReSharper disable once CppTooWideScopeInitStatement
8990
const auto open_it = open_list.find(neighbor);
9091

9192
if (open_it == open_list.end() || tentative_g_cost < open_it->second.g_cost)

0 commit comments

Comments
 (0)