DART  6.10.1
FileInfoC3D.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_UTILS_FILEINFOC3D_HPP_
34 #define DART_UTILS_FILEINFOC3D_HPP_
35 
36 #include <vector>
37 #include <Eigen/Dense>
38 
39 #include "dart/math/MathTypes.hpp"
40 
41 namespace dart {
42 namespace utils {
43 
45 {
46 
47 public:
48  FileInfoC3D();
49  virtual ~FileInfoC3D()
50  {
51  }
52 
53  inline int getNumMarkers() const
54  {
55  return mNumMarkers;
56  }
57  inline int getNumFrames() const
58  {
59  return mNumFrames;
60  }
61  inline double getFPS() const
62  {
63  return mFPS;
64  }
65 
66  inline Eigen::Vector3d getDataAt(int _frame, int _idx) const
67  {
68  return mData.at(_frame).at(_idx);
69  }
70  inline void addData(const std::vector<Eigen::Vector3d>& _data)
71  {
72  mData.push_back(_data);
73  }
74 
75  virtual bool loadFile(const char*);
76  virtual bool saveFile(
77  const char*,
78  int _start,
79  int _end,
80  double _sampleRate = 1);
81 
82 protected:
85  std::vector<std::vector<Eigen::Vector3d>> mData;
86  double mFPS;
87  char mFileName[256]; // change to string?
88 };
89 
90 } // namespace utils
91 } // namespace dart
92 
93 #endif // #ifndef DART_UTILS_FILEINFOC3D_HPP_
Definition: FileInfoC3D.hpp:45
int mNumMarkers
Definition: FileInfoC3D.hpp:83
virtual ~FileInfoC3D()
Definition: FileInfoC3D.hpp:49
char mFileName[256]
Definition: FileInfoC3D.hpp:87
FileInfoC3D()
Definition: FileInfoC3D.cpp:41
double mFPS
Definition: FileInfoC3D.hpp:86
virtual bool saveFile(const char *, int _start, int _end, double _sampleRate=1)
Note: down sampling not implemented yet.
Definition: FileInfoC3D.cpp:62
std::vector< std::vector< Eigen::Vector3d > > mData
Definition: FileInfoC3D.hpp:85
virtual bool loadFile(const char *)
Definition: FileInfoC3D.cpp:46
int mNumFrames
Definition: FileInfoC3D.hpp:84
int getNumMarkers() const
Definition: FileInfoC3D.hpp:53
double getFPS() const
Definition: FileInfoC3D.hpp:61
void addData(const std::vector< Eigen::Vector3d > &_data)
Definition: FileInfoC3D.hpp:70
Eigen::Vector3d getDataAt(int _frame, int _idx) const
Note: not checking index range.
Definition: FileInfoC3D.hpp:66
int getNumFrames() const
Definition: FileInfoC3D.hpp:57
Definition: BulletCollisionDetector.cpp:65