DART 6.12.2
Loading...
Searching...
No Matches
C3D.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_C3D_HPP_
34#define DART_UTILS_C3D_HPP_
35
36#include <ctime>
37#include <vector>
38
39#include <Eigen/Dense>
40
42
44// C3D file reader and writer
45namespace dart {
46namespace utils {
47
48#define C3D_REC_SIZE 512
49
50typedef struct c3d_head_t
51{
52 unsigned char prec_start;
53 unsigned char key;
54 short pnt_cnt;
57 short end_frame;
58 short int_gap;
59 float scale;
60 short rec_start;
61 short a_frames;
62 float freq;
63 short stuff[244];
65
66typedef struct c3d_param_t
67{
68 unsigned char reserved[2];
69 unsigned char pblocks;
70 unsigned char ftype;
73
74typedef struct c3d_frameSI_t
75{
76 short x, y, z;
77 unsigned char cam_byte;
78 unsigned char residual;
80
81typedef struct c3d_frame_t
82{
83 float x, y, z;
84 float residual;
86
87float convertDecToFloat(char _bytes[4]);
88void convertFloatToDec(float _f, char* _bytes);
89
90bool loadC3DFile(
91 const char* _fileName,
92 std::vector<std::vector<Eigen::Vector3d>>& _pointData,
93 int* _nFrame,
94 int* _nMarker,
95 double* _freq);
96bool saveC3DFile(
97 const char* _fileName,
98 std::vector<std::vector<Eigen::Vector3d>>& _pointData,
99 int _nFrame,
100 int _nMarker,
101 double _freq);
102
103} // namespace utils
104} // namespace dart
105
106#endif // #ifndef DART_UTILS_C3D_HPP_
#define C3D_REC_SIZE
Definition C3D.hpp:48
struct dart::utils::c3d_head_t c3d_head
void convertFloatToDec(float _f, char *_bytes)
Definition C3D.cpp:61
struct dart::utils::c3d_frame_t c3d_frame
bool loadC3DFile(const char *_fileName, std::vector< std::vector< Eigen::Vector3d > > &_pointData, int *_nFrame, int *_nMarker, double *_freq)
Definition C3D.cpp:72
struct dart::utils::c3d_frameSI_t c3d_frameSI
struct dart::utils::c3d_param_t c3d_param
bool saveC3DFile(const char *_fileName, std::vector< std::vector< Eigen::Vector3d > > &_pointData, int _nFrame, int _nMarker, double _freq)
Definition C3D.cpp:198
float convertDecToFloat(char _bytes[4])
Definition C3D.cpp:45
Definition BulletCollisionDetector.cpp:60
Definition C3D.hpp:75
unsigned char cam_byte
Definition C3D.hpp:77
short z
Definition C3D.hpp:76
unsigned char residual
Definition C3D.hpp:78
short y
Definition C3D.hpp:76
short x
Definition C3D.hpp:76
Definition C3D.hpp:82
float residual
Definition C3D.hpp:84
float y
Definition C3D.hpp:83
float x
Definition C3D.hpp:83
float z
Definition C3D.hpp:83
Definition C3D.hpp:51
short stuff[244]
Definition C3D.hpp:63
short start_frame
Definition C3D.hpp:56
short int_gap
Definition C3D.hpp:58
float freq
Definition C3D.hpp:62
short pnt_cnt
Definition C3D.hpp:54
short end_frame
Definition C3D.hpp:57
short a_channels
Definition C3D.hpp:55
unsigned char key
Definition C3D.hpp:53
unsigned char prec_start
Definition C3D.hpp:52
short a_frames
Definition C3D.hpp:61
float scale
Definition C3D.hpp:59
short rec_start
Definition C3D.hpp:60
Definition C3D.hpp:67
unsigned char reserved[2]
Definition C3D.hpp:68
char stuff[512 - 4]
Definition C3D.hpp:71
unsigned char pblocks
Definition C3D.hpp:69
unsigned char ftype
Definition C3D.hpp:70