14#include <lagrange/ActingMeshGeometry.h>
15#include <lagrange/GenuineMeshGeometry.h>
16#include <lagrange/Mesh.h>
17#include <lagrange/MeshGeometry.h>
18#include <lagrange/common.h>
22template <
typename DerivedV,
typename DerivedF>
23std::unique_ptr<Mesh<DerivedV, DerivedF>> create_empty_mesh()
28 auto geometry = std::make_unique<GenuineMeshGeometry<DerivedV, DerivedF>>(vertices, facets);
29 return std::make_unique<Mesh<DerivedV, DerivedF>>(std::move(geometry));
38template <
typename DerivedV,
typename DerivedF>
40 const Eigen::MatrixBase<DerivedV>& vertices,
41 const Eigen::MatrixBase<DerivedF>& facets)
43 using VertexArray = Eigen::Matrix<
44 typename DerivedV::Scalar,
45 DerivedV::RowsAtCompileTime,
46 DerivedV::ColsAtCompileTime,
48 (DerivedV::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : Eigen::ColMajor)>;
49 using FacetArray = Eigen::Matrix<
50 typename DerivedF::Scalar,
51 DerivedF::RowsAtCompileTime,
52 DerivedF::ColsAtCompileTime,
54 (DerivedF::Flags & Eigen::RowMajorBit ? Eigen::RowMajor : Eigen::ColMajor)>;
55 auto geometry = std::make_unique<GenuineMeshGeometry<VertexArray, FacetArray>>(
58 return std::make_unique<Mesh<VertexArray, FacetArray>>(std::move(geometry));
66template <
typename DerivedV,
typename DerivedF>
68 Eigen::PlainObjectBase<DerivedV>&& vertices,
69 Eigen::PlainObjectBase<DerivedF>&& facets)
71 auto geometry = std::make_unique<GenuineMeshGeometry<DerivedV, DerivedF>>();
72 geometry->import_vertices(vertices);
73 geometry->import_facets(facets);
74 return std::make_unique<Mesh<DerivedV, DerivedF>>(std::move(geometry));
77template <
typename DerivedV,
typename DerivedF>
78std::unique_ptr<Mesh<DerivedV, DerivedF>>
create_mesh(
79 const Eigen::MatrixBase<DerivedV>& vertices,
80 Eigen::MatrixBase<DerivedF>&& facets)
82 auto geometry = std::make_unique<GenuineMeshGeometry<DerivedV, DerivedF>>();
83 DerivedV vertices_copy = vertices;
84 geometry->import_vertices(vertices_copy);
85 geometry->import_facets(facets);
86 return std::make_unique<Mesh<DerivedV, DerivedF>>(std::move(geometry));
89template <
typename DerivedV,
typename DerivedF>
90std::unique_ptr<Mesh<DerivedV, DerivedF>>
create_mesh(
91 Eigen::MatrixBase<DerivedV>&& vertices,
92 const Eigen::MatrixBase<DerivedF>& facets)
94 auto geometry = std::make_unique<GenuineMeshGeometry<DerivedV, DerivedF>>();
95 DerivedF facets_copy = facets;
96 geometry->import_vertices(vertices);
97 geometry->import_facets(facets_copy);
98 return std::make_unique<Mesh<DerivedV, DerivedF>>(std::move(geometry));
108template <
typename VertexArray,
typename FacetArray>
110 const Eigen::MatrixBase<VertexArray>& vertices,
111 const Eigen::MatrixBase<FacetArray>& facets)
115 auto geometry = std::make_unique<ActingMeshGeometry<VertexArray, FacetArray>>(
118 return std::make_unique<MeshType>(std::move(geometry));
122template <
typename VertexArray,
typename FacetArray>
124 const Eigen::MatrixBase<VertexArray>&& ,
125 const Eigen::MatrixBase<FacetArray>&& )
128 StaticAssertableBool<VertexArray, FacetArray>::False,
129 "vertices and facets cannot be rvalues");
131template <
typename VertexArray,
typename FacetArray>
133 const Eigen::MatrixBase<VertexArray>& ,
134 const Eigen::MatrixBase<FacetArray>&& )
137 StaticAssertableBool<VertexArray, FacetArray>::False,
138 "facets cannot be an rvalue");
140template <
typename VertexArray,
typename FacetArray>
142 const Eigen::MatrixBase<VertexArray>&& ,
143 const Eigen::MatrixBase<FacetArray>& )
146 StaticAssertableBool<VertexArray, FacetArray>::False,
147 "vertices cannot be an rvalue");
150std::unique_ptr<TriangleMesh3D> LA_CORE_API create_cube();
152std::unique_ptr<TriangleMesh3D> LA_CORE_API create_quad(
bool with_center_vertex);
154std::unique_ptr<TriangleMesh3D> LA_CORE_API create_sphere(
double refine_order = 2);
Main namespace for Lagrange.
Definition: AABBIGL.h:30
auto create_mesh(const Eigen::MatrixBase< DerivedV > &vertices, const Eigen::MatrixBase< DerivedF > &facets)
This function create a new mesh given the vertex and facet arrays by copying data into the Mesh objec...
Definition: create_mesh.h:39
auto wrap_with_mesh(const Eigen::MatrixBase< VertexArray > &vertices, const Eigen::MatrixBase< FacetArray > &facets)
This method creates a Mesh object that wraps around vertices and facets.
Definition: create_mesh.h:109