Open3D (C++ API)  0.18.0
ViewTrajectory.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Eigen/Core>
11 #include <tuple>
12 #include <vector>
13 
16 
17 namespace open3d {
18 namespace visualization {
19 
21 public:
22  static const int INTERVAL_MAX;
23  static const int INTERVAL_MIN;
24  static const int INTERVAL_STEP;
25  static const int INTERVAL_DEFAULT;
26 
27 public:
29  ~ViewTrajectory() override {}
30 
31 public:
41 
42  void ChangeInterval(int change) {
43  int new_interval = interval_ + change * INTERVAL_STEP;
44  if (new_interval >= INTERVAL_MIN && new_interval <= INTERVAL_MAX) {
45  interval_ = new_interval;
46  }
47  }
48 
49  size_t NumOfFrames() const {
50  if (view_status_.empty()) {
51  return 0;
52  } else {
53  return is_loop_ ? (interval_ + 1) * view_status_.size()
54  : (interval_ + 1) * (view_status_.size() - 1) + 1;
55  }
56  }
57 
58  void Reset() {
59  is_loop_ = false;
61  view_status_.clear();
62  }
63 
64  std::tuple<bool, ViewParameters> GetInterpolatedFrame(size_t k);
65 
66  bool ConvertToJsonValue(Json::Value &value) const override;
67  bool ConvertFromJsonValue(const Json::Value &value) override;
68 
69 public:
70  std::vector<ViewParameters> view_status_;
71  bool is_loop_ = false;
73  std::vector<ViewParameters::Matrix17x4d,
76 };
77 
78 } // namespace visualization
79 } // namespace open3d
Definition: IJsonConvertible.h:40
Eigen::Matrix< double, 17, 4, Eigen::RowMajor > Matrix17x4d
Definition: ViewParameters.h:20
Eigen::aligned_allocator< Matrix17x4d > Matrix17x4d_allocator
Definition: ViewParameters.h:22
Definition: ViewTrajectory.h:20
ViewTrajectory()
Definition: ViewTrajectory.h:28
static const int INTERVAL_DEFAULT
Definition: ViewTrajectory.h:25
void Reset()
Definition: ViewTrajectory.h:58
std::vector< ViewParameters::Matrix17x4d, ViewParameters::Matrix17x4d_allocator > coeff_
Definition: ViewTrajectory.h:75
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: ViewTrajectory.cpp:147
static const int INTERVAL_MAX
Definition: ViewTrajectory.h:22
void ComputeInterpolationCoefficients()
Definition: ViewTrajectory.cpp:24
bool is_loop_
Definition: ViewTrajectory.h:71
static const int INTERVAL_MIN
Definition: ViewTrajectory.h:23
int interval_
Definition: ViewTrajectory.h:72
static const int INTERVAL_STEP
Definition: ViewTrajectory.h:24
void ChangeInterval(int change)
Definition: ViewTrajectory.h:42
std::tuple< bool, ViewParameters > GetInterpolatedFrame(size_t k)
Definition: ViewTrajectory.cpp:112
std::vector< ViewParameters > view_status_
Definition: ViewTrajectory.h:70
bool ConvertToJsonValue(Json::Value &value) const override
Definition: ViewTrajectory.cpp:129
size_t NumOfFrames() const
Definition: ViewTrajectory.h:49
~ViewTrajectory() override
Definition: ViewTrajectory.h:29
Definition: PinholeCameraIntrinsic.cpp:16