Super4PCS Library  V1.1.2(719f5c0)
io.h
1 #ifndef _SUPER4PCS_IO_IO_H
2 #define _SUPER4PCS_IO_IO_H
3 
4 #include "super4pcs/shared4pcs.h"
5 #include "super4pcs/utils/disablewarnings.h"
6 
7 #include <fstream>
8 #include <iostream>
9 #include <string>
10 
11 #include <Eigen/Core>
12 
13 #ifndef _MSC_VER
14 #include <sys/time.h>
15 #include <unistd.h>
16 #endif
17 #include <stdlib.h>
18 
19 
20 struct tripple {
21  int a;
22  int b;
23  int c;
24  int n1;
25  int n2;
26  int n3;
27  int t1;
28  int t2;
29  int t3;
30  tripple() {}
31  tripple(int _a, int _b, int _c) : a(_a), b(_b), c(_c) {}
32 };
33 
34 class IOManager{
35 public:
36  enum MATRIX_MODE {
37  POLYWORKS
38  };
39 
40 public:
41  // Obj read/write simple functions.
42  bool ReadObject(const char *name,
43  std::vector<GlobalRegistration::Point3D> &v,
44  std::vector<Eigen::Matrix2f> &tex_coords,
45  std::vector<typename GlobalRegistration::Point3D::VectorType> &normals,
46  std::vector<tripple> &tris,
47  std::vector<std::string> &mtls);
48  bool WriteObject(const char *name,
49  const std::vector<GlobalRegistration::Point3D> &v,
50  const std::vector<Eigen::Matrix2f> &tex_coords,
51  const std::vector<typename GlobalRegistration::Point3D::VectorType> &normals,
52  const std::vector<tripple> &tris,
53  const std::vector<std::string> &mtls);
54 
55  bool WriteMatrix(const std::string& name,
56  const Eigen::Ref<const Eigen::Matrix<double, 4, 4> >& mat,
57  MATRIX_MODE mode);
58 private:
59  bool
60  ReadPly(const char *name,
61  std::vector<GlobalRegistration::Point3D> &v,
62  std::vector<typename GlobalRegistration::Point3D::VectorType> &normals);
63 
75  bool
76  ReadPtx(const char *name,
77  std::vector<GlobalRegistration::Point3D> &v);
78 
79  bool
80  ReadObj(const char *name,
81  std::vector<GlobalRegistration::Point3D> &v,
82  std::vector<Eigen::Matrix2f> &tex_coords,
83  std::vector<typename GlobalRegistration::Point3D::VectorType> &normals,
84  std::vector<tripple> &tris,
85  std::vector<std::string> &mtls);
86 
87  bool
88  WritePly(std::string name,
89  const std::vector<GlobalRegistration::Point3D> &v,
90  const std::vector<typename GlobalRegistration::Point3D::VectorType> &normals);
91 
92  bool
93  WriteObj(std::string name,
94  const std::vector<GlobalRegistration::Point3D> &v,
95  const std::vector<Eigen::Matrix2f> &tex_coords,
96  const std::vector<typename GlobalRegistration::Point3D::VectorType> &normals,
97  const std::vector<tripple> &tris, const std::vector<std::string> &mtls);
98 
99 
106  std::ofstream &
107  formatPolyworksMatrix(const Eigen::Ref<const Eigen::Matrix<double, 4, 4> >& mat,
108  std::ofstream &sstr);
109 }; // class IOMananger
110 
111 #endif // IO_H
MATRIX_MODE
Definition: io.h:36
int t2
Definition: io.h:28
int t1
Definition: io.h:27
int b
Definition: io.h:22
int n2
Definition: io.h:25
tripple(int _a, int _b, int _c)
Definition: io.h:31
int n1
Definition: io.h:24
int a
Definition: io.h:21
Definition: io.h:34
int c
Definition: io.h:23
tripple()
Definition: io.h:30
Definition: io.h:20
int n3
Definition: io.h:26
int t3
Definition: io.h:29