Open3D (C++ API)  0.18.0
Loading...
Searching...
No Matches
ViewControlWithCustomAnimation.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
13
14namespace open3d {
15namespace visualization {
16
18public:
24
25public:
27
28 void Reset() override;
29 void ChangeFieldOfView(double step) override;
30 void Scale(double scale) override;
31 void Rotate(double x, double y, double xo, double yo) override;
32 void Translate(double x, double y, double xo, double yo) override;
33
35 void AddKeyFrame();
36 void UpdateKeyFrame();
37 void DeleteKeyFrame();
38 void AddSpinKeyFrames(int num_of_key_frames = 20);
40 size_t NumOfKeyFrames() const {
41 return view_trajectory_.view_status_.size();
42 }
43 size_t NumOfFrames() const { return view_trajectory_.NumOfFrames(); }
55 std::string GetStatusString() const;
56 void Step(double change);
57 void GoToFirst();
58 void GoToLast();
59 bool CaptureTrajectory(const std::string &filename = "");
60 bool LoadTrajectoryFromJsonFile(const std::string &filename);
62 const camera::PinholeCameraTrajectory &camera_trajectory);
67 bool IsPlayingEnd(size_t num) {
68 return (IsPlaying() && num >= view_trajectory_.NumOfFrames());
69 }
71
72protected:
73 size_t CurrentFrame() const { return (size_t)round(current_frame_); }
74 size_t CurrentKeyframe() const { return (size_t)round(current_keyframe_); }
75 double RegularizeFrameIndex(double current_frame,
76 size_t num_of_frames,
77 bool is_loop);
79
80protected:
83 double current_frame_ = 0.0;
84 double current_keyframe_ = 0.0;
85};
86
87} // namespace visualization
88} // namespace open3d
Definition PinholeCameraTrajectory.h:21
View controller for visualizer.
Definition ViewControl.h:23
Definition ViewControlWithCustomAnimation.h:17
bool IsPlayingEnd(size_t num)
Definition ViewControlWithCustomAnimation.h:67
bool IsPlaying()
Definition ViewControlWithCustomAnimation.h:66
void Scale(double scale) override
Definition ViewControlWithCustomAnimation.cpp:45
void GoToLast()
Definition ViewControlWithCustomAnimation.cpp:203
void Step(double change)
Definition ViewControlWithCustomAnimation.cpp:173
ViewTrajectory view_trajectory_
Definition ViewControlWithCustomAnimation.h:82
bool IsValidPinholeCameraTrajectory() const
Definition ViewControlWithCustomAnimation.cpp:270
size_t CurrentFrame() const
Definition ViewControlWithCustomAnimation.h:73
size_t NumOfKeyFrames() const
Definition ViewControlWithCustomAnimation.h:40
size_t CurrentKeyframe() const
Definition ViewControlWithCustomAnimation.h:74
double RegularizeFrameIndex(double current_frame, size_t num_of_frames, bool is_loop)
Definition ViewControlWithCustomAnimation.cpp:286
double current_keyframe_
Definition ViewControlWithCustomAnimation.h:84
bool CaptureTrajectory(const std::string &filename="")
Definition ViewControlWithCustomAnimation.cpp:215
bool LoadTrajectoryFromJsonFile(const std::string &filename)
Definition ViewControlWithCustomAnimation.cpp:230
void SetAnimationMode(AnimationMode mode)
Definition ViewControlWithCustomAnimation.cpp:69
void GoToFirst()
Definition ViewControlWithCustomAnimation.cpp:191
double current_frame_
Definition ViewControlWithCustomAnimation.h:83
virtual ~ViewControlWithCustomAnimation()
Definition ViewControlWithCustomAnimation.h:26
void AddSpinKeyFrames(int num_of_key_frames=20)
Definition ViewControlWithCustomAnimation.cpp:125
void Reset() override
Definition ViewControlWithCustomAnimation.cpp:17
void UpdateKeyFrame()
Definition ViewControlWithCustomAnimation.cpp:104
AnimationMode animation_mode_
Definition ViewControlWithCustomAnimation.h:81
void ChangeTrajectoryInterval(int change)
Definition ViewControlWithCustomAnimation.h:49
void ChangeFieldOfView(double step) override
Definition ViewControlWithCustomAnimation.cpp:23
std::string GetStatusString() const
Definition ViewControlWithCustomAnimation.cpp:136
void ToggleTrajectoryLoop()
Definition ViewControlWithCustomAnimation.h:44
void DeleteKeyFrame()
Definition ViewControlWithCustomAnimation.cpp:112
size_t NumOfFrames() const
Definition ViewControlWithCustomAnimation.h:43
AnimationMode
Definition ViewControlWithCustomAnimation.h:19
@ PlayMode
Definition ViewControlWithCustomAnimation.h:22
@ PreviewMode
Definition ViewControlWithCustomAnimation.h:21
@ FreeMode
Definition ViewControlWithCustomAnimation.h:20
bool LoadTrajectoryFromCameraTrajectory(const camera::PinholeCameraTrajectory &camera_trajectory)
Definition ViewControlWithCustomAnimation.cpp:242
void AddKeyFrame()
Definition ViewControlWithCustomAnimation.cpp:87
bool IsPreviewing()
Definition ViewControlWithCustomAnimation.h:63
void ClearAllKeyFrames()
Definition ViewControlWithCustomAnimation.h:39
void SetViewControlFromTrajectory()
Definition ViewControlWithCustomAnimation.cpp:310
void Rotate(double x, double y, double xo, double yo) override
Function to process rotation.
Definition ViewControlWithCustomAnimation.cpp:51
void Translate(double x, double y, double xo, double yo) override
Function to process translation.
Definition ViewControlWithCustomAnimation.cpp:60
int GetTrajectoryInterval() const
Definition ViewControlWithCustomAnimation.h:54
Definition ViewTrajectory.h:20
bool is_loop_
Definition ViewTrajectory.h:71
int interval_
Definition ViewTrajectory.h:72
void ChangeInterval(int change)
Definition ViewTrajectory.h:42
std::vector< ViewParameters > view_status_
Definition ViewTrajectory.h:70
size_t NumOfFrames() const
Definition ViewTrajectory.h:49
Definition PinholeCameraIntrinsic.cpp:16