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.
This commit is contained in:
2025-08-28 23:57:22 +03:00
parent b19a4de904
commit fe1ff12f74

View File

@@ -9,13 +9,10 @@ namespace omath::primitives
const Vector3<float>& vertex_b, const Vector3<float>& vertex_b,
const Vector3<float>& direction, const float size) noexcept const Vector3<float>& direction, const float size) noexcept
{ {
Triangle<Vector3<float>> triangles;
const auto second_vertex_a = vertex_a + direction * size;
const auto second_vertex_b = vertex_b + direction * size;
return std::array return std::array
{ {
Triangle{second_vertex_a, vertex_a, vertex_b}, Triangle{vertex_a + direction * size, vertex_a, vertex_b},
Triangle{second_vertex_b, vertex_b, vertex_a} Triangle{vertex_b + direction * size, vertex_b, vertex_a}
}; };
} }
} // namespace omath::primitives } // namespace omath::primitives