NetDEM v1.0
Loading...
Searching...
No Matches
spherical_voronoi.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "utils_macros.hpp"
4#include <string>
5
6namespace netdem {
7
18public:
28 static std::tuple<VecXT<Vec3d>, VecXT<VecXT<int>>>
29 Solve(VecXT<Vec3d> const &vt_seeds);
30
42 static std::tuple<VecXT<Vec3d>, VecXT<VecXT<int>>>
43 Solve(VecXT<Vec3d> const &vt_seeds, VecXT<double> const &vt_weights);
44
56 static VecXT<Vec3d> Solve(int num_seeds, int max_iter = 10000,
57 double tol = 1.0e-4);
58
73 static VecXT<Vec3d> Solve(int num_seeds, VecXT<double> const &weights_sh_coff,
74 int max_iter, double tol);
75
87 static void SaveAsVTK(std::string const &file, VecXT<Vec3d> const &vt_nodes,
88 VecXT<VecXT<int>> const &vt_cells,
89 VecXT<Vec3d> const &vt_seeds);
90
91private:
102 static int Find(VecXT<int> const &ids, int id);
103
114 static int Find(Vec3i const &ids, int id);
115
125 static bool IsSharingEdge(Vec3i const &facet_i, Vec3i const &facet_j);
126
138 static VecXT<int> FacetsContainVertex(VecXT<Vec3i> const &facets, int vid);
139
152 static Vec3d WeightedMiddle(Vec3d const &v1, Vec3d const &v2, double w1,
153 double w2);
154
167 static Vec3d LineIntersection(Vec3d const &v1, Vec3d const &n1,
168 Vec3d const &v2, Vec3d const &n2);
169
182 static Vec3d WeightedCentroid(VecXT<Vec3d> const &vertices,
183 VecXT<double> const &weights,
184 Vec3i const &facet);
185
196 static Vec3d PolyCentroid(VecXT<Vec3d> const &verts, VecXT<int> const &facet);
197};
198
199} // namespace netdem
Class for computing Voronoi diagrams on a sphere.
Definition spherical_voronoi.hpp:17
static std::tuple< VecXT< Vec3d >, VecXT< VecXT< int > > > Solve(VecXT< Vec3d > const &vt_seeds)
Compute the Voronoi diagram for a set of seeds with uniform weights.
Definition spherical_voronoi.cpp:16
static void SaveAsVTK(std::string const &file, VecXT< Vec3d > const &vt_nodes, VecXT< VecXT< int > > const &vt_cells, VecXT< Vec3d > const &vt_seeds)
Save the Voronoi diagram as a VTK file.
Definition spherical_voronoi.cpp:198
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< int, 3 > Vec3i
Definition utils_macros.hpp:14