32 const auto &edges = lm.
edges;
39 data.
velocities.resize(vertices.size(), glm::vec2(0, 0));
40 if (data.
forces.size() != vertices.size())
41 data.
forces.resize(vertices.size());
44 for (
auto &v : data.
forces)
48 for (
size_t i = 1; i < vertices.size(); ++i)
49 for (
size_t j = 0; j < i; ++j) {
50 auto d = vertices[j] - vertices[i];
51 float q = exp(-glm::length(d) * 3) * 1000 * time;
57 for (
size_t i = 0; i < edges.size(); ++i) {
58 auto [p1, p2] = edges[i];
59 auto d = vertices[p2] - vertices[p1];
60 auto q = (edge_lengths[i] - glm::length(d)) * 1000 * time;
66 auto slowdown = pow(0.1f, time);
67 for (
size_t i = 0; i < vertices.size(); ++i) {
68 if (vert_pressed && vert_ind == i)
void graph_layout_step(GraphLayoutData &data, bool vert_pressed, int vert_ind, LandmarkModel &lm, float time)
One iteration step of the landmark layouting algorithm.
void touch()
Make the cache dirty.
Data for landmark graph layouting algorithm using forces.
std::vector< glm::vec2 > forces
Forces of 2D landmarks.
std::vector< glm::vec2 > velocities
Velocities of 2D landmarks.
Model of the high- and low-dimensional landmarks.
std::vector< glm::vec2 > lodim_vertices
Array storing two-dimensional landmark coordinates.
std::vector< float > edge_lengths
Lengths of all edges.
std::vector< std::pair< size_t, size_t > > edges
Array of vertex ID pairs.