| 1159 | } |
| 1160 | |
| 1161 | void DemoBoxRotation() { |
| 1162 | IMGUI_DEMO_MARKER("Axes/Box Rotation"); |
| 1163 | double origin[2] = {0.0, 0.0}; |
| 1164 | double axis[2] = {0.0, 1.0}; |
| 1165 | |
| 1166 | // Sliders for rotation angles |
| 1167 | static float elevation = 45.0f; |
| 1168 | static float azimuth = -135.0f; |
| 1169 | static bool animate = false; |
| 1170 | ImGui::Text("Rotation"); |
| 1171 | bool changed = false; |
| 1172 | if (ImGui::SliderFloat("Elevation", &elevation, -90.0f, 90.0f, "%.1f degrees")) |
| 1173 | changed = true; |
| 1174 | if (ImGui::SliderFloat("Azimuth", &azimuth, -180.0f, 180.0f, "%.1f degrees")) |
| 1175 | changed = true; |
| 1176 | ImGui::Checkbox("Animate", &animate); |
| 1177 | |
| 1178 | ImGui::Text("Initial Rotation"); |
| 1179 | ImGui::SameLine(); |
| 1180 | HelpMarker("The rotation will be reset to the initial rotation when you double right-click"); |
| 1181 | static float init_elevation = 45.0f; |
| 1182 | static float init_azimuth = -135.0f; |
| 1183 | ImGui::SliderFloat("Initial Elevation", &init_elevation, -90.0f, 90.0f, "%.1f degrees"); |
| 1184 | ImGui::SliderFloat("Initial Azimuth", &init_azimuth, -180.0f, 180.0f, "%.1f degrees"); |
| 1185 | |
| 1186 | if (ImPlot3D::BeginPlot("##BoxRotation")) { |
| 1187 | ImPlot3D::SetupAxesLimits(-1, 1, -1, 1, -1, 1, ImPlot3DCond_Always); |
| 1188 | |
| 1189 | // Set initial rotation |
| 1190 | ImPlot3D::SetupBoxInitialRotation(init_elevation, init_azimuth); |
| 1191 | |
| 1192 | // Set the rotation using the specified elevation and azimuth |
| 1193 | if (changed) |
| 1194 | ImPlot3D::SetupBoxRotation(elevation, azimuth, animate, ImPlot3DCond_Always); |
| 1195 | |
| 1196 | // Plot axis lines |
| 1197 | ImPlot3D::PlotLine("X-Axis", axis, origin, origin, 2, {ImPlot3DProp_LineColor, ImVec4(0.8f, 0.2f, 0.2f, 1)}); |
| 1198 | ImPlot3D::PlotLine("Y-Axis", origin, axis, origin, 2, {ImPlot3DProp_LineColor, ImVec4(0.2f, 0.8f, 0.2f, 1)}); |
| 1199 | ImPlot3D::PlotLine("Z-Axis", origin, origin, axis, 2, {ImPlot3DProp_LineColor, ImVec4(0.2f, 0.2f, 0.8f, 1)}); |
| 1200 | |
| 1201 | ImPlot3D::EndPlot(); |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | void Demo_LogScale() { |
| 1206 | IMGUI_DEMO_MARKER("Axes/Log Scale"); |
nothing calls this directly
no test coverage detected