ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
turntable.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7#include <array>
8#include <chrono>
9#include <cmath>
10#include <memory>
11#include <numbers>
12
13// Forward-declare to avoid pulling PCL/VTK into the math-only header.
14namespace rux {
16} // namespace rux
17
18namespace rux::view {
19
22 bool active = false;
23 bool spinning = true;
24 bool tick_running = false;
25 double azimuth = 0.0;
26 double angular_velocity = 0.3;
27 double radius = 5.0;
28 double elevation_deg = 20.0;
29 std::array<double, 3> center = {0.0, 0.0, 0.0};
30 std::chrono::steady_clock::time_point last_tick{};
31};
32
37[[nodiscard]] inline std::array<double, 3>
38orbit_camera_position(const std::array<double, 3> &center, double radius,
39 double azimuth_rad, double elevation_deg) noexcept {
40 const double el = elevation_deg * (std::numbers::pi / 180.0);
41 return {center[0] + radius * std::cos(azimuth_rad) * std::cos(el),
42 center[1] + radius * std::sin(azimuth_rad) * std::cos(el),
43 center[2] + radius * std::sin(el)};
44}
45
55void register_turntable_callbacks(std::shared_ptr<TurntableState> state,
57
58} // namespace rux::view
std::array< double, 3 > orbit_camera_position(const std::array< double, 3 > &center, double radius, double azimuth_rad, double elevation_deg) noexcept
Compute the camera world position for one turntable orbit step.
Definition turntable.hpp:38
void register_turntable_callbacks(std::shared_ptr< TurntableState > state, rux::VizualizationObserver &observer)
Register turntable keyboard callbacks and wire up the per-tick orbit loop.
Shared state for the turntable orbit mode.
Definition turntable.hpp:21
std::chrono::steady_clock::time_point last_tick
Definition turntable.hpp:30
bool tick_running
Whether the per-tick task chain is live.
Definition turntable.hpp:24
double radius
Camera distance from scene centre.
Definition turntable.hpp:27
bool spinning
Camera is rotating (can be paused).
Definition turntable.hpp:23
double elevation_deg
Camera elevation above horizontal plane.
Definition turntable.hpp:28
bool active
Turntable mode is enabled.
Definition turntable.hpp:22
double azimuth
Current angle around world Z, radians.
Definition turntable.hpp:25
std::array< double, 3 > center
Scene focal point.
Definition turntable.hpp:29