Open3D (C++ API)
ViewTrajectory.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <vector>
30 #include <tuple>
31 #include <Eigen/Core>
34 
35 namespace open3d {
36 namespace visualization {
37 
39 public:
40  static const int INTERVAL_MAX;
41  static const int INTERVAL_MIN;
42  static const int INTERVAL_STEP;
43  static const int INTERVAL_DEFAULT;
44 
45 public:
47  ~ViewTrajectory() override {}
48 
49 public:
59 
60  void ChangeInterval(int change) {
61  int new_interval = interval_ + change * INTERVAL_STEP;
62  if (new_interval >= INTERVAL_MIN && new_interval <= INTERVAL_MAX) {
63  interval_ = new_interval;
64  }
65  }
66 
67  size_t NumOfFrames() const {
68  if (view_status_.empty()) {
69  return 0;
70  } else {
71  return is_loop_ ? (interval_ + 1) * view_status_.size()
72  : (interval_ + 1) * (view_status_.size() - 1) + 1;
73  }
74  }
75 
76  void Reset() {
77  is_loop_ = false;
79  view_status_.clear();
80  }
81 
82  std::tuple<bool, ViewParameters> GetInterpolatedFrame(size_t k);
83 
84  bool ConvertToJsonValue(Json::Value &value) const override;
85  bool ConvertFromJsonValue(const Json::Value &value) override;
86 
87 public:
88  std::vector<ViewParameters> view_status_;
89  bool is_loop_ = false;
91  std::vector<ViewParameters::Matrix17x4d,
94 };
95 
96 } // namespace visualization
97 } // namespace open3d
Definition: ViewTrajectory.h:38
void ChangeInterval(int change)
Definition: ViewTrajectory.h:60
void ComputeInterpolationCoefficients()
Definition: ViewTrajectory.cpp:41
bool is_loop_
Definition: ViewTrajectory.h:89
void Reset()
Definition: ViewTrajectory.h:76
static const int INTERVAL_MIN
Definition: ViewTrajectory.h:41
std::vector< ViewParameters > view_status_
Definition: ViewTrajectory.h:88
Eigen::Matrix< double, 17, 4, Eigen::RowMajor > Matrix17x4d
Definition: ViewParameters.h:38
Eigen::aligned_allocator< Matrix17x4d > Matrix17x4d_allocator
Definition: ViewParameters.h:40
bool ConvertToJsonValue(Json::Value &value) const override
Definition: ViewTrajectory.cpp:146
std::tuple< bool, ViewParameters > GetInterpolatedFrame(size_t k)
Definition: ViewTrajectory.cpp:129
ViewTrajectory()
Definition: ViewTrajectory.h:46
~ViewTrajectory() override
Definition: ViewTrajectory.h:47
int interval_
Definition: ViewTrajectory.h:90
static const int INTERVAL_MAX
Definition: ViewTrajectory.h:40
std::vector< ViewParameters::Matrix17x4d, ViewParameters::Matrix17x4d_allocator > coeff_
Definition: ViewTrajectory.h:93
Definition: PinholeCameraIntrinsic.cpp:33
size_t NumOfFrames() const
Definition: ViewTrajectory.h:67
static const int INTERVAL_DEFAULT
Definition: ViewTrajectory.h:43
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: ViewTrajectory.cpp:164
static const int INTERVAL_STEP
Definition: ViewTrajectory.h:42
Definition: IJsonConvertible.h:41