26 const auto p = pts_acc.vector_attribute(t);
27 vec.row(i) = p.transpose();
34 template <
int D,
typename MeshT>
38 const std::string& output_pos_attr_name)
43 (D == 2 && std::is_same<MeshT, TriMesh>()) || (D == 3 && std::is_same<MeshT, TetMesh>()));
45 if constexpr (D == 2) {
46 throw std::runtime_error(
"not tested for 2d");
49 std::shared_ptr<MeshT> meshptr = std::make_shared<MeshT>();
50 MeshT& mesh = *meshptr;
52 Eigen::MatrixXi
faces;
53 const auto pts_vec = points_to_rowvectors<D>(point_cloud, pts_attr);
54 if constexpr (D == 2) {
56 }
else if constexpr (D == 3) {
59 throw std::runtime_error(
"unsupported cell dimension in delaunay component");
62 mesh.initialize(
faces.cast<int64_t>());
71 const std::string& output_pos_attr_name)
76 const auto cell_dimension = pts_acc.dimension();
80 switch (cell_dimension) {
82 return delaunay_exec<2, TriMesh>(point_cloud, pts_attr, output_pos_attr_name);
86 return delaunay_exec<3, TetMesh>(point_cloud, pts_attr, output_pos_attr_name);
90 throw std::runtime_error(
"unsupported cell dimension in delaunay component");
const attribute::Accessor< T, Derived, Dim > create_const_accessor(const attribute::TypedAttributeHandle< T > &handle) const
constructs a const accessor that is aware of the derived mesh's type
std::vector< Tuple > get_all(PrimitiveType type) const
Generate a vector of Tuples from global vertex/edge/triangle/tetrahedron index.
std::tuple< Eigen::MatrixXd, Eigen::MatrixXi > delaunay_3d(Eigen::Ref< const RowVectors3d > points)
std::tuple< Eigen::MatrixXd, Eigen::MatrixXi > delaunay_2d(Eigen::Ref< const RowVectors2d > points)
std::shared_ptr< Mesh > delaunay(const PointMesh &point_cloud, const attribute::MeshAttributeHandle &pts_attr, const std::string &output_pos_attr_name)
RowVectors< double, D > points_to_rowvectors(const PointMesh &point_cloud, const attribute::MeshAttributeHandle &pts_attr)
std::shared_ptr< MeshT > delaunay_exec(const PointMesh &point_cloud, const attribute::MeshAttributeHandle &pts_attr, const std::string &output_pos_attr_name)
attribute::MeshAttributeHandle set_matrix_attribute(const Mat &data, const std::string &name, const PrimitiveType &type, Mesh &mesh)
std::vector< Tuple > vertices(const Mesh &m, const Simplex &simplex)
SimplexCollection faces(const Mesh &mesh, const Simplex &simplex, const bool sort_and_clean)
Returns all faces of a simplex.
Eigen::Matrix< T, Eigen::Dynamic, C > RowVectors