-
Notifications
You must be signed in to change notification settings - Fork 234
Expand file tree
/
Copy pathpoint_cloud_vector_quantity.cpp
More file actions
51 lines (35 loc) · 1.34 KB
/
point_cloud_vector_quantity.cpp
File metadata and controls
51 lines (35 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2017-2023, Nicholas Sharp and the Polyscope contributors. https://polyscope.run
#include "polyscope/point_cloud_vector_quantity.h"
#include "polyscope/file_helpers.h"
#include "polyscope/polyscope.h"
#include "imgui.h"
#include <fstream>
#include <iostream>
namespace polyscope {
PointCloudVectorQuantity::PointCloudVectorQuantity(std::string name, std::vector<glm::vec3> vectors_,
PointCloud& pointCloud_, VectorType vectorType_)
: PointCloudQuantity(name, pointCloud_),
VectorQuantity<PointCloudVectorQuantity>(*this, vectors_, parent.points, vectorType_) {}
void PointCloudVectorQuantity::draw() {
if (!isEnabled()) return;
drawVectors();
}
void PointCloudVectorQuantity::refresh() {
refreshVectors();
Quantity::refresh();
}
void PointCloudVectorQuantity::buildCustomUI() { buildVectorUI(); }
void PointCloudVectorQuantity::buildPickUI(size_t ind) {
ImGui::TextUnformatted(name.c_str());
ImGui::NextColumn();
std::stringstream buffer;
glm::vec3 vec = vectors.getValue(ind);
buffer << vec;
ImGui::TextUnformatted(buffer.str().c_str());
ImGui::NextColumn();
ImGui::NextColumn();
ImGui::Text("magnitude: %g", glm::length(vec));
ImGui::NextColumn();
}
std::string PointCloudVectorQuantity::niceName() { return name + " (vector)"; }
} // namespace polyscope