ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ViewTrajectory.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <IJsonConvertible.h>
11 
12 #include <Eigen/Core>
13 #include <tuple>
14 #include <vector>
15 
17 
18 namespace cloudViewer {
19 namespace visualization {
20 
22 public:
23  static const int INTERVAL_MAX;
24  static const int INTERVAL_MIN;
25  static const int INTERVAL_STEP;
26  static const int INTERVAL_DEFAULT;
27 
28 public:
30  ~ViewTrajectory() override {}
31 
32 public:
42 
43  void ChangeInterval(int change) {
44  int new_interval = interval_ + change * INTERVAL_STEP;
45  if (new_interval >= INTERVAL_MIN && new_interval <= INTERVAL_MAX) {
46  interval_ = new_interval;
47  }
48  }
49 
50  size_t NumOfFrames() const {
51  if (view_status_.empty()) {
52  return 0;
53  } else {
54  return is_loop_ ? (static_cast<size_t>(interval_) + 1) *
55  view_status_.size()
56  : (static_cast<size_t>(interval_) + 1) *
57  (view_status_.size() - 1) +
58  1;
59  }
60  }
61 
62  void Reset() {
63  is_loop_ = false;
65  view_status_.clear();
66  }
67 
68  std::tuple<bool, ViewParameters> GetInterpolatedFrame(size_t k);
69 
70  bool ConvertToJsonValue(Json::Value &value) const override;
71  bool ConvertFromJsonValue(const Json::Value &value) override;
72 
73 public:
74  std::vector<ViewParameters> view_status_;
75  bool is_loop_ = false;
77  std::vector<ViewParameters::Matrix17x4d,
80 };
81 
82 } // namespace visualization
83 } // namespace cloudViewer
Eigen::Matrix< double, 17, 4, Eigen::RowMajor > Matrix17x4d
Eigen::aligned_allocator< Matrix17x4d > Matrix17x4d_allocator
std::vector< ViewParameters::Matrix17x4d, ViewParameters::Matrix17x4d_allocator > coeff_
bool ConvertToJsonValue(Json::Value &value) const override
std::tuple< bool, ViewParameters > GetInterpolatedFrame(size_t k)
std::vector< ViewParameters > view_status_
bool ConvertFromJsonValue(const Json::Value &value) override
Generic file read and write utility for python interface.