diff --git a/include/omath/3d_primitives/plane.hpp b/include/omath/3d_primitives/plane.hpp index 1539398..0355504 100644 --- a/include/omath/3d_primitives/plane.hpp +++ b/include/omath/3d_primitives/plane.hpp @@ -13,14 +13,20 @@ namespace omath::primitives { - using PlaneMesh = Mesh, - std::array, 8>, std::array, 12>>; + using PlaneMesh = Mesh, + std::array, 4>, std::array, 6>>; [[nodiscard]] - std::array>, 2> create_plane(const Vector3& vertex_a, const Vector3& vertex_b, - const Vector3& direction, float size) noexcept + PlaneMesh create_plane(const Vector3& vertex_a, const Vector3& vertex_b, + const Vector3& direction, const float size) noexcept { const auto second_vertex_a = vertex_a + direction * size; - return std::array{Triangle{second_vertex_a, vertex_a, vertex_b}, - Triangle{second_vertex_a, vertex_b + direction * size, vertex_b}}; + const auto second_vertex_b = vertex_b + direction * size; + + std::array, 4> grid = {vertex_a, vertex_b, second_vertex_a, second_vertex_b}; + + std::array, 6> poly; + poly[0] = {}; + + return PlaneMesh(std::move(grid), std::move(poly)); } } // namespace omath::primitives diff --git a/source/3d_primitives/plane.cpp b/source/3d_primitives/plane.cpp index c541810..dc931d7 100644 --- a/source/3d_primitives/plane.cpp +++ b/source/3d_primitives/plane.cpp @@ -5,15 +5,5 @@ namespace omath::primitives { - std::array>, 2> create_plane(const Vector3& vertex_a, - const Vector3& vertex_b, - const Vector3& direction, const float size) noexcept - { - const auto second_vertex_a = vertex_a + direction * size; - return std::array - { - Triangle{second_vertex_a, vertex_a, vertex_b}, - Triangle{second_vertex_a, vertex_b + direction * size, vertex_b} - }; - } + } // namespace omath::primitives \ No newline at end of file