MCPcopy Create free account
hub / github.com/GeometryCollective/ddg-exercises / functionCallback

Function functionCallback

projects/parameterization/src/main.cpp:83–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81static ImVec4 area_currColor = releaseColor;
82
83void functionCallback() {
84
85 ImGui::Text("Plot: ");
86 ImGui::SameLine();
87
88 ImGui::PushStyleColor(ImGuiCol_Button, shaded_currColor);
89 ImGui::PushStyleColor(ImGuiCol_ButtonActive, shaded_currColor);
90 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, shaded_currColor);
91 if (ImGui::Button("Shaded")) {
92 psMesh->setSurfaceColor({1.0, 0.45, 0.0}); // orange
93 checkerboard->setEnabled(true);
94
95 shaded_currColor = pressColor;
96 qc_currColor = releaseColor;
97 area_currColor = releaseColor;
98 }
99 ImGui::PopStyleColor(3);
100 ImGui::SameLine();
101
102 ImGui::PushStyleColor(ImGuiCol_Button, qc_currColor);
103 ImGui::PushStyleColor(ImGuiCol_ButtonActive, qc_currColor);
104 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, qc_currColor);
105 if (ImGui::Button("Conformal error")) {
106 polyscope::SurfaceColorQuantity* CE = psMesh->addVertexColorQuantity("Conformal error", SCP_QC_COLORS);
107 CE->setEnabled(true);
108 checkerboard->setEnabled(false);
109
110 shaded_currColor = releaseColor;
111 qc_currColor = pressColor;
112 area_currColor = releaseColor;
113 }
114 ImGui::PopStyleColor(3);
115 ImGui::SameLine();
116
117 ImGui::PushStyleColor(ImGuiCol_Button, area_currColor);
118 ImGui::PushStyleColor(ImGuiCol_ButtonActive, area_currColor);
119 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, area_currColor);
120 if (ImGui::Button("Area scaling")) {
121 polyscope::SurfaceColorQuantity* AS = psMesh->addVertexColorQuantity("Area scaling", SCP_AREA_COLORS);
122 AS->setEnabled(true);
123 checkerboard->setEnabled(false);
124
125 shaded_currColor = releaseColor;
126 qc_currColor = releaseColor;
127 area_currColor = pressColor;
128 }
129 ImGui::PopStyleColor(3);
130
131 if (ImGui::Checkbox("Parameterization", &DISPLAY_FLAT)) {
132 if (DISPLAY_FLAT) {
133 // Display SCP parameterization
134 geometry->inputVertexPositions = SCP_MESH;
135 geometry->normalize(CoM, true);
136 polyscope::view::flyToHomeView();
137 polyscope::view::style = polyscope::view::NavigateStyle::Planar;
138 } else {
139 // Display original
140 geometry->inputVertexPositions = ORIGINAL;

Callers

nothing calls this directly

Calls 2

normalizeMethod · 0.80
redrawFunction · 0.70

Tested by

no test coverage detected