From d7e497b6170d3fcbf73a80a49aa8f1bf19355767 Mon Sep 17 00:00:00 2001 From: Orange Date: Thu, 28 Aug 2025 23:57:22 +0300 Subject: [PATCH] Simplifies plane creation logic Refactors the plane creation function to directly compute the triangle vertices, removing unnecessary intermediate variables. This results in more concise and readable code. --- source/3d_primitives/plane.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/3d_primitives/plane.cpp b/source/3d_primitives/plane.cpp index dffbe42..938393a 100644 --- a/source/3d_primitives/plane.cpp +++ b/source/3d_primitives/plane.cpp @@ -9,13 +9,10 @@ namespace omath::primitives const Vector3& vertex_b, const Vector3& direction, const float size) noexcept { - Triangle> triangles; - const auto second_vertex_a = vertex_a + direction * size; - const auto second_vertex_b = vertex_b + direction * size; return std::array { - Triangle{second_vertex_a, vertex_a, vertex_b}, - Triangle{second_vertex_b, vertex_b, vertex_a} + Triangle{vertex_a + direction * size, vertex_a, vertex_b}, + Triangle{vertex_b + direction * size, vertex_b, vertex_a} }; } } // namespace omath::primitives \ No newline at end of file